jsimd_set_idct_islow:
 1148|    257|{
 1149|    257|  init_simd((j_common_ptr)cinfo);
 1150|       |
 1151|    257|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1151:7): [Folded, False: 257]
  ------------------
 1152|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1153|    257|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    257|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1153:7): [Folded, False: 257]
  ------------------
 1154|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1155|    257|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (1155:7): [Folded, False: 257]
  ------------------
 1156|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1157|    257|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (1157:7): [Folded, False: 257]
  ------------------
 1158|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1159|    257|  if (!cinfo->idct)
  ------------------
  |  Branch (1159:7): [True: 0, False: 257]
  ------------------
 1160|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1161|       |
 1162|    257|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1163|    257|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|    257|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (1163:7): [True: 0, False: 257]
  ------------------
 1164|      0|      IS_ALIGNED_AVX(jconst_idct_islow_avx2)) {
  ------------------
  |  |   46|      0|#define IS_ALIGNED_AVX(ptr)  (IS_ALIGNED(ptr, 5)) /* 32 byte alignment */
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (46:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1165|      0|    cinfo->idct->idct_simd = jsimd_idct_islow_avx2;
 1166|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
 1167|      0|  }
 1168|    257|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|    257|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1168:7): [True: 0, False: 257]
  ------------------
 1169|      0|      IS_ALIGNED_SSE(jconst_idct_islow_sse2)) {
  ------------------
  |  |   45|      0|#define IS_ALIGNED_SSE(ptr)  (IS_ALIGNED(ptr, 4)) /* 16 byte alignment */
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_ALIGNED(ptr, order)  (((JUINTPTR)ptr & ((1 << order) - 1)) == 0)
  |  |  ------------------
  |  |  |  Branch (45:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1170|      0|    cinfo->idct->idct_simd = jsimd_idct_islow_sse2;
 1171|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
 1172|      0|  }
 1173|       |#if SIMD_ARCHITECTURE == I386
 1174|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
 1175|       |    cinfo->idct->idct_simd = jsimd_idct_islow_mmx;
 1176|       |    return JSIMD_MMX;
 1177|       |  }
 1178|       |#endif
 1179|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
 1180|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
 1181|       |    cinfo->idct->idct_simd = jsimd_idct_islow_neon;
 1182|       |    return JSIMD_NEON;
 1183|       |  }
 1184|       |#elif SIMD_ARCHITECTURE == POWERPC
 1185|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
 1186|       |    cinfo->idct->idct_simd = jsimd_idct_islow_altivec;
 1187|       |    return JSIMD_ALTIVEC;
 1188|       |  }
 1189|       |#elif SIMD_ARCHITECTURE == RISCV64
 1190|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
 1191|       |    cinfo->idct->idct_simd = jsimd_idct_islow_rvv;
 1192|       |    return JSIMD_RVV;
 1193|       |  }
 1194|       |#elif SIMD_ARCHITECTURE == MIPS64
 1195|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
 1196|       |    cinfo->idct->idct_simd = jsimd_idct_islow_mmi;
 1197|       |    return JSIMD_MMI;
 1198|       |  }
 1199|       |#endif
 1200|       |
 1201|    257|  return JSIMD_NONE;
  ------------------
  |  |   38|    257|#define JSIMD_NONE       0x00
  ------------------
 1202|    257|}
jsimd.c:init_simd:
   56|    257|{
   57|    257|#ifndef NO_GETENV
   58|    257|  char env[2] = { 0 };
   59|    257|#endif
   60|    257|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 257, False: 0]
  ------------------
   61|    257|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|    257|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|    257|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 257, False: 0]
  ------------------
   64|    257|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|    257|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|    257|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|    257|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|    257|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 0, False: 257]
  ------------------
   68|      0|    return;
   69|       |
   70|    257|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|    257|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|    257|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|    257|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 257, False: 0]
  |  Branch (75:47): [True: 0, False: 257]
  ------------------
   76|      0|    simd_support &= JSIMD_SSE2 | JSIMD_SSE;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
                  simd_support &= JSIMD_SSE2 | JSIMD_SSE;
  ------------------
  |  |   41|      0|#define JSIMD_SSE        0x04
  ------------------
   77|       |#if SIMD_ARCHITECTURE == I386
   78|       |  if (!GETENV_S(env, 2, "JSIMD_FORCESSE") && !strcmp(env, "1"))
   79|       |    simd_support &= JSIMD_SSE | JSIMD_MMX;
   80|       |  if (!GETENV_S(env, 2, "JSIMD_FORCEMMX") && !strcmp(env, "1"))
   81|       |    simd_support &= JSIMD_MMX;
   82|       |  if (!GETENV_S(env, 2, "JSIMD_FORCE3DNOW") && !strcmp(env, "1"))
   83|       |    simd_support &= JSIMD_3DNOW | JSIMD_MMX;
   84|       |#endif
   85|       |#elif SIMD_ARCHITECTURE == ARM
   86|       |  if (!GETENV_S(env, 2, "JSIMD_FORCENEON") && !strcmp(env, "1"))
   87|       |    simd_support = JSIMD_NEON;
   88|       |#elif SIMD_ARCHITECTURE == RISCV64
   89|       |  if (!GETENV_S(env, 2, "JSIMD_FORCERVV") && !strcmp(env, "1"))
   90|       |    simd_support = JSIMD_RVV;
   91|       |#elif SIMD_ARCHITECTURE == MIPS64
   92|       |  if (!GETENV_S(env, 2, "JSIMD_FORCEMMI") && !strcmp(env, "1"))
   93|       |    simd_support = JSIMD_MMI;
   94|       |#endif
   95|    257|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 257, False: 0]
  |  Branch (95:47): [True: 257, False: 0]
  ------------------
   96|    257|    simd_support = 0;
   97|    257|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (97:7): [True: 257, False: 0]
  |  Branch (97:47): [True: 0, False: 257]
  ------------------
   98|      0|    simd_huffman = 0;
   99|    257|#endif
  100|       |
  101|    257|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (101:7): [True: 257, False: 0]
  ------------------
  102|    257|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  103|    257|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  104|    257|  } else {
  105|      0|    ((j_compress_ptr)cinfo)->master->simd_support = simd_support;
  106|      0|    ((j_compress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  107|      0|  }
  108|    257|}

jpeg_abort:
   37|      1|{
   38|      1|  int pool;
   39|       |
   40|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   41|      1|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (41:7): [True: 0, False: 1]
  ------------------
   42|      0|    return;
   43|       |
   44|       |  /* Releasing pools in reverse order might help avoid fragmentation
   45|       |   * with some (brain-damaged) malloc libraries.
   46|       |   */
   47|      2|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|      1|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|      2|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (47:35): [True: 1, False: 1]
  ------------------
   48|      1|    (*cinfo->mem->free_pool) (cinfo, pool);
   49|      1|  }
   50|       |
   51|       |  /* Reset overall state for possible reuse of object */
   52|      1|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (52:7): [True: 1, False: 0]
  ------------------
   53|      1|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|      1|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   54|       |    /* Try to keep application from accessing now-deleted marker list.
   55|       |     * A bit kludgy to do it here, but this is the most central place.
   56|       |     */
   57|      1|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   58|      1|    ((j_decompress_ptr)cinfo)->master->marker_list_end = NULL;
   59|      1|  } else {
   60|      0|    cinfo->global_state = CSTATE_START;
  ------------------
  |  |   44|      0|#define CSTATE_START     100    /* after create_compress */
  ------------------
   61|      0|  }
   62|       |
   63|       |#ifdef WITH_PROFILE
   64|       |  if (cinfo->is_decompressor) {
   65|       |    if (((j_decompress_ptr)cinfo)->master->total_start > 0.0)
   66|       |      ((j_decompress_ptr)cinfo)->master->total_elapsed +=
   67|       |        getTime() - ((j_decompress_ptr)cinfo)->master->total_start;
   68|       |  } else {
   69|       |    if (((j_compress_ptr)cinfo)->master->total_start > 0.0)
   70|       |      ((j_compress_ptr)cinfo)->master->total_elapsed +=
   71|       |        getTime() - ((j_compress_ptr)cinfo)->master->total_start;
   72|       |  }
   73|       |#endif
   74|      1|}
jpeg_destroy:
   90|    504|{
   91|       |#ifdef WITH_PROFILE
   92|       |  if (cinfo->is_decompressor) {
   93|       |    j_decompress_ptr dinfo = (j_decompress_ptr)cinfo;
   94|       |
   95|       |    if (dinfo->master->entropy_mcoeffs > 0.0) {
   96|       |      fprintf(stderr, "Entropy decoding:    %14.6f Mcoefficients/sec",
   97|       |              dinfo->master->entropy_mcoeffs / dinfo->master->entropy_elapsed);
   98|       |      if (dinfo->master->total_elapsed > 0.0)
   99|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  100|       |                dinfo->master->entropy_elapsed * 100.0 /
  101|       |                  dinfo->master->total_elapsed);
  102|       |      fprintf(stderr, "\n");
  103|       |    }
  104|       |    if (dinfo->master->idct_mcoeffs > 0.0) {
  105|       |      fprintf(stderr, "Inverse DCT:         %14.6f Mcoefficients/sec",
  106|       |              dinfo->master->idct_mcoeffs / dinfo->master->idct_elapsed);
  107|       |      if (dinfo->master->total_elapsed > 0.0)
  108|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  109|       |                dinfo->master->idct_elapsed * 100.0 /
  110|       |                  dinfo->master->total_elapsed);
  111|       |      fprintf(stderr, "\n");
  112|       |    }
  113|       |    if (dinfo->master->merged_upsample_mpixels > 0.0) {
  114|       |      fprintf(stderr, "Merged upsampling:   %14.6f Mpixels/sec",
  115|       |              dinfo->master->merged_upsample_mpixels /
  116|       |                dinfo->master->merged_upsample_elapsed);
  117|       |      if (dinfo->master->total_elapsed > 0.0)
  118|       |        fprintf(stderr, "        (%5.2f%% of total time)",
  119|       |                dinfo->master->merged_upsample_elapsed * 100.0 /
  120|       |                  dinfo->master->total_elapsed);
  121|       |      fprintf(stderr, "\n");
  122|       |    }
  123|       |    if (dinfo->master->upsample_msamples > 0.0) {
  124|       |      fprintf(stderr, "Upsampling:          %14.6f Msamples/sec",
  125|       |              dinfo->master->upsample_msamples /
  126|       |                dinfo->master->upsample_elapsed);
  127|       |      if (dinfo->master->total_elapsed > 0.0)
  128|       |        fprintf(stderr, "       (%5.2f%% of total time)",
  129|       |                dinfo->master->upsample_elapsed * 100.0 /
  130|       |                  dinfo->master->total_elapsed);
  131|       |      fprintf(stderr, "\n");
  132|       |    }
  133|       |    if (dinfo->master->cconvert_mpixels > 0.0) {
  134|       |      fprintf(stderr, "Color deconversion:  %14.6f Mpixels/sec",
  135|       |              dinfo->master->cconvert_mpixels /
  136|       |                dinfo->master->cconvert_elapsed);
  137|       |      if (dinfo->master->total_elapsed > 0.0)
  138|       |        fprintf(stderr, "        (%5.2f%% of total time)",
  139|       |                dinfo->master->cconvert_elapsed * 100.0 /
  140|       |                  dinfo->master->total_elapsed);
  141|       |      fprintf(stderr, "\n");
  142|       |    }
  143|       |  } else {
  144|       |    j_compress_ptr _cinfo = (j_compress_ptr)cinfo;
  145|       |
  146|       |    if (_cinfo->master->cconvert_mpixels > 0.0) {
  147|       |      fprintf(stderr, "Color conversion:    %14.6f Mpixels/sec",
  148|       |              _cinfo->master->cconvert_mpixels /
  149|       |                _cinfo->master->cconvert_elapsed);
  150|       |      if (_cinfo->master->total_elapsed > 0.0)
  151|       |        fprintf(stderr, "        (%5.2f%% of total time)",
  152|       |                _cinfo->master->cconvert_elapsed * 100.0 /
  153|       |                  _cinfo->master->total_elapsed);
  154|       |      fprintf(stderr, "\n");
  155|       |    }
  156|       |    if (_cinfo->master->downsample_msamples > 0.0) {
  157|       |      fprintf(stderr, "Downsampling:        %14.6f Msamples/sec",
  158|       |              _cinfo->master->downsample_msamples /
  159|       |                _cinfo->master->downsample_elapsed);
  160|       |      if (_cinfo->master->total_elapsed > 0.0)
  161|       |        fprintf(stderr, "       (%5.2f%% of total time)",
  162|       |                _cinfo->master->downsample_elapsed * 100.0 /
  163|       |                  _cinfo->master->total_elapsed);
  164|       |      fprintf(stderr, "\n");
  165|       |    }
  166|       |    if (_cinfo->master->convsamp_msamples > 0.0) {
  167|       |      fprintf(stderr, "Sample conversion:   %14.6f Msamples/sec",
  168|       |              _cinfo->master->convsamp_msamples /
  169|       |                _cinfo->master->convsamp_elapsed);
  170|       |      if (_cinfo->master->total_elapsed > 0.0)
  171|       |        fprintf(stderr, "       (%5.2f%% of total time)",
  172|       |                _cinfo->master->convsamp_elapsed * 100.0 /
  173|       |                  _cinfo->master->total_elapsed);
  174|       |      fprintf(stderr, "\n");
  175|       |    }
  176|       |    if (_cinfo->master->fdct_mcoeffs > 0.0) {
  177|       |      fprintf(stderr, "Forward DCT:         %14.6f Mcoefficients/sec",
  178|       |              _cinfo->master->fdct_mcoeffs / _cinfo->master->fdct_elapsed);
  179|       |      if (_cinfo->master->total_elapsed > 0.0)
  180|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  181|       |                _cinfo->master->fdct_elapsed * 100.0 /
  182|       |                  _cinfo->master->total_elapsed);
  183|       |      fprintf(stderr, "\n");
  184|       |    }
  185|       |    if (_cinfo->master->quantize_mcoeffs > 0.0) {
  186|       |      fprintf(stderr, "Quantization:        %14.6f Mcoefficients/sec",
  187|       |              _cinfo->master->quantize_mcoeffs /
  188|       |                _cinfo->master->quantize_elapsed);
  189|       |      if (_cinfo->master->total_elapsed > 0.0)
  190|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  191|       |                _cinfo->master->quantize_elapsed * 100.0 /
  192|       |                  _cinfo->master->total_elapsed);
  193|       |      fprintf(stderr, "\n");
  194|       |    }
  195|       |    if (_cinfo->master->entropy_mcoeffs > 0.0) {
  196|       |      fprintf(stderr, "Entropy encoding:    %14.6f Mcoefficients/sec",
  197|       |              _cinfo->master->entropy_mcoeffs /
  198|       |                _cinfo->master->entropy_elapsed);
  199|       |      if (_cinfo->master->total_elapsed > 0.0)
  200|       |        fprintf(stderr, "  (%5.2f%% of total time)",
  201|       |                _cinfo->master->entropy_elapsed * 100.0 /
  202|       |                  _cinfo->master->total_elapsed);
  203|       |      fprintf(stderr, "\n");
  204|       |    }
  205|       |  }
  206|       |#endif
  207|       |
  208|       |  /* We need only tell the memory manager to release everything. */
  209|       |  /* NB: mem pointer is NULL if memory mgr failed to initialize. */
  210|    504|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (210:7): [True: 504, False: 0]
  ------------------
  211|    504|    (*cinfo->mem->self_destruct) (cinfo);
  212|       |  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
  213|    504|  cinfo->global_state = 0;      /* mark it destroyed */
  214|    504|}
jpeg_alloc_quant_table:
  224|    365|{
  225|    365|  JQUANT_TBL *tbl;
  226|       |
  227|    365|  tbl = (JQUANT_TBL *)
  228|    365|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  888|    365|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  229|    365|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|    365|#define FALSE   0               /* values of boolean */
  ------------------
  230|    365|  return tbl;
  231|    365|}
jpeg_alloc_huff_table:
  236|  1.17k|{
  237|  1.17k|  JHUFF_TBL *tbl;
  238|       |
  239|  1.17k|  tbl = (JHUFF_TBL *)
  240|  1.17k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  888|  1.17k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  241|  1.17k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  1.17k|#define FALSE   0               /* values of boolean */
  ------------------
  242|  1.17k|  return tbl;
  243|  1.17k|}

jpeg_CreateDecompress:
   40|    504|{
   41|    504|  int i;
   42|       |
   43|       |  /* Guard against version mismatches between library and caller. */
   44|    504|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   45|    504|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|    504|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (45:7): [True: 0, False: 504]
  ------------------
   46|      0|    ERREXIT2(cinfo, JERR_BAD_LIB_VERSION, JPEG_LIB_VERSION, version);
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   47|    504|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (47:7): [True: 0, False: 504]
  ------------------
   48|      0|    ERREXIT2(cinfo, JERR_BAD_STRUCT_SIZE,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   49|    504|             (int)sizeof(struct jpeg_decompress_struct), (int)structsize);
   50|       |
   51|       |  /* For debugging purposes, we zero the whole master structure.
   52|       |   * But the application has already set the err pointer, and may have set
   53|       |   * client_data, so we have to save and restore those fields.
   54|       |   * Note: if application hasn't set client_data, tools like Purify may
   55|       |   * complain here.
   56|       |   */
   57|    504|  {
   58|    504|    struct jpeg_error_mgr *err = cinfo->err;
   59|    504|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   60|    504|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   61|    504|    cinfo->err = err;
   62|    504|    cinfo->client_data = client_data;
   63|    504|  }
   64|    504|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|    504|#define TRUE    1
  ------------------
   65|       |
   66|       |  /* Initialize a memory manager instance for this object */
   67|    504|  jinit_memory_mgr((j_common_ptr)cinfo);
   68|       |
   69|       |  /* Zero out pointers to permanent structures. */
   70|    504|  cinfo->progress = NULL;
   71|    504|  cinfo->src = NULL;
   72|       |
   73|  2.52k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|  2.52k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 2.01k, False: 504]
  ------------------
   74|  2.01k|    cinfo->quant_tbl_ptrs[i] = NULL;
   75|       |
   76|  2.52k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  2.52k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (76:15): [True: 2.01k, False: 504]
  ------------------
   77|  2.01k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   78|  2.01k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   79|  2.01k|  }
   80|       |
   81|       |  /* Initialize marker processor so application can override methods
   82|       |   * for COM, APPn markers before calling jpeg_read_header.
   83|       |   */
   84|    504|  cinfo->marker_list = NULL;
   85|    504|  jinit_marker_reader(cinfo);
   86|       |
   87|       |  /* And initialize the overall input controller. */
   88|    504|  jinit_input_controller(cinfo);
   89|       |
   90|    504|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|    504|#define BITS_IN_JSAMPLE  8
  ------------------
   91|       |
   92|       |  /* OK, I'm ready */
   93|    504|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|    504|#define DSTATE_START     200    /* after create_decompress */
  ------------------
   94|       |
   95|       |  /* The master struct is used to store extension parameters, so we allocate it
   96|       |   * here.
   97|       |   */
   98|    504|  cinfo->master = (struct jpeg_decomp_master *)
   99|    504|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    504|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  100|    504|                                sizeof(my_decomp_master));
  101|    504|  memset(cinfo->master, 0, sizeof(my_decomp_master));
  102|    504|#ifdef WITH_SIMD
  103|    504|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|    504|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|    504|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  104|    504|  cinfo->master->simd_huffman = 1;
  105|    504|#endif
  106|    504|}
jpeg_destroy_decompress:
  115|    504|{
  116|    504|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  117|    504|}
jpeg_read_header:
  275|    504|{
  276|    504|  int retcode;
  277|       |
  278|    504|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|  1.00k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (278:7): [True: 0, False: 504]
  ------------------
  279|      0|      cinfo->global_state != DSTATE_INHEADER)
  ------------------
  |  |   49|      0|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (279:7): [True: 0, False: 0]
  ------------------
  280|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|    504|  retcode = jpeg_consume_input(cinfo);
  283|       |
  284|    504|  switch (retcode) {
  ------------------
  |  Branch (284:11): [True: 290, False: 214]
  ------------------
  285|    289|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|    289|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (285:3): [True: 289, False: 215]
  ------------------
  286|    289|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|    289|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  287|    289|    break;
  288|      1|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|      1|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (288:3): [True: 1, False: 503]
  ------------------
  289|      1|    if (require_image)          /* Complain if application wanted an image */
  ------------------
  |  Branch (289:9): [True: 1, False: 0]
  ------------------
  290|      1|      ERREXIT(cinfo, JERR_NO_IMAGE);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  291|       |    /* Reset to start state; it would be safer to require the application to
  292|       |     * call jpeg_abort, but we can't change it now for compatibility reasons.
  293|       |     * A side effect is to free any temporary memory (there shouldn't be any).
  294|       |     */
  295|      1|    jpeg_abort((j_common_ptr)cinfo); /* sets state = DSTATE_START */
  296|      1|    retcode = JPEG_HEADER_TABLES_ONLY;
  ------------------
  |  | 1067|      1|#define JPEG_HEADER_TABLES_ONLY  2 /* Found valid table-specs-only datastream */
  ------------------
  297|      1|    break;
  298|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (298:3): [True: 0, False: 504]
  ------------------
  299|       |    /* no work */
  300|      0|    break;
  301|    504|  }
  302|       |
  303|    289|  return retcode;
  304|    504|}
jpeg_consume_input:
  321|    504|{
  322|    504|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1065|    504|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  323|       |
  324|       |  /* NB: every possible DSTATE value should be listed in this switch */
  325|    504|  switch (cinfo->global_state) {
  326|    504|  case DSTATE_START:
  ------------------
  |  |   48|    504|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (326:3): [True: 504, False: 0]
  ------------------
  327|       |    /* Start-of-datastream actions: reset appropriate modules */
  328|    504|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  329|       |    /* Initialize application's data source module */
  330|    504|    (*cinfo->src->init_source) (cinfo);
  331|    504|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|    504|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  332|    504|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|    504|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  333|    504|  case DSTATE_INHEADER:
  ------------------
  |  |   49|    504|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (333:3): [True: 0, False: 504]
  ------------------
  334|    504|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  335|    504|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1111|    504|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (335:9): [True: 289, False: 215]
  ------------------
  336|       |      /* Set up default parameters based on header data */
  337|    289|      default_decompress_parms(cinfo);
  338|       |      /* Set global state: ready for start_decompress */
  339|    289|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|    289|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  340|    289|    }
  341|    504|    break;
  342|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (342:3): [True: 0, False: 504]
  ------------------
  343|       |    /* Can't advance past first SOS until start_decompress is called */
  344|      0|    retcode = JPEG_REACHED_SOS;
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  345|      0|    break;
  346|      0|  case DSTATE_PRELOAD:
  ------------------
  |  |   51|      0|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (346:3): [True: 0, False: 504]
  ------------------
  347|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (347:3): [True: 0, False: 504]
  ------------------
  348|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:3): [True: 0, False: 504]
  ------------------
  349|      0|  case DSTATE_RAW_OK:
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (349:3): [True: 0, False: 504]
  ------------------
  350|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (350:3): [True: 0, False: 504]
  ------------------
  351|      0|  case DSTATE_BUFPOST:
  ------------------
  |  |   56|      0|#define DSTATE_BUFPOST   208    /* looking for SOS/EOI in jpeg_finish_output */
  ------------------
  |  Branch (351:3): [True: 0, False: 504]
  ------------------
  352|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (352:3): [True: 0, False: 504]
  ------------------
  353|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  354|      0|    break;
  355|      0|  default:
  ------------------
  |  Branch (355:3): [True: 0, False: 504]
  ------------------
  356|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  357|    504|  }
  358|    290|  return retcode;
  359|    504|}
jpeg_finish_decompress:
  403|     24|{
  404|     24|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|     48|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (404:8): [True: 24, False: 0]
  ------------------
  405|     24|       cinfo->global_state == DSTATE_RAW_OK) && !cinfo->buffered_image) {
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
  |  Branch (405:8): [True: 0, False: 0]
  |  Branch (405:49): [True: 24, False: 0]
  ------------------
  406|       |    /* Terminate final pass of non-buffered mode */
  407|     24|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (407:9): [True: 0, False: 24]
  ------------------
  408|      0|      ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  409|     24|    (*cinfo->master->finish_output_pass) (cinfo);
  410|     24|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|     24|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  411|     24|  } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (411:14): [True: 0, False: 0]
  ------------------
  412|       |    /* Finishing after a buffered-image operation */
  413|      0|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  414|      0|  } else if (cinfo->global_state != DSTATE_STOPPING) {
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (414:14): [True: 0, False: 0]
  ------------------
  415|       |    /* STOPPING = repeat call after a suspension, anything else is error */
  416|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  417|      0|  }
  418|       |  /* Read until EOI */
  419|     48|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (419:10): [True: 24, False: 24]
  ------------------
  420|     24|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|     24|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (420:9): [True: 0, False: 24]
  ------------------
  421|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  422|     24|  }
  423|       |  /* Do final cleanup */
  424|     24|  (*cinfo->src->term_source) (cinfo);
  425|       |  /* We can use jpeg_abort to release memory and reset global_state */
  426|     24|  jpeg_abort((j_common_ptr)cinfo);
  427|     24|  return TRUE;
  ------------------
  |  |  210|     24|#define TRUE    1
  ------------------
  428|     24|}
jdapimin.c:default_decompress_parms:
  138|    289|{
  139|       |  /* Guess the input colorspace, and set output colorspace accordingly. */
  140|       |  /* (Wish JPEG committee had provided a real way to specify this...) */
  141|       |  /* Note application may override our guesses. */
  142|    289|  switch (cinfo->num_components) {
  143|    289|  case 1:
  ------------------
  |  Branch (143:3): [True: 289, False: 0]
  ------------------
  144|    289|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  145|    289|    cinfo->out_color_space = JCS_GRAYSCALE;
  146|    289|    break;
  147|       |
  148|      0|  case 3:
  ------------------
  |  Branch (148:3): [True: 0, False: 289]
  ------------------
  149|      0|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (149:9): [True: 0, False: 0]
  ------------------
  150|      0|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  151|      0|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (151:16): [True: 0, False: 0]
  ------------------
  152|      0|      switch (cinfo->Adobe_transform) {
  153|      0|      case 0:
  ------------------
  |  Branch (153:7): [True: 0, False: 0]
  ------------------
  154|      0|        cinfo->jpeg_color_space = JCS_RGB;
  155|      0|        break;
  156|      0|      case 1:
  ------------------
  |  Branch (156:7): [True: 0, False: 0]
  ------------------
  157|      0|        cinfo->jpeg_color_space = JCS_YCbCr;
  158|      0|        break;
  159|      0|      default:
  ------------------
  |  Branch (159:7): [True: 0, False: 0]
  ------------------
  160|      0|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  161|      0|        cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  162|      0|        break;
  163|      0|      }
  164|      0|    } else {
  165|       |      /* Saw no special markers, try to guess from the component IDs */
  166|      0|      int cid0 = cinfo->comp_info[0].component_id;
  167|      0|      int cid1 = cinfo->comp_info[1].component_id;
  168|      0|      int cid2 = cinfo->comp_info[2].component_id;
  169|       |
  170|      0|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (170:11): [True: 0, False: 0]
  |  Branch (170:24): [True: 0, False: 0]
  |  Branch (170:37): [True: 0, False: 0]
  ------------------
  171|      0|#ifdef D_LOSSLESS_SUPPORTED
  172|      0|        if (cinfo->master->lossless)
  ------------------
  |  Branch (172:13): [True: 0, False: 0]
  ------------------
  173|      0|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  174|      0|        else
  175|      0|#endif
  176|      0|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  177|      0|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (177:18): [True: 0, False: 0]
  |  Branch (177:32): [True: 0, False: 0]
  |  Branch (177:46): [True: 0, False: 0]
  ------------------
  178|      0|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  179|      0|      else {
  180|      0|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|      0|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|      0|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|      0|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|      0|           (cinfo)->err->msg_code = (code); \
  |  |  312|      0|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  181|      0|#ifdef D_LOSSLESS_SUPPORTED
  182|      0|        if (cinfo->master->lossless)
  ------------------
  |  Branch (182:13): [True: 0, False: 0]
  ------------------
  183|      0|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  184|      0|        else
  185|      0|#endif
  186|      0|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  187|      0|      }
  188|      0|    }
  189|       |    /* Always guess RGB is proper output colorspace. */
  190|      0|    cinfo->out_color_space = JCS_RGB;
  191|      0|    break;
  192|       |
  193|      0|  case 4:
  ------------------
  |  Branch (193:3): [True: 0, False: 289]
  ------------------
  194|      0|    if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (194:9): [True: 0, False: 0]
  ------------------
  195|      0|      switch (cinfo->Adobe_transform) {
  196|      0|      case 0:
  ------------------
  |  Branch (196:7): [True: 0, False: 0]
  ------------------
  197|      0|        cinfo->jpeg_color_space = JCS_CMYK;
  198|      0|        break;
  199|      0|      case 2:
  ------------------
  |  Branch (199:7): [True: 0, False: 0]
  ------------------
  200|      0|        cinfo->jpeg_color_space = JCS_YCCK;
  201|      0|        break;
  202|      0|      default:
  ------------------
  |  Branch (202:7): [True: 0, False: 0]
  ------------------
  203|      0|        WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
  ------------------
  |  |  286|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  287|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  288|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  204|      0|        cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
  205|      0|        break;
  206|      0|      }
  207|      0|    } else {
  208|       |      /* No special markers, assume straight CMYK. */
  209|      0|      cinfo->jpeg_color_space = JCS_CMYK;
  210|      0|    }
  211|      0|    cinfo->out_color_space = JCS_CMYK;
  212|      0|    break;
  213|       |
  214|      0|  default:
  ------------------
  |  Branch (214:3): [True: 0, False: 289]
  ------------------
  215|      0|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  216|      0|    cinfo->out_color_space = JCS_UNKNOWN;
  217|      0|    break;
  218|    289|  }
  219|       |
  220|       |  /* Set defaults for other decompression parameters. */
  221|    289|  cinfo->scale_num = 1;         /* 1:1 scaling */
  222|    289|  cinfo->scale_denom = 1;
  223|    289|  cinfo->output_gamma = 1.0;
  224|    289|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  207|    289|#define FALSE   0               /* values of boolean */
  ------------------
  225|    289|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|    289|#define FALSE   0               /* values of boolean */
  ------------------
  226|    289|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|    289|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  227|    289|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  210|    289|#define TRUE    1
  ------------------
  228|    289|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  210|    289|#define TRUE    1
  ------------------
  229|    289|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  207|    289|#define FALSE   0               /* values of boolean */
  ------------------
  230|       |  /* We set these in case application only sets quantize_colors. */
  231|    289|  cinfo->dither_mode = JDITHER_FS;
  232|    289|#ifdef QUANT_2PASS_SUPPORTED
  233|    289|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  210|    289|#define TRUE    1
  ------------------
  234|       |#else
  235|       |  cinfo->two_pass_quantize = FALSE;
  236|       |#endif
  237|    289|  cinfo->desired_number_of_colors = 256;
  238|    289|  cinfo->colormap = NULL;
  239|       |  /* Initialize for no mode change in buffered-image mode. */
  240|    289|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|    289|#define FALSE   0               /* values of boolean */
  ------------------
  241|    289|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|    289|#define FALSE   0               /* values of boolean */
  ------------------
  242|    289|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|    289|#define FALSE   0               /* values of boolean */
  ------------------
  243|    289|}

jpeg_start_decompress:
   56|    287|{
   57|    287|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|    287|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (57:7): [True: 287, False: 0]
  ------------------
   58|       |    /* First call: initialize master control, select active modules */
   59|    287|    jinit_master_decompress(cinfo);
   60|    287|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (60:9): [True: 0, False: 287]
  ------------------
   61|       |      /* No more work here; expecting jpeg_start_output next */
   62|      0|      cinfo->global_state = DSTATE_BUFIMAGE;
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
   63|      0|      return TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
   64|      0|    }
   65|    287|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|    287|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   66|    287|  }
   67|    287|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|    287|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (67:7): [True: 258, False: 29]
  ------------------
   68|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   69|    258|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (69:9): [True: 0, False: 258]
  ------------------
   70|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
   71|      0|      for (;;) {
   72|      0|        int retcode;
   73|       |        /* Call progress monitor hook if present */
   74|      0|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (74:13): [True: 0, False: 0]
  ------------------
   75|      0|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   76|       |        /* Absorb some more input */
   77|      0|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   78|      0|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (78:13): [True: 0, False: 0]
  ------------------
   79|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   80|      0|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (80:13): [True: 0, False: 0]
  ------------------
   81|      0|          break;
   82|       |        /* Advance progress counter if appropriate */
   83|      0|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (83:13): [True: 0, False: 0]
  ------------------
   84|      0|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1113|      0|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1111|      0|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (84:14): [True: 0, False: 0]
  |  Branch (84:47): [True: 0, False: 0]
  ------------------
   85|      0|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (85:15): [True: 0, False: 0]
  ------------------
   86|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   87|      0|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   88|      0|          }
   89|      0|        }
   90|      0|      }
   91|       |#else
   92|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   93|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   94|      0|    }
   95|    258|    cinfo->output_scan_number = cinfo->input_scan_number;
   96|    258|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|     29|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (96:14): [True: 0, False: 29]
  ------------------
   97|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   98|       |  /* Perform any dummy output passes, and set up for the final pass */
   99|    287|  return output_pass_setup(cinfo);
  100|    287|}
jpeg_read_scanlines:
  324|  33.8k|{
  325|  33.8k|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  326|  33.8k|  JDIMENSION row_ctr;
  327|       |
  328|  33.8k|#ifdef D_LOSSLESS_SUPPORTED
  329|  33.8k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (329:7): [True: 0, False: 33.8k]
  ------------------
  330|      0|#if BITS_IN_JSAMPLE == 8
  331|      0|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (331:9): [True: 0, False: 0]
  |  Branch (331:52): [True: 0, False: 0]
  ------------------
  332|       |#else
  333|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  334|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  335|       |#endif
  336|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  337|      0|  } else
  338|  33.8k|#endif
  339|  33.8k|  {
  340|  33.8k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  33.8k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (340:9): [True: 1, False: 33.8k]
  ------------------
  341|      1|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  342|  33.8k|  }
  343|       |
  344|  33.8k|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|  33.8k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (344:7): [True: 0, False: 33.8k]
  ------------------
  345|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  346|  33.8k|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (346:7): [True: 0, False: 33.8k]
  ------------------
  347|      0|    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
  ------------------
  |  |  283|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  348|      0|    return 0;
  349|      0|  }
  350|       |
  351|       |  /* Call progress monitor hook if present */
  352|  33.8k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (352:7): [True: 33.8k, False: 1]
  ------------------
  353|  33.8k|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  354|  33.8k|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  355|  33.8k|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  356|  33.8k|  }
  357|       |
  358|       |  /* Process some data */
  359|  33.8k|  row_ctr = 0;
  360|  33.8k|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  256|  33.8k|#define _process_data  process_data
  ------------------
  |  Branch (360:7): [True: 0, False: 33.8k]
  ------------------
  361|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  362|  33.8k|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  256|  33.8k|#define _process_data  process_data
  ------------------
  363|  33.8k|  cinfo->output_scanline += row_ctr;
  364|  33.8k|  return row_ctr;
  365|       |#else
  366|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  367|       |  return 0;
  368|       |#endif
  369|  33.8k|}
jdapistd-8.c:output_pass_setup:
  113|    258|{
  114|    258|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|    258|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (114:7): [True: 258, False: 0]
  ------------------
  115|       |    /* First call: do pass setup */
  116|    258|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  117|    258|    cinfo->output_scanline = 0;
  118|    258|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|    258|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  119|    258|  }
  120|       |  /* Loop over any required dummy passes */
  121|    258|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (121:10): [True: 0, False: 258]
  ------------------
  122|      0|#ifdef QUANT_2PASS_SUPPORTED
  123|       |    /* Crank through the dummy pass */
  124|      0|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (124:12): [True: 0, False: 0]
  ------------------
  125|      0|      JDIMENSION last_scanline;
  126|       |      /* Call progress monitor hook if present */
  127|      0|      if (cinfo->progress != NULL) {
  ------------------
  |  Branch (127:11): [True: 0, False: 0]
  ------------------
  128|      0|        cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  129|      0|        cinfo->progress->pass_limit = (long)cinfo->output_height;
  130|      0|        (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  131|      0|      }
  132|       |      /* Process some data */
  133|      0|      last_scanline = cinfo->output_scanline;
  134|      0|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (134:11): [True: 0, False: 0]
  ------------------
  135|      0|        if (cinfo->main->process_data == NULL)
  ------------------
  |  Branch (135:13): [True: 0, False: 0]
  ------------------
  136|      0|          ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  137|      0|        (*cinfo->main->process_data) (cinfo, (JSAMPARRAY)NULL,
  138|      0|                                      &cinfo->output_scanline, (JDIMENSION)0);
  139|      0|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (139:18): [True: 0, False: 0]
  ------------------
  140|      0|        if (cinfo->main->process_data_12 == NULL)
  ------------------
  |  Branch (140:13): [True: 0, False: 0]
  ------------------
  141|      0|          ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  142|      0|        (*cinfo->main->process_data_12) (cinfo, (J12SAMPARRAY)NULL,
  143|      0|                                         &cinfo->output_scanline,
  144|      0|                                         (JDIMENSION)0);
  145|      0|      } else {
  146|      0|#ifdef D_LOSSLESS_SUPPORTED
  147|      0|        if (cinfo->main->process_data_16 == NULL)
  ------------------
  |  Branch (147:13): [True: 0, False: 0]
  ------------------
  148|      0|          ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  149|      0|        (*cinfo->main->process_data_16) (cinfo, (J16SAMPARRAY)NULL,
  150|      0|                                         &cinfo->output_scanline,
  151|      0|                                         (JDIMENSION)0);
  152|       |#else
  153|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  154|       |#endif
  155|      0|      }
  156|      0|      if (cinfo->output_scanline == last_scanline)
  ------------------
  |  Branch (156:11): [True: 0, False: 0]
  ------------------
  157|      0|        return FALSE;           /* No progress made, must suspend */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  158|      0|    }
  159|       |    /* Finish up dummy pass, and set up for another one */
  160|      0|    (*cinfo->master->finish_output_pass) (cinfo);
  161|      0|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  162|      0|    cinfo->output_scanline = 0;
  163|       |#else
  164|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  165|       |#endif /* QUANT_2PASS_SUPPORTED */
  166|      0|  }
  167|       |  /* Ready for application to drive output pass through
  168|       |   * _jpeg_read_scanlines or _jpeg_read_raw_data.
  169|       |   */
  170|    258|  cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   54|      0|#define DSTATE_RAW_OK    206    /* start_decompress done, read_raw_data OK */
  ------------------
                cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
  ------------------
  |  |   53|    516|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (170:25): [True: 0, False: 258]
  ------------------
  171|    258|  return TRUE;
  ------------------
  |  |  210|    258|#define TRUE    1
  ------------------
  172|    258|}

jinit_arith_decoder:
  751|      3|{
  752|      3|  arith_entropy_ptr entropy;
  753|      3|  int i;
  754|       |
  755|      3|  entropy = (arith_entropy_ptr)
  756|      3|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|      3|                                sizeof(arith_entropy_decoder));
  758|      3|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|      3|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|     51|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|     51|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 48, False: 3]
  ------------------
  763|     48|    entropy->dc_stats[i] = NULL;
  764|     48|    entropy->ac_stats[i] = NULL;
  765|     48|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|      3|  entropy->fixed_bin[0] = 113;
  769|       |
  770|      3|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 1, False: 2]
  ------------------
  771|       |    /* Create progression status table */
  772|      1|    int *coef_bit_ptr, ci;
  773|      1|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|      1|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|      1|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|      1|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|      1|                                  sizeof(int));
  777|      1|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|      2|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 1, False: 1]
  ------------------
  779|     65|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|     65|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 64, False: 1]
  ------------------
  780|     64|        *coef_bit_ptr++ = -1;
  781|      1|  }
  782|      3|}
jdarith.c:start_pass:
  633|      2|{
  634|      2|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|      2|  int ci, tbl;
  636|      2|  jpeg_component_info *compptr;
  637|       |
  638|      2|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 0, False: 2]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|      0|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 0, False: 0]
  ------------------
  641|      0|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 0, False: 0]
  ------------------
  642|      0|        goto bad;
  643|      0|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|      0|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 0, False: 0]
  |  Branch (645:36): [True: 0, False: 0]
  ------------------
  646|      0|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|      0|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 0, False: 0]
  ------------------
  649|      0|        goto bad;
  650|      0|    }
  651|      0|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 0, False: 0]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|      0|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 0, False: 0]
  ------------------
  654|      0|        goto bad;
  655|      0|    }
  656|      0|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 0, False: 0]
  ------------------
  657|      0|bad:
  658|      0|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      0|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      0|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|      0|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|      0|    }
  661|       |    /* Update progression status, and verify that scan order is legal.
  662|       |     * Note that inter-scan inconsistencies are treated as warnings
  663|       |     * not fatal errors ... not clear if this is right way to behave.
  664|       |     */
  665|      0|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 0, False: 0]
  ------------------
  666|      0|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|      0|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|      0|      int *prev_coef_bit_ptr =
  669|      0|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|      0|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 0, False: 0]
  |  Branch (670:24): [True: 0, False: 0]
  ------------------
  671|      0|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|      0|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|      0|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|      0|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 0, False: 0]
  ------------------
  673|      0|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 0, False: 0]
  ------------------
  674|      0|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|      0|        else
  676|      0|          prev_coef_bit_ptr[coefi] = 0;
  677|      0|      }
  678|      0|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 0, False: 0]
  ------------------
  679|      0|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 0, False: 0]
  ------------------
  680|      0|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 0, False: 0]
  ------------------
  681|      0|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|      0|        coef_bit_ptr[coefi] = cinfo->Al;
  683|      0|      }
  684|      0|    }
  685|       |    /* Select MCU decoding routine */
  686|      0|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 0, False: 0]
  ------------------
  687|      0|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 0, False: 0]
  ------------------
  688|      0|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|      0|      else
  690|      0|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|      0|    } else {
  692|      0|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 0, False: 0]
  ------------------
  693|      0|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|      0|      else
  695|      0|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|      0|    }
  697|      2|  } else {
  698|       |    /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
  699|       |     * This ought to be an error condition, but we make it a warning.
  700|       |     */
  701|      2|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|      1|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 1, False: 1]
  |  Branch (701:27): [True: 1, False: 0]
  ------------------
  702|      0|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 0, False: 0]
  |  Branch (702:27): [True: 0, False: 0]
  ------------------
  703|      2|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|      2|    entropy->pub.decode_mcu = decode_mcu;
  706|      2|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|      2|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 0, False: 2]
  ------------------
  710|      0|    compptr = cinfo->cur_comp_info[ci];
  711|      0|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 0, False: 0]
  |  Branch (711:38): [True: 0, False: 0]
  |  Branch (711:56): [True: 0, False: 0]
  ------------------
  712|      0|      tbl = compptr->dc_tbl_no;
  713|      0|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|      0|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 0]
  |  Branch (713:22): [True: 0, False: 0]
  ------------------
  714|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  715|      0|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 0, False: 0]
  ------------------
  716|      0|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|      0|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|      0|#define DC_STAT_BINS  64
  ------------------
  718|      0|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|      0|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|      0|      entropy->last_dc_val[ci] = 0;
  721|      0|      entropy->dc_context[ci] = 0;
  722|      0|    }
  723|      0|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 0, False: 0]
  |  Branch (723:37): [True: 0, False: 0]
  ------------------
  724|      0|      tbl = compptr->ac_tbl_no;
  725|      0|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|      0|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 0]
  |  Branch (725:22): [True: 0, False: 0]
  ------------------
  726|      0|        ERREXIT1(cinfo, JERR_NO_ARITH_TABLE, tbl);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  727|      0|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 0, False: 0]
  ------------------
  728|      0|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|      0|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|      0|#define AC_STAT_BINS  256
  ------------------
  730|      0|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|      0|#define AC_STAT_BINS  256
  ------------------
  731|      0|    }
  732|      0|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|      2|  entropy->c = 0;
  736|      2|  entropy->a = 0;
  737|      2|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|      2|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|      2|  entropy->restarts_to_go = cinfo->restart_interval;
  742|      2|}

jinit_d_coef_controller:
  869|    280|{
  870|    280|  my_coef_ptr coef;
  871|       |
  872|    280|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    280|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 280]
  ------------------
  873|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  874|       |
  875|    280|  coef = (my_coef_ptr)
  876|    280|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    280|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|    280|                                sizeof(my_coef_controller));
  878|    280|  memset(coef, 0, sizeof(my_coef_controller));
  879|    280|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|    280|  coef->pub.start_input_pass = start_input_pass;
  881|    280|  coef->pub.start_output_pass = start_output_pass;
  882|    280|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|    280|  coef->coef_bits_latch = NULL;
  884|    280|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|    280|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 2, False: 278]
  ------------------
  888|      2|#ifdef D_MULTISCAN_FILES_SUPPORTED
  889|       |    /* Allocate a full-image virtual array for each component, */
  890|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  891|       |    /* Note we ask for a pre-zeroed array. */
  892|      2|    int ci, access_rows;
  893|      2|    jpeg_component_info *compptr;
  894|       |
  895|      4|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 2, False: 2]
  ------------------
  896|      2|         ci++, compptr++) {
  897|      2|      access_rows = compptr->v_samp_factor;
  898|      2|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|      2|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 2, False: 0]
  ------------------
  901|      2|        access_rows *= 5;
  902|      2|#endif
  903|      2|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|      2|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  905|      2|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|      2|                               (long)compptr->h_samp_factor),
  907|      2|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|      2|                               (long)compptr->v_samp_factor),
  909|      2|         (JDIMENSION)access_rows);
  910|      2|    }
  911|      2|    coef->pub.consume_data = consume_data;
  912|      2|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|      2|#define _decompress_data  decompress_data
  ------------------
  913|      2|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    278|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|    278|    JBLOCKROW buffer;
  920|    278|    int i;
  921|       |
  922|    278|    buffer = (JBLOCKROW)
  923|    278|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    278|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|    278|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|    278|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|  3.05k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  3.05k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 2.78k, False: 278]
  ------------------
  926|  2.78k|      coef->MCU_buffer[i] = buffer + i;
  927|  2.78k|    }
  928|    278|    coef->pub.consume_data = dummy_consume_data;
  929|    278|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|    278|#define _decompress_data  decompress_data
  ------------------
  930|    278|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|    278|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|    280|  coef->workspace = (JCOEF *)
  935|    280|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    280|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|    280|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    280|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|    280|}
jdcoefct-8.c:start_input_pass:
   50|    257|{
   51|    257|  cinfo->input_iMCU_row = 0;
   52|    257|  start_iMCU_row(cinfo);
   53|    257|}
jdcoefct-8.c:start_output_pass:
   62|    257|{
   63|    257|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|    257|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   65|       |
   66|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   67|    257|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 0, False: 257]
  ------------------
   68|      0|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 0, False: 0]
  |  Branch (68:38): [True: 0, False: 0]
  ------------------
   69|      0|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|      0|#define _decompress_data  decompress_data
  ------------------
   70|      0|    else
   71|      0|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|      0|#define _decompress_data  decompress_data
  ------------------
   72|      0|  }
   73|    257|#endif
   74|    257|  cinfo->output_iMCU_row = 0;
   75|    257|}
jdcoefct-8.c:decompress_onepass:
   90|  2.34k|{
   91|  2.34k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  2.34k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  2.34k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  2.34k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  2.34k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  2.34k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  2.34k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  2.34k|  JDIMENSION start_col, output_col;
   98|  2.34k|  jpeg_component_info *compptr;
   99|  2.34k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  2.34k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  6.89k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 4.55k, False: 2.34k]
  ------------------
  103|  4.55k|       yoffset++) {
  104|   207k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 203k, False: 4.55k]
  ------------------
  105|   203k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   203k|      jzero_far((void *)coef->MCU_buffer[0],
  108|   203k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   203k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 203k, False: 0]
  ------------------
  110|   203k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   203k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 203k]
  ------------------
  115|       |        /* Suspension forced; update state counters and exit */
  116|      0|        coef->MCU_vert_offset = yoffset;
  117|      0|        coef->MCU_ctr = MCU_col_num;
  118|       |#ifdef WITH_PROFILE
  119|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  120|       |        cinfo->master->entropy_mcoeffs +=
  121|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  122|       |#endif
  123|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  124|      0|      }
  125|       |#ifdef WITH_PROFILE
  126|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  127|       |      cinfo->master->entropy_mcoeffs +=
  128|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  129|       |#endif
  130|       |
  131|       |      /* Only perform the IDCT on blocks that are contained within the desired
  132|       |       * cropping region.
  133|       |       */
  134|   203k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 203k, False: 233]
  ------------------
  135|   203k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 203k, False: 0]
  ------------------
  136|       |        /* Determine where data should go in output_buf and do the IDCT thing.
  137|       |         * We skip dummy blocks at the right and bottom edges (but blkn gets
  138|       |         * incremented past them!).  Note the inner loop relies on having
  139|       |         * allocated the MCU_buffer[] blocks sequentially.
  140|       |         */
  141|   203k|        blkn = 0;               /* index of current DCT block within MCU */
  142|   406k|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 203k, False: 203k]
  ------------------
  143|   203k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   203k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 203k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   203k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   203k|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   203k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 198k, False: 4.32k]
  ------------------
  151|   198k|                         compptr->MCU_width : compptr->last_col_width;
  152|   203k|          output_ptr = output_buf[compptr->component_index] +
  153|   203k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   203k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   203k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   203k|                      compptr->MCU_sample_width;
  156|   406k|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 203k, False: 203k]
  ------------------
  157|   203k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 200k, False: 2.33k]
  ------------------
  158|   203k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 2.33k, False: 0]
  ------------------
  159|   203k|              output_col = start_col;
  160|   406k|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 203k, False: 203k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   203k|                (*inverse_DCT) (cinfo, compptr,
  165|   203k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   203k|                                output_ptr, output_col);
  167|       |#ifdef WITH_PROFILE
  168|       |                cinfo->master->idct_elapsed +=
  169|       |                  getTime() - cinfo->master->start;
  170|       |                cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  171|       |#endif
  172|   203k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   203k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   203k|              }
  174|   203k|            }
  175|   203k|            blkn += compptr->MCU_width;
  176|   203k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   203k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   203k|          }
  178|   203k|        }
  179|   203k|      }
  180|   203k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  4.55k|    coef->MCU_ctr = 0;
  183|  4.55k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  2.34k|  cinfo->output_iMCU_row++;
  186|  2.34k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 2.08k, False: 257]
  ------------------
  187|  2.08k|    start_iMCU_row(cinfo);
  188|  2.08k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.08k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  2.08k|  }
  190|       |  /* Completed the scan */
  191|    257|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|    257|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    257|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  2.34k|}
j12init_d_coef_controller:
  869|      3|{
  870|      3|  my_coef_ptr coef;
  871|       |
  872|      3|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      3|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 3]
  ------------------
  873|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  874|       |
  875|      3|  coef = (my_coef_ptr)
  876|      3|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|      3|                                sizeof(my_coef_controller));
  878|      3|  memset(coef, 0, sizeof(my_coef_controller));
  879|      3|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|      3|  coef->pub.start_input_pass = start_input_pass;
  881|      3|  coef->pub.start_output_pass = start_output_pass;
  882|      3|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|      3|  coef->coef_bits_latch = NULL;
  884|      3|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|      3|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 0, False: 3]
  ------------------
  888|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  889|       |    /* Allocate a full-image virtual array for each component, */
  890|       |    /* padded to a multiple of samp_factor DCT blocks in each direction. */
  891|       |    /* Note we ask for a pre-zeroed array. */
  892|      0|    int ci, access_rows;
  893|      0|    jpeg_component_info *compptr;
  894|       |
  895|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 0, False: 0]
  ------------------
  896|      0|         ci++, compptr++) {
  897|      0|      access_rows = compptr->v_samp_factor;
  898|      0|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|      0|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 0, False: 0]
  ------------------
  901|      0|        access_rows *= 5;
  902|      0|#endif
  903|      0|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  905|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|      0|                               (long)compptr->h_samp_factor),
  907|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|      0|                               (long)compptr->v_samp_factor),
  909|      0|         (JDIMENSION)access_rows);
  910|      0|    }
  911|      0|    coef->pub.consume_data = consume_data;
  912|      0|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|      0|#define _decompress_data  decompress_data_12
  ------------------
  913|      0|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|      3|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|      3|    JBLOCKROW buffer;
  920|      3|    int i;
  921|       |
  922|      3|    buffer = (JBLOCKROW)
  923|      3|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|      3|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|      3|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|     33|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|     33|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 30, False: 3]
  ------------------
  926|     30|      coef->MCU_buffer[i] = buffer + i;
  927|     30|    }
  928|      3|    coef->pub.consume_data = dummy_consume_data;
  929|      3|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|      3|#define _decompress_data  decompress_data_12
  ------------------
  930|      3|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|      3|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|      3|  coef->workspace = (JCOEF *)
  935|      3|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|      3|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|      3|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|      3|}
jdcoefct-12.c:start_input_pass:
   50|      1|{
   51|      1|  cinfo->input_iMCU_row = 0;
   52|      1|  start_iMCU_row(cinfo);
   53|      1|}
jdcoefct-12.c:start_output_pass:
   62|      1|{
   63|      1|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|      1|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   65|       |
   66|       |  /* If multipass, check to see whether to use block smoothing on this pass */
   67|      1|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 0, False: 1]
  ------------------
   68|      0|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 0, False: 0]
  |  Branch (68:38): [True: 0, False: 0]
  ------------------
   69|      0|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|      0|#define _decompress_data  decompress_data_12
  ------------------
   70|      0|    else
   71|      0|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|      0|#define _decompress_data  decompress_data_12
  ------------------
   72|      0|  }
   73|      1|#endif
   74|      1|  cinfo->output_iMCU_row = 0;
   75|      1|}

jdcoefct-8.c:start_iMCU_row:
   68|  2.34k|{
   69|  2.34k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   70|       |
   71|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   72|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   73|       |   * But at the bottom of the image, process only what's left.
   74|       |   */
   75|  2.34k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 0, False: 2.34k]
  ------------------
   76|      0|    coef->MCU_rows_per_iMCU_row = 1;
   77|  2.34k|  } else {
   78|  2.34k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 2.30k, False: 36]
  ------------------
   79|  2.30k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|     36|    else
   81|     36|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  2.34k|  }
   83|       |
   84|  2.34k|  coef->MCU_ctr = 0;
   85|  2.34k|  coef->MCU_vert_offset = 0;
   86|  2.34k|}
jdcoefct-12.c:start_iMCU_row:
   68|      1|{
   69|      1|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   70|       |
   71|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   72|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   73|       |   * But at the bottom of the image, process only what's left.
   74|       |   */
   75|      1|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 0, False: 1]
  ------------------
   76|      0|    coef->MCU_rows_per_iMCU_row = 1;
   77|      1|  } else {
   78|      1|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 1, False: 0]
  ------------------
   79|      1|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|      0|    else
   81|      0|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|      1|  }
   83|       |
   84|      1|  coef->MCU_ctr = 0;
   85|      1|  coef->MCU_vert_offset = 0;
   86|      1|}

jinit_color_deconverter:
  625|    282|{
  626|    282|  my_cconvert_ptr cconvert;
  627|    282|  int ci;
  628|       |
  629|    282|#ifdef D_LOSSLESS_SUPPORTED
  630|    282|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 2, False: 280]
  ------------------
  631|      2|#if BITS_IN_JSAMPLE == 8
  632|      2|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      4|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 2]
  |  Branch (632:52): [True: 0, False: 2]
  ------------------
  633|       |#else
  634|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  635|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  636|       |#endif
  637|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  638|      2|  } else
  639|    280|#endif
  640|    280|  {
  641|    280|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    280|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 280]
  ------------------
  642|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  643|    280|  }
  644|       |
  645|    282|  cconvert = (my_cconvert_ptr)
  646|    282|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    282|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|    282|                                sizeof(my_color_deconverter));
  648|    282|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|    282|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|    282|  switch (cinfo->jpeg_color_space) {
  653|    282|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 282, False: 0]
  ------------------
  654|    282|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 282]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|    282|    break;
  657|       |
  658|      0|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 0, False: 282]
  ------------------
  659|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 282]
  ------------------
  660|      0|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 0]
  ------------------
  661|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  662|      0|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 282]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 282]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 282]
  ------------------
  671|      0|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 0]
  ------------------
  672|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  673|      0|    break;
  674|    282|  }
  675|       |
  676|       |  /* Set out_color_components and conversion method based on requested space.
  677|       |   * Also clear the component_needed flags for any unused components,
  678|       |   * so that earlier pipeline stages can avoid useless computation.
  679|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  680|       |   * mode.
  681|       |   */
  682|       |
  683|    282|  switch (cinfo->out_color_space) {
  684|    282|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 282, False: 0]
  ------------------
  685|    282|#ifdef D_LOSSLESS_SUPPORTED
  686|    282|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 2, False: 280]
  ------------------
  687|      2|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 2]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|    282|#endif
  690|    282|    cinfo->out_color_components = 1;
  691|    282|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 282, False: 0]
  ------------------
  692|    282|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|    282|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|    282|#define _color_convert  color_convert
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|    282|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 282]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|    282|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|    282|    break;
  703|       |
  704|      0|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 0, False: 282]
  ------------------
  705|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 282]
  ------------------
  706|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 282]
  ------------------
  707|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 282]
  ------------------
  708|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 282]
  ------------------
  709|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 282]
  ------------------
  710|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 282]
  ------------------
  711|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 282]
  ------------------
  712|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 282]
  ------------------
  713|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 282]
  ------------------
  714|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 282]
  ------------------
  715|      0|#ifdef D_LOSSLESS_SUPPORTED
  716|      0|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 0, False: 0]
  |  Branch (716:36): [True: 0, False: 0]
  ------------------
  717|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|      0|#endif
  719|      0|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|      0|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 0]
  ------------------
  721|      0|#ifdef WITH_SIMD
  722|      0|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 0, False: 0]
  ------------------
  723|      0|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  724|      0|      else
  725|      0|#endif
  726|      0|      {
  727|      0|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 0]
  ------------------
  729|      0|          cconvert->pub._color_convert = ycc_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  730|      0|          break;
  731|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 0]
  ------------------
  733|      0|          cconvert->pub._color_convert = ycc_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  734|      0|          break;
  735|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (735:9): [True: 0, False: 0]
  ------------------
  736|      0|          cconvert->pub._color_convert = ycc_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  737|      0|          break;
  738|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (738:9): [True: 0, False: 0]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 0]
  ------------------
  740|      0|          cconvert->pub._color_convert = ycc_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  741|      0|          break;
  742|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (742:9): [True: 0, False: 0]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 0]
  ------------------
  744|      0|          cconvert->pub._color_convert = ycc_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  745|      0|          break;
  746|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  749|      0|          break;
  750|      0|        default:
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  752|      0|        }
  753|      0|        build_ycc_rgb_table(cinfo);
  754|      0|      }
  755|      0|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 0]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  781|      0|      }
  782|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 0, False: 0]
  ------------------
  784|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 0, False: 0]
  ------------------
  785|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 0, False: 0]
  ------------------
  786|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 0, False: 0]
  ------------------
  787|      0|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  814|      0|        }
  815|      0|      }
  816|      0|    } else
  817|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|      0|    break;
  819|       |
  820|      0|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 282]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|      0|#ifdef WITH_SIMD
  829|      0|        if (jsimd_set_ycc_rgb565(cinfo))
  ------------------
  |  Branch (829:13): [True: 0, False: 0]
  ------------------
  830|      0|          cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  831|      0|        else
  832|      0|#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 282]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 282]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|      0|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 0, False: 0]
  ------------------
  876|      0|      cinfo->out_color_components = cinfo->num_components;
  877|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  878|      0|    } else                      /* unsupported non-null conversion */
  879|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|      0|    break;
  881|    282|  }
  882|       |
  883|    282|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 282]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|    282|  else
  886|    282|    cinfo->output_components = cinfo->out_color_components;
  887|    282|}
jdcolor-8.c:start_pass_dcolor:
  614|    257|{
  615|       |  /* no work needed */
  616|    257|}
jdcolor-8.c:grayscale_convert:
  397|  33.5k|{
  398|  33.5k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  297|  33.5k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  399|  33.5k|                     cinfo->output_width);
  400|  33.5k|}
j12init_color_deconverter:
  625|      4|{
  626|      4|  my_cconvert_ptr cconvert;
  627|      4|  int ci;
  628|       |
  629|      4|#ifdef D_LOSSLESS_SUPPORTED
  630|      4|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 1, False: 3]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 1]
  ------------------
  635|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 1]
  ------------------
  636|      0|#endif
  637|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  638|      1|  } else
  639|      3|#endif
  640|      3|  {
  641|      3|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      3|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 3]
  ------------------
  642|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  643|      3|  }
  644|       |
  645|      4|  cconvert = (my_cconvert_ptr)
  646|      4|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|      4|                                sizeof(my_color_deconverter));
  648|      4|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|      4|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|      4|  switch (cinfo->jpeg_color_space) {
  653|      4|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 4, False: 0]
  ------------------
  654|      4|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 4]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|      4|    break;
  657|       |
  658|      0|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 0, False: 4]
  ------------------
  659|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 4]
  ------------------
  660|      0|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 0]
  ------------------
  661|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  662|      0|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 4]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 4]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 4]
  ------------------
  671|      0|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 0]
  ------------------
  672|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  673|      0|    break;
  674|      4|  }
  675|       |
  676|       |  /* Set out_color_components and conversion method based on requested space.
  677|       |   * Also clear the component_needed flags for any unused components,
  678|       |   * so that earlier pipeline stages can avoid useless computation.
  679|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  680|       |   * mode.
  681|       |   */
  682|       |
  683|      4|  switch (cinfo->out_color_space) {
  684|      4|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 4, False: 0]
  ------------------
  685|      4|#ifdef D_LOSSLESS_SUPPORTED
  686|      4|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 1, False: 3]
  ------------------
  687|      1|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 1]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      4|#endif
  690|      4|    cinfo->out_color_components = 1;
  691|      4|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 4, False: 0]
  ------------------
  692|      4|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      4|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|      4|#define _color_convert  color_convert_12
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      4|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 4]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      4|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|      4|    break;
  703|       |
  704|      0|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 0, False: 4]
  ------------------
  705|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 4]
  ------------------
  706|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 4]
  ------------------
  707|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 4]
  ------------------
  708|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 4]
  ------------------
  709|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 4]
  ------------------
  710|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 4]
  ------------------
  711|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 4]
  ------------------
  712|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 4]
  ------------------
  713|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 4]
  ------------------
  714|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 4]
  ------------------
  715|      0|#ifdef D_LOSSLESS_SUPPORTED
  716|      0|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 0, False: 0]
  |  Branch (716:36): [True: 0, False: 0]
  ------------------
  717|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|      0|#endif
  719|      0|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|      0|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 0]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|      0|      {
  727|      0|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 0]
  ------------------
  729|      0|          cconvert->pub._color_convert = ycc_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  730|      0|          break;
  731|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 0]
  ------------------
  733|      0|          cconvert->pub._color_convert = ycc_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  734|      0|          break;
  735|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (735:9): [True: 0, False: 0]
  ------------------
  736|      0|          cconvert->pub._color_convert = ycc_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  737|      0|          break;
  738|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (738:9): [True: 0, False: 0]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 0]
  ------------------
  740|      0|          cconvert->pub._color_convert = ycc_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  741|      0|          break;
  742|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (742:9): [True: 0, False: 0]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 0]
  ------------------
  744|      0|          cconvert->pub._color_convert = ycc_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  745|      0|          break;
  746|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  749|      0|          break;
  750|      0|        default:
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  752|      0|        }
  753|      0|        build_ycc_rgb_table(cinfo);
  754|      0|      }
  755|      0|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 0]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  781|      0|      }
  782|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 0, False: 0]
  ------------------
  784|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 0, False: 0]
  ------------------
  785|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 0, False: 0]
  ------------------
  786|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 0, False: 0]
  ------------------
  787|      0|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  814|      0|        }
  815|      0|      }
  816|      0|    } else
  817|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|      0|    break;
  819|       |
  820|      0|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 4]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|       |#ifdef WITH_SIMD
  829|       |        if (jsimd_set_ycc_rgb565(cinfo))
  830|       |          cconvert->pub._color_convert = jsimd_color_deconvert;
  831|       |        else
  832|       |#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 4]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 4]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|      0|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 0, False: 0]
  ------------------
  876|      0|      cinfo->out_color_components = cinfo->num_components;
  877|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  878|      0|    } else                      /* unsupported non-null conversion */
  879|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|      0|    break;
  881|      4|  }
  882|       |
  883|      4|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 4]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|      4|  else
  886|      4|    cinfo->output_components = cinfo->out_color_components;
  887|      4|}
jdcolor-12.c:start_pass_dcolor:
  614|      1|{
  615|       |  /* no work needed */
  616|      1|}
j16init_color_deconverter:
  625|      1|{
  626|      1|  my_cconvert_ptr cconvert;
  627|      1|  int ci;
  628|       |
  629|      1|#ifdef D_LOSSLESS_SUPPORTED
  630|      1|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 1, False: 0]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (634:9): [True: 0, False: 1]
  ------------------
  635|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (635:9): [True: 0, False: 1]
  ------------------
  636|      0|#endif
  637|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  638|      1|  } else
  639|      0|#endif
  640|      0|  {
  641|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (641:9): [True: 0, False: 0]
  ------------------
  642|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  643|      0|  }
  644|       |
  645|      1|  cconvert = (my_cconvert_ptr)
  646|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|      1|                                sizeof(my_color_deconverter));
  648|      1|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|      1|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|      1|  switch (cinfo->jpeg_color_space) {
  653|      1|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 1, False: 0]
  ------------------
  654|      1|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 1]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|      1|    break;
  657|       |
  658|      0|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 0, False: 1]
  ------------------
  659|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 1]
  ------------------
  660|      0|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 0]
  ------------------
  661|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  662|      0|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 1]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 1]
  ------------------
  666|      0|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 0]
  ------------------
  667|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  668|      0|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 1]
  ------------------
  671|      0|    if (cinfo->num_components < 1)
  ------------------
  |  Branch (671:9): [True: 0, False: 0]
  ------------------
  672|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  673|      0|    break;
  674|      1|  }
  675|       |
  676|       |  /* Set out_color_components and conversion method based on requested space.
  677|       |   * Also clear the component_needed flags for any unused components,
  678|       |   * so that earlier pipeline stages can avoid useless computation.
  679|       |   * NOTE: We do not allow any lossy color conversion algorithms in lossless
  680|       |   * mode.
  681|       |   */
  682|       |
  683|      1|  switch (cinfo->out_color_space) {
  684|      1|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 1, False: 0]
  ------------------
  685|      1|#ifdef D_LOSSLESS_SUPPORTED
  686|      1|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 1, False: 0]
  ------------------
  687|      1|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 1]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      1|#endif
  690|      1|    cinfo->out_color_components = 1;
  691|      1|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 1, False: 0]
  ------------------
  692|      1|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      1|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |   59|      1|#define _color_convert  color_convert_16
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      1|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 1]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      1|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|      1|    break;
  703|       |
  704|      0|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 0, False: 1]
  ------------------
  705|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 1]
  ------------------
  706|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 1]
  ------------------
  707|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 1]
  ------------------
  708|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 1]
  ------------------
  709|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 1]
  ------------------
  710|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 1]
  ------------------
  711|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 1]
  ------------------
  712|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 1]
  ------------------
  713|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 1]
  ------------------
  714|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 1]
  ------------------
  715|      0|#ifdef D_LOSSLESS_SUPPORTED
  716|      0|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 0, False: 0]
  |  Branch (716:36): [True: 0, False: 0]
  ------------------
  717|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|      0|#endif
  719|      0|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|      0|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 0]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|      0|      {
  727|      0|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 0]
  ------------------
  729|      0|          cconvert->pub._color_convert = ycc_extrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  730|      0|          break;
  731|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (731:9): [True: 0, False: 0]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 0]
  ------------------
  733|      0|          cconvert->pub._color_convert = ycc_extrgbx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  734|      0|          break;
  735|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (735:9): [True: 0, False: 0]
  ------------------
  736|      0|          cconvert->pub._color_convert = ycc_extbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  737|      0|          break;
  738|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (738:9): [True: 0, False: 0]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 0]
  ------------------
  740|      0|          cconvert->pub._color_convert = ycc_extbgrx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  741|      0|          break;
  742|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (742:9): [True: 0, False: 0]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 0]
  ------------------
  744|      0|          cconvert->pub._color_convert = ycc_extxbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  745|      0|          break;
  746|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (746:9): [True: 0, False: 0]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  749|      0|          break;
  750|      0|        default:
  ------------------
  |  Branch (750:9): [True: 0, False: 0]
  ------------------
  751|      0|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  752|      0|        }
  753|      0|        build_ycc_rgb_table(cinfo);
  754|      0|      }
  755|      0|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 0]
  ------------------
  756|      0|      switch (cinfo->out_color_space) {
  757|      0|      case JCS_EXT_RGB:
  ------------------
  |  Branch (757:7): [True: 0, False: 0]
  ------------------
  758|      0|        cconvert->pub._color_convert = gray_extrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  759|      0|        break;
  760|      0|      case JCS_EXT_RGBX:
  ------------------
  |  Branch (760:7): [True: 0, False: 0]
  ------------------
  761|      0|      case JCS_EXT_RGBA:
  ------------------
  |  Branch (761:7): [True: 0, False: 0]
  ------------------
  762|      0|        cconvert->pub._color_convert = gray_extrgbx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  763|      0|        break;
  764|      0|      case JCS_EXT_BGR:
  ------------------
  |  Branch (764:7): [True: 0, False: 0]
  ------------------
  765|      0|        cconvert->pub._color_convert = gray_extbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  766|      0|        break;
  767|      0|      case JCS_EXT_BGRX:
  ------------------
  |  Branch (767:7): [True: 0, False: 0]
  ------------------
  768|      0|      case JCS_EXT_BGRA:
  ------------------
  |  Branch (768:7): [True: 0, False: 0]
  ------------------
  769|      0|        cconvert->pub._color_convert = gray_extbgrx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  770|      0|        break;
  771|      0|      case JCS_EXT_XBGR:
  ------------------
  |  Branch (771:7): [True: 0, False: 0]
  ------------------
  772|      0|      case JCS_EXT_ABGR:
  ------------------
  |  Branch (772:7): [True: 0, False: 0]
  ------------------
  773|      0|        cconvert->pub._color_convert = gray_extxbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  774|      0|        break;
  775|      0|      case JCS_EXT_XRGB:
  ------------------
  |  Branch (775:7): [True: 0, False: 0]
  ------------------
  776|      0|      case JCS_EXT_ARGB:
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|        cconvert->pub._color_convert = gray_extxrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  778|      0|        break;
  779|      0|      default:
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  ------------------
  780|      0|        cconvert->pub._color_convert = gray_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  781|      0|      }
  782|      0|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 0, False: 0]
  ------------------
  783|      0|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 0, False: 0]
  ------------------
  784|      0|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 0, False: 0]
  ------------------
  785|      0|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 0, False: 0]
  ------------------
  786|      0|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 0, False: 0]
  ------------------
  787|      0|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  788|      0|      else {
  789|      0|        switch (cinfo->out_color_space) {
  790|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (790:9): [True: 0, False: 0]
  ------------------
  791|      0|          cconvert->pub._color_convert = rgb_extrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  792|      0|          break;
  793|      0|        case JCS_EXT_RGBX:
  ------------------
  |  Branch (793:9): [True: 0, False: 0]
  ------------------
  794|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (794:9): [True: 0, False: 0]
  ------------------
  795|      0|          cconvert->pub._color_convert = rgb_extrgbx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  796|      0|          break;
  797|      0|        case JCS_EXT_BGR:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          cconvert->pub._color_convert = rgb_extbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  799|      0|          break;
  800|      0|        case JCS_EXT_BGRX:
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  ------------------
  801|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|          cconvert->pub._color_convert = rgb_extbgrx_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  803|      0|          break;
  804|      0|        case JCS_EXT_XBGR:
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  ------------------
  805|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (805:9): [True: 0, False: 0]
  ------------------
  806|      0|          cconvert->pub._color_convert = rgb_extxbgr_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  807|      0|          break;
  808|      0|        case JCS_EXT_XRGB:
  ------------------
  |  Branch (808:9): [True: 0, False: 0]
  ------------------
  809|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|          cconvert->pub._color_convert = rgb_extxrgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  811|      0|          break;
  812|      0|        default:
  ------------------
  |  Branch (812:9): [True: 0, False: 0]
  ------------------
  813|      0|          cconvert->pub._color_convert = rgb_rgb_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  814|      0|        }
  815|      0|      }
  816|      0|    } else
  817|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|      0|    break;
  819|       |
  820|      0|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 1]
  ------------------
  821|      0|#ifdef D_LOSSLESS_SUPPORTED
  822|      0|    if (cinfo->master->lossless)
  ------------------
  |  Branch (822:9): [True: 0, False: 0]
  ------------------
  823|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  824|      0|#endif
  825|      0|    cinfo->out_color_components = 3;
  826|      0|    if (cinfo->dither_mode == JDITHER_NONE) {
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (827:11): [True: 0, False: 0]
  ------------------
  828|       |#ifdef WITH_SIMD
  829|       |        if (jsimd_set_ycc_rgb565(cinfo))
  830|       |          cconvert->pub._color_convert = jsimd_color_deconvert;
  831|       |        else
  832|       |#endif
  833|      0|        {
  834|      0|          cconvert->pub._color_convert = ycc_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  835|      0|          build_ycc_rgb_table(cinfo);
  836|      0|        }
  837|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (837:18): [True: 0, False: 0]
  ------------------
  838|      0|        cconvert->pub._color_convert = gray_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  839|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (839:18): [True: 0, False: 0]
  ------------------
  840|      0|        cconvert->pub._color_convert = rgb_rgb565_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  841|      0|      } else
  842|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  843|      0|    } else {
  844|       |      /* only ordered dithering is supported */
  845|      0|      if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        cconvert->pub._color_convert = ycc_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  847|      0|        build_ycc_rgb_table(cinfo);
  848|      0|      } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (848:18): [True: 0, False: 0]
  ------------------
  849|      0|        cconvert->pub._color_convert = gray_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  850|      0|      } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (850:18): [True: 0, False: 0]
  ------------------
  851|      0|        cconvert->pub._color_convert = rgb_rgb565D_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  852|      0|      } else
  853|      0|        ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  854|      0|    }
  855|      0|    break;
  856|       |
  857|      0|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 0, False: 1]
  ------------------
  858|      0|#ifdef D_LOSSLESS_SUPPORTED
  859|      0|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 0, False: 0]
  ------------------
  860|      0|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 0, False: 0]
  ------------------
  861|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|      0|#endif
  863|      0|    cinfo->out_color_components = 4;
  864|      0|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  866|      0|      build_ycc_rgb_table(cinfo);
  867|      0|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 0, False: 0]
  ------------------
  868|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  869|      0|    } else
  870|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|      0|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 1]
  ------------------
  874|       |    /* Permit null conversion to same output space */
  875|      0|    if (cinfo->out_color_space == cinfo->jpeg_color_space) {
  ------------------
  |  Branch (875:9): [True: 0, False: 0]
  ------------------
  876|      0|      cinfo->out_color_components = cinfo->num_components;
  877|      0|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  878|      0|    } else                      /* unsupported non-null conversion */
  879|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  880|      0|    break;
  881|      1|  }
  882|       |
  883|      1|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 1]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|      1|  else
  886|      1|    cinfo->output_components = cinfo->out_color_components;
  887|      1|}

jinit_inverse_dct:
  335|    280|{
  336|    280|  my_idct_ptr idct;
  337|    280|  int ci;
  338|    280|  jpeg_component_info *compptr;
  339|       |
  340|    280|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    280|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (340:7): [True: 0, False: 280]
  ------------------
  341|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  342|       |
  343|    280|  idct = (my_idct_ptr)
  344|    280|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    280|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  345|    280|                                sizeof(my_idct_controller));
  346|    280|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  347|    280|  idct->pub.start_pass = start_pass;
  348|       |
  349|    560|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (349:44): [True: 280, False: 280]
  ------------------
  350|    280|       ci++, compptr++) {
  351|       |    /* Allocate and pre-zero a multiplier table for each component */
  352|    280|    compptr->dct_table =
  353|    280|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    280|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|    280|                                  sizeof(multiplier_table));
  355|    280|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  356|       |    /* Mark multiplier table not yet set up for any method */
  357|    280|    idct->cur_method[ci] = -1;
  358|    280|  }
  359|    280|}
jddctmgr-8.c:start_pass:
  102|    257|{
  103|    257|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  104|    257|  int ci, i;
  105|    257|  jpeg_component_info *compptr;
  106|    257|  int method = 0;
  107|    257|  _inverse_DCT_method_ptr method_ptr = NULL;
  ------------------
  |  |  262|    257|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  108|    257|  JQUANT_TBL *qtbl;
  109|       |
  110|    514|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (110:44): [True: 257, False: 257]
  ------------------
  111|    257|       ci++, compptr++) {
  112|       |    /* Select the proper IDCT routine for this component's scaling */
  113|    257|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|    257|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  114|      0|#ifdef IDCT_SCALING_SUPPORTED
  115|      0|    case 1:
  ------------------
  |  Branch (115:5): [True: 0, False: 257]
  ------------------
  116|      0|      method_ptr = _jpeg_idct_1x1;
  ------------------
  |  |  312|      0|#define _jpeg_idct_1x1  jpeg_idct_1x1
  ------------------
  117|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  118|      0|      break;
  119|      0|    case 2:
  ------------------
  |  Branch (119:5): [True: 0, False: 257]
  ------------------
  120|      0|#ifdef WITH_SIMD
  121|      0|      if (jsimd_set_idct_2x2(cinfo))
  ------------------
  |  Branch (121:11): [True: 0, False: 0]
  ------------------
  122|      0|        method_ptr = jsimd_idct_2x2;
  123|      0|      else
  124|      0|#endif
  125|      0|        method_ptr = _jpeg_idct_2x2;
  ------------------
  |  |  311|      0|#define _jpeg_idct_2x2  jpeg_idct_2x2
  ------------------
  126|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  127|      0|      break;
  128|      0|    case 3:
  ------------------
  |  Branch (128:5): [True: 0, False: 257]
  ------------------
  129|      0|      method_ptr = _jpeg_idct_3x3;
  ------------------
  |  |  310|      0|#define _jpeg_idct_3x3  jpeg_idct_3x3
  ------------------
  130|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  131|      0|      break;
  132|      0|    case 4:
  ------------------
  |  Branch (132:5): [True: 0, False: 257]
  ------------------
  133|      0|#ifdef WITH_SIMD
  134|      0|      if (jsimd_set_idct_4x4(cinfo))
  ------------------
  |  Branch (134:11): [True: 0, False: 0]
  ------------------
  135|      0|        method_ptr = jsimd_idct_4x4;
  136|      0|      else
  137|      0|#endif
  138|      0|        method_ptr = _jpeg_idct_4x4;
  ------------------
  |  |  309|      0|#define _jpeg_idct_4x4  jpeg_idct_4x4
  ------------------
  139|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  140|      0|      break;
  141|      0|    case 5:
  ------------------
  |  Branch (141:5): [True: 0, False: 257]
  ------------------
  142|      0|      method_ptr = _jpeg_idct_5x5;
  ------------------
  |  |  308|      0|#define _jpeg_idct_5x5  jpeg_idct_5x5
  ------------------
  143|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  144|      0|      break;
  145|      0|    case 6:
  ------------------
  |  Branch (145:5): [True: 0, False: 257]
  ------------------
  146|      0|      method_ptr = _jpeg_idct_6x6;
  ------------------
  |  |  307|      0|#define _jpeg_idct_6x6  jpeg_idct_6x6
  ------------------
  147|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  148|      0|      break;
  149|      0|    case 7:
  ------------------
  |  Branch (149:5): [True: 0, False: 257]
  ------------------
  150|      0|      method_ptr = _jpeg_idct_7x7;
  ------------------
  |  |  306|      0|#define _jpeg_idct_7x7  jpeg_idct_7x7
  ------------------
  151|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  152|      0|      break;
  153|      0|#endif
  154|    257|    case DCTSIZE:
  ------------------
  |  |   66|    257|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (154:5): [True: 257, False: 0]
  ------------------
  155|    257|      switch (cinfo->dct_method) {
  156|      0|#ifdef DCT_ISLOW_SUPPORTED
  157|    257|      case JDCT_ISLOW:
  ------------------
  |  Branch (157:7): [True: 257, False: 0]
  ------------------
  158|    257|#ifdef WITH_SIMD
  159|    257|        if (jsimd_set_idct_islow(cinfo))
  ------------------
  |  Branch (159:13): [True: 0, False: 257]
  ------------------
  160|      0|          method_ptr = jsimd_idct_islow;
  161|    257|        else
  162|    257|#endif
  163|    257|          method_ptr = _jpeg_idct_islow;
  ------------------
  |  |  303|    257|#define _jpeg_idct_islow  jpeg_idct_islow
  ------------------
  164|    257|        method = JDCT_ISLOW;
  165|    257|        break;
  166|      0|#endif
  167|      0|#ifdef DCT_IFAST_SUPPORTED
  168|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (168:7): [True: 0, False: 257]
  ------------------
  169|      0|#ifdef WITH_SIMD
  170|      0|        if (jsimd_set_idct_ifast(cinfo))
  ------------------
  |  Branch (170:13): [True: 0, False: 0]
  ------------------
  171|      0|          method_ptr = jsimd_idct_ifast;
  172|      0|        else
  173|      0|#endif
  174|      0|          method_ptr = _jpeg_idct_ifast;
  ------------------
  |  |  304|      0|#define _jpeg_idct_ifast  jpeg_idct_ifast
  ------------------
  175|      0|        method = JDCT_IFAST;
  176|      0|        break;
  177|      0|#endif
  178|      0|#ifdef DCT_FLOAT_SUPPORTED
  179|      0|      case JDCT_FLOAT:
  ------------------
  |  Branch (179:7): [True: 0, False: 257]
  ------------------
  180|      0|#ifdef WITH_SIMD
  181|      0|        if (jsimd_set_idct_float(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 0]
  ------------------
  182|      0|          method_ptr = jsimd_idct_float;
  183|      0|        else
  184|      0|#endif
  185|      0|          method_ptr = _jpeg_idct_float;
  ------------------
  |  |  305|      0|#define _jpeg_idct_float  jpeg_idct_float
  ------------------
  186|      0|        method = JDCT_FLOAT;
  187|      0|        break;
  188|      0|#endif
  189|      0|      default:
  ------------------
  |  Branch (189:7): [True: 0, False: 257]
  ------------------
  190|      0|        ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  191|      0|        break;
  192|    257|      }
  193|    257|      break;
  194|    257|#ifdef IDCT_SCALING_SUPPORTED
  195|    257|    case 9:
  ------------------
  |  Branch (195:5): [True: 0, False: 257]
  ------------------
  196|      0|      method_ptr = _jpeg_idct_9x9;
  ------------------
  |  |  313|      0|#define _jpeg_idct_9x9  jpeg_idct_9x9
  ------------------
  197|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  198|      0|      break;
  199|      0|    case 10:
  ------------------
  |  Branch (199:5): [True: 0, False: 257]
  ------------------
  200|      0|      method_ptr = _jpeg_idct_10x10;
  ------------------
  |  |  314|      0|#define _jpeg_idct_10x10  jpeg_idct_10x10
  ------------------
  201|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  202|      0|      break;
  203|      0|    case 11:
  ------------------
  |  Branch (203:5): [True: 0, False: 257]
  ------------------
  204|      0|      method_ptr = _jpeg_idct_11x11;
  ------------------
  |  |  315|      0|#define _jpeg_idct_11x11  jpeg_idct_11x11
  ------------------
  205|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  206|      0|      break;
  207|      0|    case 12:
  ------------------
  |  Branch (207:5): [True: 0, False: 257]
  ------------------
  208|      0|      method_ptr = _jpeg_idct_12x12;
  ------------------
  |  |  316|      0|#define _jpeg_idct_12x12  jpeg_idct_12x12
  ------------------
  209|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  210|      0|      break;
  211|      0|    case 13:
  ------------------
  |  Branch (211:5): [True: 0, False: 257]
  ------------------
  212|      0|      method_ptr = _jpeg_idct_13x13;
  ------------------
  |  |  317|      0|#define _jpeg_idct_13x13  jpeg_idct_13x13
  ------------------
  213|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  214|      0|      break;
  215|      0|    case 14:
  ------------------
  |  Branch (215:5): [True: 0, False: 257]
  ------------------
  216|      0|      method_ptr = _jpeg_idct_14x14;
  ------------------
  |  |  318|      0|#define _jpeg_idct_14x14  jpeg_idct_14x14
  ------------------
  217|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  218|      0|      break;
  219|      0|    case 15:
  ------------------
  |  Branch (219:5): [True: 0, False: 257]
  ------------------
  220|      0|      method_ptr = _jpeg_idct_15x15;
  ------------------
  |  |  319|      0|#define _jpeg_idct_15x15  jpeg_idct_15x15
  ------------------
  221|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  222|      0|      break;
  223|      0|    case 16:
  ------------------
  |  Branch (223:5): [True: 0, False: 257]
  ------------------
  224|      0|      method_ptr = _jpeg_idct_16x16;
  ------------------
  |  |  320|      0|#define _jpeg_idct_16x16  jpeg_idct_16x16
  ------------------
  225|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  226|      0|      break;
  227|      0|#endif
  228|      0|    default:
  ------------------
  |  Branch (228:5): [True: 0, False: 257]
  ------------------
  229|      0|      ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  230|      0|      break;
  231|    257|    }
  232|    257|    idct->pub._inverse_DCT[ci] = method_ptr;
  ------------------
  |  |  263|    257|#define _inverse_DCT  inverse_DCT
  ------------------
  233|       |    /* Create multiplier table from quant table.
  234|       |     * However, we can skip this if the component is uninteresting
  235|       |     * or if we already built the table.  Also, if no quant table
  236|       |     * has yet been saved for the component, we leave the
  237|       |     * multiplier table all-zero; we'll be reading zeroes from the
  238|       |     * coefficient controller's buffer anyway.
  239|       |     */
  240|    257|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (240:9): [True: 0, False: 257]
  |  Branch (240:39): [True: 0, False: 257]
  ------------------
  241|      0|      continue;
  242|    257|    qtbl = compptr->quant_table;
  243|    257|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (243:9): [True: 0, False: 257]
  ------------------
  244|      0|      continue;
  245|    257|    idct->cur_method[ci] = method;
  246|    257|    switch (method) {
  247|      0|#ifdef PROVIDE_ISLOW_TABLES
  248|    257|    case JDCT_ISLOW:
  ------------------
  |  Branch (248:5): [True: 257, False: 0]
  ------------------
  249|    257|      {
  250|       |        /* For LL&M IDCT method, multipliers are equal to raw quantization
  251|       |         * coefficients, but are stored as ints to ensure access efficiency.
  252|       |         */
  253|    257|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  254|  16.7k|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  16.7k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (254:21): [True: 16.4k, False: 257]
  ------------------
  255|  16.4k|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  256|  16.4k|        }
  257|    257|      }
  258|    257|      break;
  259|      0|#endif
  260|      0|#ifdef DCT_IFAST_SUPPORTED
  261|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (261:5): [True: 0, False: 257]
  ------------------
  262|      0|      {
  263|       |        /* For AA&N IDCT method, multipliers are equal to quantization
  264|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  265|       |         *   scalefactor[0] = 1
  266|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  267|       |         * For integer operation, the multiplier table is to be scaled by
  268|       |         * IFAST_SCALE_BITS.
  269|       |         */
  270|      0|        IFAST_MULT_TYPE *ifmtbl = (IFAST_MULT_TYPE *)compptr->dct_table;
  271|      0|#define CONST_BITS  14
  272|      0|        static const INT16 aanscales[DCTSIZE2] = {
  273|       |          /* precomputed values scaled up by 14 bits */
  274|      0|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  275|      0|          22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
  276|      0|          21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
  277|      0|          19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
  278|      0|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  279|      0|          12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
  280|      0|           8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
  281|      0|           4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
  282|      0|        };
  283|      0|        SHIFT_TEMPS
  284|       |
  285|      0|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (285:21): [True: 0, False: 0]
  ------------------
  286|      0|          ifmtbl[i] = (IFAST_MULT_TYPE)
  287|      0|            DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
  ------------------
  |  |  216|      0|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|      0|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  288|      0|                                  (JLONG)aanscales[i]),
  289|      0|                    CONST_BITS - IFAST_SCALE_BITS);
  290|      0|        }
  291|      0|      }
  292|      0|      break;
  293|      0|#endif
  294|      0|#ifdef DCT_FLOAT_SUPPORTED
  295|      0|    case JDCT_FLOAT:
  ------------------
  |  Branch (295:5): [True: 0, False: 257]
  ------------------
  296|      0|      {
  297|       |        /* For float AA&N IDCT method, multipliers are equal to quantization
  298|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  299|       |         *   scalefactor[0] = 1
  300|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  301|       |         */
  302|      0|        FLOAT_MULT_TYPE *fmtbl = (FLOAT_MULT_TYPE *)compptr->dct_table;
  303|      0|        int row, col;
  304|      0|        static const double aanscalefactor[DCTSIZE] = {
  305|      0|          1.0, 1.387039845, 1.306562965, 1.175875602,
  306|      0|          1.0, 0.785694958, 0.541196100, 0.275899379
  307|      0|        };
  308|       |
  309|      0|        i = 0;
  310|      0|        for (row = 0; row < DCTSIZE; row++) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (310:23): [True: 0, False: 0]
  ------------------
  311|      0|          for (col = 0; col < DCTSIZE; col++) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (311:25): [True: 0, False: 0]
  ------------------
  312|      0|            fmtbl[i] = (FLOAT_MULT_TYPE)
  313|      0|              ((double)qtbl->quantval[i] *
  314|      0|               aanscalefactor[row] * aanscalefactor[col]);
  315|      0|            i++;
  316|      0|          }
  317|      0|        }
  318|      0|      }
  319|      0|      break;
  320|      0|#endif
  321|      0|    default:
  ------------------
  |  Branch (321:5): [True: 0, False: 257]
  ------------------
  322|      0|      ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  323|      0|      break;
  324|    257|    }
  325|    257|  }
  326|    257|}
j12init_inverse_dct:
  335|      3|{
  336|      3|  my_idct_ptr idct;
  337|      3|  int ci;
  338|      3|  jpeg_component_info *compptr;
  339|       |
  340|      3|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      3|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (340:7): [True: 0, False: 3]
  ------------------
  341|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  342|       |
  343|      3|  idct = (my_idct_ptr)
  344|      3|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  345|      3|                                sizeof(my_idct_controller));
  346|      3|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  347|      3|  idct->pub.start_pass = start_pass;
  348|       |
  349|      6|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (349:44): [True: 3, False: 3]
  ------------------
  350|      3|       ci++, compptr++) {
  351|       |    /* Allocate and pre-zero a multiplier table for each component */
  352|      3|    compptr->dct_table =
  353|      3|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|      3|                                  sizeof(multiplier_table));
  355|      3|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  356|       |    /* Mark multiplier table not yet set up for any method */
  357|      3|    idct->cur_method[ci] = -1;
  358|      3|  }
  359|      3|}
jddctmgr-12.c:start_pass:
  102|      1|{
  103|      1|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  104|      1|  int ci, i;
  105|      1|  jpeg_component_info *compptr;
  106|      1|  int method = 0;
  107|      1|  _inverse_DCT_method_ptr method_ptr = NULL;
  ------------------
  |  |  146|      1|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  108|      1|  JQUANT_TBL *qtbl;
  109|       |
  110|      2|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (110:44): [True: 1, False: 1]
  ------------------
  111|      1|       ci++, compptr++) {
  112|       |    /* Select the proper IDCT routine for this component's scaling */
  113|      1|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|      1|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  114|      0|#ifdef IDCT_SCALING_SUPPORTED
  115|      0|    case 1:
  ------------------
  |  Branch (115:5): [True: 0, False: 1]
  ------------------
  116|      0|      method_ptr = _jpeg_idct_1x1;
  ------------------
  |  |  196|      0|#define _jpeg_idct_1x1  jpeg12_idct_1x1
  ------------------
  117|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  118|      0|      break;
  119|      0|    case 2:
  ------------------
  |  Branch (119:5): [True: 0, False: 1]
  ------------------
  120|       |#ifdef WITH_SIMD
  121|       |      if (jsimd_set_idct_2x2(cinfo))
  122|       |        method_ptr = jsimd_idct_2x2;
  123|       |      else
  124|       |#endif
  125|      0|        method_ptr = _jpeg_idct_2x2;
  ------------------
  |  |  195|      0|#define _jpeg_idct_2x2  jpeg12_idct_2x2
  ------------------
  126|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  127|      0|      break;
  128|      0|    case 3:
  ------------------
  |  Branch (128:5): [True: 0, False: 1]
  ------------------
  129|      0|      method_ptr = _jpeg_idct_3x3;
  ------------------
  |  |  194|      0|#define _jpeg_idct_3x3  jpeg12_idct_3x3
  ------------------
  130|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  131|      0|      break;
  132|      0|    case 4:
  ------------------
  |  Branch (132:5): [True: 0, False: 1]
  ------------------
  133|       |#ifdef WITH_SIMD
  134|       |      if (jsimd_set_idct_4x4(cinfo))
  135|       |        method_ptr = jsimd_idct_4x4;
  136|       |      else
  137|       |#endif
  138|      0|        method_ptr = _jpeg_idct_4x4;
  ------------------
  |  |  193|      0|#define _jpeg_idct_4x4  jpeg12_idct_4x4
  ------------------
  139|      0|      method = JDCT_ISLOW;      /* jidctred uses islow-style table */
  140|      0|      break;
  141|      0|    case 5:
  ------------------
  |  Branch (141:5): [True: 0, False: 1]
  ------------------
  142|      0|      method_ptr = _jpeg_idct_5x5;
  ------------------
  |  |  192|      0|#define _jpeg_idct_5x5  jpeg12_idct_5x5
  ------------------
  143|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  144|      0|      break;
  145|      0|    case 6:
  ------------------
  |  Branch (145:5): [True: 0, False: 1]
  ------------------
  146|      0|      method_ptr = _jpeg_idct_6x6;
  ------------------
  |  |  191|      0|#define _jpeg_idct_6x6  jpeg12_idct_6x6
  ------------------
  147|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  148|      0|      break;
  149|      0|    case 7:
  ------------------
  |  Branch (149:5): [True: 0, False: 1]
  ------------------
  150|      0|      method_ptr = _jpeg_idct_7x7;
  ------------------
  |  |  190|      0|#define _jpeg_idct_7x7  jpeg12_idct_7x7
  ------------------
  151|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  152|      0|      break;
  153|      0|#endif
  154|      1|    case DCTSIZE:
  ------------------
  |  |   66|      1|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (154:5): [True: 1, False: 0]
  ------------------
  155|      1|      switch (cinfo->dct_method) {
  156|      0|#ifdef DCT_ISLOW_SUPPORTED
  157|      1|      case JDCT_ISLOW:
  ------------------
  |  Branch (157:7): [True: 1, False: 0]
  ------------------
  158|       |#ifdef WITH_SIMD
  159|       |        if (jsimd_set_idct_islow(cinfo))
  160|       |          method_ptr = jsimd_idct_islow;
  161|       |        else
  162|       |#endif
  163|      1|          method_ptr = _jpeg_idct_islow;
  ------------------
  |  |  187|      1|#define _jpeg_idct_islow  jpeg12_idct_islow
  ------------------
  164|      1|        method = JDCT_ISLOW;
  165|      1|        break;
  166|      0|#endif
  167|      0|#ifdef DCT_IFAST_SUPPORTED
  168|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (168:7): [True: 0, False: 1]
  ------------------
  169|       |#ifdef WITH_SIMD
  170|       |        if (jsimd_set_idct_ifast(cinfo))
  171|       |          method_ptr = jsimd_idct_ifast;
  172|       |        else
  173|       |#endif
  174|      0|          method_ptr = _jpeg_idct_ifast;
  ------------------
  |  |  188|      0|#define _jpeg_idct_ifast  jpeg12_idct_ifast
  ------------------
  175|      0|        method = JDCT_IFAST;
  176|      0|        break;
  177|      0|#endif
  178|      0|#ifdef DCT_FLOAT_SUPPORTED
  179|      0|      case JDCT_FLOAT:
  ------------------
  |  Branch (179:7): [True: 0, False: 1]
  ------------------
  180|       |#ifdef WITH_SIMD
  181|       |        if (jsimd_set_idct_float(cinfo))
  182|       |          method_ptr = jsimd_idct_float;
  183|       |        else
  184|       |#endif
  185|      0|          method_ptr = _jpeg_idct_float;
  ------------------
  |  |  189|      0|#define _jpeg_idct_float  jpeg12_idct_float
  ------------------
  186|      0|        method = JDCT_FLOAT;
  187|      0|        break;
  188|      0|#endif
  189|      0|      default:
  ------------------
  |  Branch (189:7): [True: 0, False: 1]
  ------------------
  190|      0|        ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  191|      0|        break;
  192|      1|      }
  193|      1|      break;
  194|      1|#ifdef IDCT_SCALING_SUPPORTED
  195|      1|    case 9:
  ------------------
  |  Branch (195:5): [True: 0, False: 1]
  ------------------
  196|      0|      method_ptr = _jpeg_idct_9x9;
  ------------------
  |  |  197|      0|#define _jpeg_idct_9x9  jpeg12_idct_9x9
  ------------------
  197|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  198|      0|      break;
  199|      0|    case 10:
  ------------------
  |  Branch (199:5): [True: 0, False: 1]
  ------------------
  200|      0|      method_ptr = _jpeg_idct_10x10;
  ------------------
  |  |  198|      0|#define _jpeg_idct_10x10  jpeg12_idct_10x10
  ------------------
  201|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  202|      0|      break;
  203|      0|    case 11:
  ------------------
  |  Branch (203:5): [True: 0, False: 1]
  ------------------
  204|      0|      method_ptr = _jpeg_idct_11x11;
  ------------------
  |  |  199|      0|#define _jpeg_idct_11x11  jpeg12_idct_11x11
  ------------------
  205|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  206|      0|      break;
  207|      0|    case 12:
  ------------------
  |  Branch (207:5): [True: 0, False: 1]
  ------------------
  208|      0|      method_ptr = _jpeg_idct_12x12;
  ------------------
  |  |  200|      0|#define _jpeg_idct_12x12  jpeg12_idct_12x12
  ------------------
  209|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  210|      0|      break;
  211|      0|    case 13:
  ------------------
  |  Branch (211:5): [True: 0, False: 1]
  ------------------
  212|      0|      method_ptr = _jpeg_idct_13x13;
  ------------------
  |  |  201|      0|#define _jpeg_idct_13x13  jpeg12_idct_13x13
  ------------------
  213|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  214|      0|      break;
  215|      0|    case 14:
  ------------------
  |  Branch (215:5): [True: 0, False: 1]
  ------------------
  216|      0|      method_ptr = _jpeg_idct_14x14;
  ------------------
  |  |  202|      0|#define _jpeg_idct_14x14  jpeg12_idct_14x14
  ------------------
  217|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  218|      0|      break;
  219|      0|    case 15:
  ------------------
  |  Branch (219:5): [True: 0, False: 1]
  ------------------
  220|      0|      method_ptr = _jpeg_idct_15x15;
  ------------------
  |  |  203|      0|#define _jpeg_idct_15x15  jpeg12_idct_15x15
  ------------------
  221|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  222|      0|      break;
  223|      0|    case 16:
  ------------------
  |  Branch (223:5): [True: 0, False: 1]
  ------------------
  224|      0|      method_ptr = _jpeg_idct_16x16;
  ------------------
  |  |  204|      0|#define _jpeg_idct_16x16  jpeg12_idct_16x16
  ------------------
  225|      0|      method = JDCT_ISLOW;      /* jidctint uses islow-style table */
  226|      0|      break;
  227|      0|#endif
  228|      0|    default:
  ------------------
  |  Branch (228:5): [True: 0, False: 1]
  ------------------
  229|      0|      ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  230|      0|      break;
  231|      1|    }
  232|      1|    idct->pub._inverse_DCT[ci] = method_ptr;
  ------------------
  |  |  147|      1|#define _inverse_DCT  inverse_DCT_12
  ------------------
  233|       |    /* Create multiplier table from quant table.
  234|       |     * However, we can skip this if the component is uninteresting
  235|       |     * or if we already built the table.  Also, if no quant table
  236|       |     * has yet been saved for the component, we leave the
  237|       |     * multiplier table all-zero; we'll be reading zeroes from the
  238|       |     * coefficient controller's buffer anyway.
  239|       |     */
  240|      1|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (240:9): [True: 0, False: 1]
  |  Branch (240:39): [True: 0, False: 1]
  ------------------
  241|      0|      continue;
  242|      1|    qtbl = compptr->quant_table;
  243|      1|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (243:9): [True: 0, False: 1]
  ------------------
  244|      0|      continue;
  245|      1|    idct->cur_method[ci] = method;
  246|      1|    switch (method) {
  247|      0|#ifdef PROVIDE_ISLOW_TABLES
  248|      1|    case JDCT_ISLOW:
  ------------------
  |  Branch (248:5): [True: 1, False: 0]
  ------------------
  249|      1|      {
  250|       |        /* For LL&M IDCT method, multipliers are equal to raw quantization
  251|       |         * coefficients, but are stored as ints to ensure access efficiency.
  252|       |         */
  253|      1|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  254|     65|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|     65|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (254:21): [True: 64, False: 1]
  ------------------
  255|     64|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  256|     64|        }
  257|      1|      }
  258|      1|      break;
  259|      0|#endif
  260|      0|#ifdef DCT_IFAST_SUPPORTED
  261|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (261:5): [True: 0, False: 1]
  ------------------
  262|      0|      {
  263|       |        /* For AA&N IDCT method, multipliers are equal to quantization
  264|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  265|       |         *   scalefactor[0] = 1
  266|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  267|       |         * For integer operation, the multiplier table is to be scaled by
  268|       |         * IFAST_SCALE_BITS.
  269|       |         */
  270|      0|        IFAST_MULT_TYPE *ifmtbl = (IFAST_MULT_TYPE *)compptr->dct_table;
  271|      0|#define CONST_BITS  14
  272|      0|        static const INT16 aanscales[DCTSIZE2] = {
  273|       |          /* precomputed values scaled up by 14 bits */
  274|      0|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  275|      0|          22725, 31521, 29692, 26722, 22725, 17855, 12299,  6270,
  276|      0|          21407, 29692, 27969, 25172, 21407, 16819, 11585,  5906,
  277|      0|          19266, 26722, 25172, 22654, 19266, 15137, 10426,  5315,
  278|      0|          16384, 22725, 21407, 19266, 16384, 12873,  8867,  4520,
  279|      0|          12873, 17855, 16819, 15137, 12873, 10114,  6967,  3552,
  280|      0|           8867, 12299, 11585, 10426,  8867,  6967,  4799,  2446,
  281|      0|           4520,  6270,  5906,  5315,  4520,  3552,  2446,  1247
  282|      0|        };
  283|      0|        SHIFT_TEMPS
  284|       |
  285|      0|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (285:21): [True: 0, False: 0]
  ------------------
  286|      0|          ifmtbl[i] = (IFAST_MULT_TYPE)
  287|      0|            DESCALE(MULTIPLY16V16((JLONG)qtbl->quantval[i],
  ------------------
  |  |  216|      0|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|      0|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  288|      0|                                  (JLONG)aanscales[i]),
  289|      0|                    CONST_BITS - IFAST_SCALE_BITS);
  290|      0|        }
  291|      0|      }
  292|      0|      break;
  293|      0|#endif
  294|      0|#ifdef DCT_FLOAT_SUPPORTED
  295|      0|    case JDCT_FLOAT:
  ------------------
  |  Branch (295:5): [True: 0, False: 1]
  ------------------
  296|      0|      {
  297|       |        /* For float AA&N IDCT method, multipliers are equal to quantization
  298|       |         * coefficients scaled by scalefactor[row]*scalefactor[col], where
  299|       |         *   scalefactor[0] = 1
  300|       |         *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
  301|       |         */
  302|      0|        FLOAT_MULT_TYPE *fmtbl = (FLOAT_MULT_TYPE *)compptr->dct_table;
  303|      0|        int row, col;
  304|      0|        static const double aanscalefactor[DCTSIZE] = {
  305|      0|          1.0, 1.387039845, 1.306562965, 1.175875602,
  306|      0|          1.0, 0.785694958, 0.541196100, 0.275899379
  307|      0|        };
  308|       |
  309|      0|        i = 0;
  310|      0|        for (row = 0; row < DCTSIZE; row++) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (310:23): [True: 0, False: 0]
  ------------------
  311|      0|          for (col = 0; col < DCTSIZE; col++) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (311:25): [True: 0, False: 0]
  ------------------
  312|      0|            fmtbl[i] = (FLOAT_MULT_TYPE)
  313|      0|              ((double)qtbl->quantval[i] *
  314|      0|               aanscalefactor[row] * aanscalefactor[col]);
  315|      0|            i++;
  316|      0|          }
  317|      0|        }
  318|      0|      }
  319|      0|      break;
  320|      0|#endif
  321|      0|    default:
  ------------------
  |  Branch (321:5): [True: 0, False: 1]
  ------------------
  322|      0|      ERREXIT(cinfo, JERR_NOT_COMPILED);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  323|      0|      break;
  324|      1|    }
  325|      1|  }
  326|      1|}

jinit_d_diff_controller:
  348|      1|{
  349|      1|  my_diff_ptr diff;
  350|      1|  int ci;
  351|      1|  jpeg_component_info *compptr;
  352|       |
  353|      1|#if BITS_IN_JSAMPLE == 8
  354|      1|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 1]
  |  Branch (354:50): [True: 0, False: 1]
  ------------------
  355|       |#else
  356|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  357|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  358|       |#endif
  359|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  360|       |
  361|      1|  diff = (my_diff_ptr)
  362|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|      1|                                sizeof(my_diff_controller));
  364|      1|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|      1|  diff->pub.start_input_pass = start_input_pass;
  366|      1|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|      2|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1, False: 1]
  ------------------
  370|      1|       ci++, compptr++) {
  371|      1|    diff->diff_buf[ci] =
  372|      1|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      1|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      1|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      1|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|      1|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|      1|                                         (long)compptr->h_samp_factor),
  375|      1|                   (JDIMENSION)compptr->v_samp_factor);
  376|      1|    diff->undiff_buf[ci] =
  377|      1|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      1|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      1|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      1|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|      1|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|      1|                                         (long)compptr->h_samp_factor),
  380|      1|                   (JDIMENSION)compptr->v_samp_factor);
  381|      1|  }
  382|       |
  383|      1|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 1]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  258|      0|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      1|  } else {
  405|      1|    diff->pub.consume_data = dummy_consume_data;
  406|      1|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|      1|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      1|  }
  409|      1|}
j12init_d_diff_controller:
  348|      1|{
  349|      1|  my_diff_ptr diff;
  350|      1|  int ci;
  351|      1|  jpeg_component_info *compptr;
  352|       |
  353|       |#if BITS_IN_JSAMPLE == 8
  354|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  355|       |#else
  356|      1|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 1]
  ------------------
  357|      1|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 1]
  ------------------
  358|      0|#endif
  359|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  360|       |
  361|      1|  diff = (my_diff_ptr)
  362|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|      1|                                sizeof(my_diff_controller));
  364|      1|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|      1|  diff->pub.start_input_pass = start_input_pass;
  366|      1|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|      2|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1, False: 1]
  ------------------
  370|      1|       ci++, compptr++) {
  371|      1|    diff->diff_buf[ci] =
  372|      1|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      1|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      1|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      1|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|      1|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|      1|                                         (long)compptr->h_samp_factor),
  375|      1|                   (JDIMENSION)compptr->v_samp_factor);
  376|      1|    diff->undiff_buf[ci] =
  377|      1|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      1|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      1|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      1|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|      1|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|      1|                                         (long)compptr->h_samp_factor),
  380|      1|                   (JDIMENSION)compptr->v_samp_factor);
  381|      1|  }
  382|       |
  383|      1|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 1]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  142|      0|#define _decompress_data  decompress_data_12
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      1|  } else {
  405|      1|    diff->pub.consume_data = dummy_consume_data;
  406|      1|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|      1|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      1|  }
  409|      1|}
j16init_d_diff_controller:
  348|      1|{
  349|      1|  my_diff_ptr diff;
  350|      1|  int ci;
  351|      1|  jpeg_component_info *compptr;
  352|       |
  353|       |#if BITS_IN_JSAMPLE == 8
  354|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  355|       |#else
  356|      1|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (356:7): [True: 0, False: 1]
  ------------------
  357|      1|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (357:7): [True: 0, False: 1]
  ------------------
  358|      0|#endif
  359|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  360|       |
  361|      1|  diff = (my_diff_ptr)
  362|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|      1|                                sizeof(my_diff_controller));
  364|      1|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|      1|  diff->pub.start_input_pass = start_input_pass;
  366|      1|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|      2|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1, False: 1]
  ------------------
  370|      1|       ci++, compptr++) {
  371|      1|    diff->diff_buf[ci] =
  372|      1|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      1|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      1|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      1|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|      1|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|      1|                                         (long)compptr->h_samp_factor),
  375|      1|                   (JDIMENSION)compptr->v_samp_factor);
  376|      1|    diff->undiff_buf[ci] =
  377|      1|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|      1|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|      1|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|      1|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|      1|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|      1|                                         (long)compptr->h_samp_factor),
  380|      1|                   (JDIMENSION)compptr->v_samp_factor);
  381|      1|  }
  382|       |
  383|      1|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 0, False: 1]
  ------------------
  384|      0|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      0|    int access_rows;
  387|       |
  388|      0|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 0, False: 0]
  ------------------
  389|      0|         ci++, compptr++) {
  390|      0|      access_rows = compptr->v_samp_factor;
  391|      0|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  393|      0|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|      0|                               (long)compptr->h_samp_factor),
  395|      0|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|      0|                               (long)compptr->v_samp_factor),
  397|      0|         (JDIMENSION)access_rows);
  398|      0|    }
  399|      0|    diff->pub.consume_data = consume_data;
  400|      0|    diff->pub._decompress_data = output_data;
  ------------------
  |  |   53|      0|#define _decompress_data  decompress_data_16
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      1|  } else {
  405|      1|    diff->pub.consume_data = dummy_consume_data;
  406|      1|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |   53|      1|#define _decompress_data  decompress_data_16
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      1|  }
  409|      1|}

jpeg_make_d_derived_tbl:
  145|    532|{
  146|    532|  JHUFF_TBL *htbl;
  147|    532|  d_derived_tbl *dtbl;
  148|    532|  int p, i, l, si, numsymbols;
  149|    532|  int lookbits, ctr;
  150|    532|  char huffsize[257];
  151|    532|  unsigned int huffcode[257];
  152|    532|  unsigned int code;
  153|       |
  154|       |  /* Note that huffsize[] and huffcode[] are filled in code-length order,
  155|       |   * paralleling the order of the symbols themselves in htbl->huffval[].
  156|       |   */
  157|       |
  158|       |  /* Find the input Huffman table */
  159|    532|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|    532|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 532]
  |  Branch (159:20): [True: 1, False: 531]
  ------------------
  160|      1|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|    532|  htbl =
  162|    532|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 272, False: 260]
  ------------------
  163|    532|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 1, False: 531]
  ------------------
  164|      1|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|    532|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 530, False: 2]
  ------------------
  168|    530|    *pdtbl = (d_derived_tbl *)
  169|    530|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    530|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|    530|                                  sizeof(d_derived_tbl));
  171|    532|  dtbl = *pdtbl;
  172|    532|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|    532|  p = 0;
  177|  9.01k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 8.48k, False: 532]
  ------------------
  178|  8.48k|    i = (int)htbl->bits[l];
  179|  8.48k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 8.48k]
  |  Branch (179:18): [True: 0, False: 8.48k]
  ------------------
  180|      0|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  181|  41.8k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 33.3k, False: 8.48k]
  ------------------
  182|  33.3k|      huffsize[p++] = (char)l;
  183|  8.48k|  }
  184|    532|  huffsize[p] = 0;
  185|    532|  numsymbols = p;
  186|       |
  187|       |  /* Figure C.2: generate the codes themselves */
  188|       |  /* We also validate that the counts represent a legal Huffman code tree. */
  189|       |
  190|    532|  code = 0;
  191|    532|  si = huffsize[0];
  192|    532|  p = 0;
  193|  6.58k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 6.05k, False: 532]
  ------------------
  194|  39.2k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 33.2k, False: 6.05k]
  ------------------
  195|  33.2k|      huffcode[p++] = code;
  196|  33.2k|      code++;
  197|  33.2k|    }
  198|       |    /* code is now 1 more than the last code used for codelength si; but
  199|       |     * it must still fit in si bits, since no code is allowed to be all ones.
  200|       |     */
  201|  6.05k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 5, False: 6.05k]
  ------------------
  202|      5|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  6.05k|    code <<= 1;
  204|  6.05k|    si++;
  205|  6.05k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|    532|  p = 0;
  210|  8.93k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 8.40k, False: 532]
  ------------------
  211|  8.40k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 6.01k, False: 2.38k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|  6.01k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|  6.01k|      p += htbl->bits[l];
  217|  6.01k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  6.01k|    } else {
  219|  2.38k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  2.38k|    }
  221|  8.40k|  }
  222|    532|  dtbl->valoffset[17] = 0;
  223|    532|  dtbl->maxcode[17] = 0xFFFFFL; /* ensures jpeg_huff_decode terminates */
  224|       |
  225|       |  /* Compute lookahead tables to speed up decoding.
  226|       |   * First we set all the table entries to 0, indicating "too long";
  227|       |   * then we iterate through the Huffman codes that are short enough and
  228|       |   * fill in all the entries that correspond to bit sequences starting
  229|       |   * with that code.
  230|       |   */
  231|       |
  232|   134k|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|   134k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 134k, False: 532]
  ------------------
  233|   134k|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   134k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   134k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|    532|  p = 0;
  236|  4.73k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  4.73k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 4.20k, False: 532]
  ------------------
  237|  11.5k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 7.33k, False: 4.20k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  7.33k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  7.33k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|   139k|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  7.33k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 132k, False: 7.33k]
  ------------------
  242|   132k|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|   132k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|   132k|        lookbits++;
  244|   132k|      }
  245|  7.33k|    }
  246|  4.20k|  }
  247|       |
  248|       |  /* Validate symbols as being reasonable.
  249|       |   * For AC tables, we make no check, but accept all byte values 0..255.
  250|       |   * For DC tables, we require the symbols to be in range 0..15 in lossy mode
  251|       |   * and 0..16 in lossless mode.  (Tighter bounds could be applied depending on
  252|       |   * the data depth and mode, but this is sufficient to ensure safe decoding.)
  253|       |   */
  254|    532|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 267, False: 265]
  ------------------
  255|  3.41k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 3.14k, False: 267]
  ------------------
  256|  3.14k|      int sym = htbl->huffval[i];
  257|  3.14k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 3.14k]
  |  Branch (257:22): [True: 7, False: 3.13k]
  |  Branch (257:29): [True: 0, False: 3.14k]
  ------------------
  258|      7|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  3.14k|    }
  260|    267|  }
  261|    532|}
jpeg_fill_bit_buffer:
  291|  8.63k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|  8.63k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|  8.63k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|  8.63k|  j_decompress_ptr cinfo = state->cinfo;
  296|       |
  297|       |  /* Attempt to load at least MIN_GET_BITS bits into get_buffer. */
  298|       |  /* (It is assumed that no request will be for more than that many bits.) */
  299|       |  /* We fail to do so only if we hit a marker or are forced to suspend. */
  300|       |
  301|  8.63k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 8.35k, False: 288]
  ------------------
  302|  66.6k|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  66.6k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  66.6k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 58.4k, False: 8.23k]
  ------------------
  303|  58.4k|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  58.4k|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 68, False: 58.3k]
  ------------------
  307|     68|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 68]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|     68|        next_input_byte = cinfo->src->next_input_byte;
  310|     68|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|     68|      }
  312|  58.4k|      bytes_in_buffer--;
  313|  58.4k|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  58.4k|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 1.50k, False: 56.8k]
  ------------------
  317|       |        /* Loop here to discard any padding FF's on terminating marker,
  318|       |         * so that we can save a valid unread_marker value.  NOTE: we will
  319|       |         * accept multiple FF's followed by a 0 as meaning a single FF data
  320|       |         * byte.  This data pattern is not valid according to the standard.
  321|       |         */
  322|  5.82k|        do {
  323|  5.82k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 1, False: 5.82k]
  ------------------
  324|      1|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 1]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|      1|            next_input_byte = cinfo->src->next_input_byte;
  327|      1|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|      1|          }
  329|  5.82k|          bytes_in_buffer--;
  330|  5.82k|          c = *next_input_byte++;
  331|  5.82k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 4.32k, False: 1.50k]
  ------------------
  332|       |
  333|  1.50k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 1.39k, False: 115]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  1.39k|          c = 0xFF;
  336|  1.39k|        } else {
  337|       |          /* Oops, it's actually a marker indicating end of compressed data.
  338|       |           * Save the marker code for later use.
  339|       |           * Fine point: it might appear that we should save the marker into
  340|       |           * bitread working state, not straight into permanent state.  But
  341|       |           * once we have hit a marker, we cannot need to suspend within the
  342|       |           * current MCU, because we will read no more bytes from the data
  343|       |           * source.  So it is OK to update permanent state right away.
  344|       |           */
  345|    115|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|    115|          goto no_more_bytes;
  348|    115|        }
  349|  1.50k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  58.2k|      get_buffer = (get_buffer << 8) | c;
  353|  58.2k|      bits_left += 8;
  354|  58.2k|    } /* end while */
  355|  8.35k|  } else {
  356|    402|no_more_bytes:
  357|       |    /* We get here if we've read the marker that terminates the compressed
  358|       |     * data segment.  There should be enough bits in the buffer register
  359|       |     * to satisfy the request; if so, no problem.
  360|       |     */
  361|    402|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 113, False: 289]
  ------------------
  362|       |      /* Uh-oh.  Report corrupted data to user and stuff zeroes into
  363|       |       * the data stream, so that we can produce some kind of image.
  364|       |       * We use a nonvolatile flag to ensure that only one warning message
  365|       |       * appears per data segment.
  366|       |       */
  367|    113|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 113, False: 0]
  ------------------
  368|    113|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|    113|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    113|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|    113|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|    113|#define TRUE    1
  ------------------
  370|    113|      }
  371|       |      /* Fill the buffer with zero bits */
  372|    113|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|    113|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    113|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|    113|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|    113|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    113|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|    113|    }
  375|    402|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|  8.63k|  state->next_input_byte = next_input_byte;
  379|  8.63k|  state->bytes_in_buffer = bytes_in_buffer;
  380|  8.63k|  state->get_buffer = get_buffer;
  381|  8.63k|  state->bits_left = bits_left;
  382|       |
  383|  8.63k|  return TRUE;
  ------------------
  |  |  210|  8.63k|#define TRUE    1
  ------------------
  384|  8.63k|}
jpeg_huff_decode:
  439|  4.46k|{
  440|  4.46k|  register int l = min_bits;
  441|  4.46k|  register JLONG code;
  442|       |
  443|       |  /* HUFF_DECODE has determined that the code is at least min_bits */
  444|       |  /* bits long, so fetch that many bits in one swoop. */
  445|       |
  446|  4.46k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  4.46k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  4.46k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 115, False: 4.34k]
  |  |  ------------------
  |  |  162|    115|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 115]
  |  |  ------------------
  |  |  163|    115|      { action; } \
  |  |  164|    115|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    115|  } \
  |  |  166|  4.46k|}
  ------------------
  447|  4.46k|  code = GET_BITS(l);
  ------------------
  |  |  169|  4.46k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  448|       |
  449|       |  /* Collect the rest of the Huffman code one bit at a time. */
  450|       |  /* This is per Figure F.16. */
  451|       |
  452|  14.1k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 9.72k, False: 4.46k]
  ------------------
  453|  9.72k|    code <<= 1;
  454|  9.72k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  9.72k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  9.72k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 203, False: 9.52k]
  |  |  ------------------
  |  |  162|    203|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 203]
  |  |  ------------------
  |  |  163|    203|      { action; } \
  |  |  164|    203|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    203|  } \
  |  |  166|  9.72k|}
  ------------------
  455|  9.72k|    code |= GET_BITS(1);
  ------------------
  |  |  169|  9.72k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  9.72k|    l++;
  457|  9.72k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  4.46k|  state->get_buffer = get_buffer;
  461|  4.46k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  4.46k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 51, False: 4.41k]
  ------------------
  466|     51|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|     51|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     51|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|     51|    return 0;                   /* fake a zero as the safest result */
  468|     51|  }
  469|       |
  470|  4.41k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  4.46k|}
jinit_huff_decoder:
  815|    279|{
  816|    279|  huff_entropy_ptr entropy;
  817|    279|  int i;
  818|       |
  819|       |  /* Motion JPEG frames typically do not include the Huffman tables if they
  820|       |     are the default tables.  Thus, if the tables are not set by the time
  821|       |     the Huffman decoder is initialized (usually within the body of
  822|       |     jpeg_start_decompress()), we set them to default values. */
  823|    279|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|    279|  entropy = (huff_entropy_ptr)
  826|    279|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    279|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|    279|                                sizeof(huff_entropy_decoder));
  828|    279|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|    279|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|    279|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  1.39k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  1.39k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 1.11k, False: 279]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  1.11k|  }
  836|    279|}
jdhuff.c:start_pass_huff_decoder:
   80|    276|{
   81|    276|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|    276|  int ci, blkn, dctbl, actbl;
   83|    276|  d_derived_tbl **pdtbl;
   84|    276|  jpeg_component_info *compptr;
   85|       |
   86|       |  /* Check that the scan parameters Ss, Se, Ah/Al are OK for sequential JPEG.
   87|       |   * This ought to be an error condition, but we make it a warning because
   88|       |   * there are some baseline files out there with all zeroes in these bytes.
   89|       |   */
   90|    276|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    275|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 1, False: 275]
  |  Branch (90:25): [True: 1, False: 274]
  ------------------
   91|    274|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 1, False: 273]
  |  Branch (91:25): [True: 1, False: 272]
  ------------------
   92|      4|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|    548|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 272, False: 276]
  ------------------
   95|    272|    compptr = cinfo->cur_comp_info[ci];
   96|    272|    dctbl = compptr->dc_tbl_no;
   97|    272|    actbl = compptr->ac_tbl_no;
   98|       |    /* Compute derived values for Huffman tables */
   99|       |    /* We may do this more than once for a table, but it's not expensive */
  100|    272|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|    272|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|    272|#define TRUE    1
  ------------------
  102|    272|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|    272|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|    272|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|    272|    entropy->saved.last_dc_val[ci] = 0;
  106|    272|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|    534|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 258, False: 276]
  ------------------
  110|    258|    ci = cinfo->MCU_membership[blkn];
  111|    258|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|    258|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|    258|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|    258|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 258, False: 0]
  ------------------
  117|    258|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|    258|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|    258|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|    258|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|    258|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|    258|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|    276|  entropy->bitstate.bits_left = 0;
  127|    276|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|    276|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    276|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|    276|  entropy->restarts_to_go = cinfo->restart_interval;
  132|    276|}
jdhuff.c:decode_mcu:
  771|   203k|{
  772|   203k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   203k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   203k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 0, False: 203k]
  ------------------
  777|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 0, False: 0]
  ------------------
  778|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 0]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|      0|    usefast = 0;
  781|      0|  }
  782|       |
  783|   203k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   203k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   203k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 10.1k, False: 193k]
  ------------------
  784|   193k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 78, False: 193k]
  ------------------
  785|  10.1k|    usefast = 0;
  786|       |
  787|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  788|       |   * This way, we return uniform gray for the remainder of the segment.
  789|       |   */
  790|   203k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 203k, False: 0]
  ------------------
  791|       |
  792|   203k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 193k, False: 10.1k]
  ------------------
  793|   193k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 412, False: 192k]
  ------------------
  794|   193k|    } else {
  795|  10.5k|use_slow:
  796|  10.5k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 10.5k]
  ------------------
  797|  10.5k|    }
  798|       |
  799|   203k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   203k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 0, False: 203k]
  ------------------
  803|      0|    entropy->restarts_to_go--;
  804|       |
  805|   203k|  return TRUE;
  ------------------
  |  |  210|   203k|#define TRUE    1
  ------------------
  806|   203k|}
jdhuff.c:decode_mcu_fast:
  664|   193k|{
  665|   193k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   193k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   193k|  register bit_buf_type get_buffer; \
  |  |  126|   193k|  register int bits_left; \
  |  |  127|   193k|  bitread_working_state br_state
  ------------------
  667|   193k|  JOCTET *buffer;
  668|   193k|  int blkn;
  669|   193k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   193k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   193k|  br_state.cinfo = cinfop; \
  |  |  131|   193k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   193k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   193k|  get_buffer = permstate.get_buffer; \
  |  |  134|   193k|  bits_left = permstate.bits_left;
  ------------------
  674|   193k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   193k|  state = entropy->saved;
  676|       |
  677|   386k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 193k, False: 193k]
  ------------------
  678|   193k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 193k, False: 0]
  ------------------
  679|   193k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   193k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   193k|    register int s, k, r, l;
  682|       |
  683|   193k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   193k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   193k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 8.08k, False: 185k]
  |  |  |  |  ------------------
  |  |  |  |  416|  8.08k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  8.08k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  8.08k|  register int c0, c1; \
  |  |  |  |  |  |  393|  8.08k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  8.08k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  8.08k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  8.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  8.08k|  bits_left += 8; \
  |  |  |  |  |  |  398|  8.08k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 147, False: 7.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    147|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    147|    buffer++; \
  |  |  |  |  |  |  401|    147|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 32, False: 115]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     32|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     32|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     32|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     32|      buffer -= 2; \
  |  |  |  |  |  |  406|     32|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     32|    } \
  |  |  |  |  |  |  408|    147|  } \
  |  |  |  |  |  |  409|  8.08k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  8.08k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  8.08k|  register int c0, c1; \
  |  |  |  |  |  |  393|  8.08k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  8.08k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  8.08k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  8.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  8.08k|  bits_left += 8; \
  |  |  |  |  |  |  398|  8.08k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 133, False: 7.95k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    133|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    133|    buffer++; \
  |  |  |  |  |  |  401|    133|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 46, False: 87]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     46|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     46|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     46|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     46|      buffer -= 2; \
  |  |  |  |  |  |  406|     46|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     46|    } \
  |  |  |  |  |  |  408|    133|  } \
  |  |  |  |  |  |  409|  8.08k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  8.08k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  8.08k|  register int c0, c1; \
  |  |  |  |  |  |  393|  8.08k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  8.08k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  8.08k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  8.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  8.08k|  bits_left += 8; \
  |  |  |  |  |  |  398|  8.08k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 134, False: 7.95k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    134|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    134|    buffer++; \
  |  |  |  |  |  |  401|    134|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 63, False: 71]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     63|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     63|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     63|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     63|      buffer -= 2; \
  |  |  |  |  |  |  406|     63|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     63|    } \
  |  |  |  |  |  |  408|    134|  } \
  |  |  |  |  |  |  409|  8.08k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  8.08k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  8.08k|  register int c0, c1; \
  |  |  |  |  |  |  393|  8.08k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  8.08k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  8.08k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  8.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  8.08k|  bits_left += 8; \
  |  |  |  |  |  |  398|  8.08k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 164, False: 7.92k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    164|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    164|    buffer++; \
  |  |  |  |  |  |  401|    164|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 71, False: 93]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     71|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     71|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     71|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     71|      buffer -= 2; \
  |  |  |  |  |  |  406|     71|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     71|    } \
  |  |  |  |  |  |  408|    164|  } \
  |  |  |  |  |  |  409|  8.08k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  8.08k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  8.08k|  register int c0, c1; \
  |  |  |  |  |  |  393|  8.08k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  8.08k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  8.08k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  8.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  8.08k|  bits_left += 8; \
  |  |  |  |  |  |  398|  8.08k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 177, False: 7.91k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    177|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    177|    buffer++; \
  |  |  |  |  |  |  401|    177|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 73, False: 104]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     73|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     73|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     73|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     73|      buffer -= 2; \
  |  |  |  |  |  |  406|     73|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     73|    } \
  |  |  |  |  |  |  408|    177|  } \
  |  |  |  |  |  |  409|  8.08k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  8.08k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  8.08k|  register int c0, c1; \
  |  |  |  |  |  |  393|  8.08k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  8.08k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  8.08k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  8.08k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  8.08k|  bits_left += 8; \
  |  |  |  |  |  |  398|  8.08k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 170, False: 7.91k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    170|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    170|    buffer++; \
  |  |  |  |  |  |  401|    170|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 82, False: 88]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|     82|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|     82|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|     82|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|     82|      buffer -= 2; \
  |  |  |  |  |  |  406|     82|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|     82|    } \
  |  |  |  |  |  |  408|    170|  } \
  |  |  |  |  |  |  409|  8.08k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  8.08k|  }
  |  |  ------------------
  |  |  225|   193k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   193k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   193k|  s = htbl->lookup[s]; \
  |  |  227|   193k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   193k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   193k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   193k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   193k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   193k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   193k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   193k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   386k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 1.14k, False: 192k]
  |  |  ------------------
  |  |  232|  1.14k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  1.14k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  1.14k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  6.70k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 5.55k, False: 1.14k]
  |  |  ------------------
  |  |  236|  5.55k|      s <<= 1; \
  |  |  237|  5.55k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  5.55k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  5.55k|      nb++; \
  |  |  239|  5.55k|    } \
  |  |  240|  1.14k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 691, False: 455]
  |  |  ------------------
  |  |  241|  1.14k|      s = 0; \
  |  |  242|  1.14k|    else \
  |  |  243|  1.14k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  1.14k|  }
  ------------------
  684|   193k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 162k, False: 30.2k]
  ------------------
  685|   162k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   162k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 13.6k, False: 149k]
  |  |  ------------------
  |  |  416|  13.6k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.6k|#define GET_BYTE { \
  |  |  |  |  392|  13.6k|  register int c0, c1; \
  |  |  |  |  393|  13.6k|  c0 = *buffer++; \
  |  |  |  |  394|  13.6k|  c1 = *buffer; \
  |  |  |  |  395|  13.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.6k|  bits_left += 8; \
  |  |  |  |  398|  13.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 62, False: 13.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|     62|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     62|    buffer++; \
  |  |  |  |  401|     62|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 8, False: 54]
  |  |  |  |  ------------------
  |  |  |  |  402|      8|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      8|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      8|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      8|      buffer -= 2; \
  |  |  |  |  406|      8|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      8|    } \
  |  |  |  |  408|     62|  } \
  |  |  |  |  409|  13.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.6k|#define GET_BYTE { \
  |  |  |  |  392|  13.6k|  register int c0, c1; \
  |  |  |  |  393|  13.6k|  c0 = *buffer++; \
  |  |  |  |  394|  13.6k|  c1 = *buffer; \
  |  |  |  |  395|  13.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.6k|  bits_left += 8; \
  |  |  |  |  398|  13.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 117, False: 13.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|    117|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    117|    buffer++; \
  |  |  |  |  401|    117|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 17, False: 100]
  |  |  |  |  ------------------
  |  |  |  |  402|     17|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     17|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     17|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     17|      buffer -= 2; \
  |  |  |  |  406|     17|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     17|    } \
  |  |  |  |  408|    117|  } \
  |  |  |  |  409|  13.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.6k|#define GET_BYTE { \
  |  |  |  |  392|  13.6k|  register int c0, c1; \
  |  |  |  |  393|  13.6k|  c0 = *buffer++; \
  |  |  |  |  394|  13.6k|  c1 = *buffer; \
  |  |  |  |  395|  13.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.6k|  bits_left += 8; \
  |  |  |  |  398|  13.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 75, False: 13.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|     75|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     75|    buffer++; \
  |  |  |  |  401|     75|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 17, False: 58]
  |  |  |  |  ------------------
  |  |  |  |  402|     17|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     17|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     17|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     17|      buffer -= 2; \
  |  |  |  |  406|     17|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     17|    } \
  |  |  |  |  408|     75|  } \
  |  |  |  |  409|  13.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.6k|#define GET_BYTE { \
  |  |  |  |  392|  13.6k|  register int c0, c1; \
  |  |  |  |  393|  13.6k|  c0 = *buffer++; \
  |  |  |  |  394|  13.6k|  c1 = *buffer; \
  |  |  |  |  395|  13.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.6k|  bits_left += 8; \
  |  |  |  |  398|  13.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 98, False: 13.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|     98|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     98|    buffer++; \
  |  |  |  |  401|     98|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 21, False: 77]
  |  |  |  |  ------------------
  |  |  |  |  402|     21|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     21|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     21|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     21|      buffer -= 2; \
  |  |  |  |  406|     21|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     21|    } \
  |  |  |  |  408|     98|  } \
  |  |  |  |  409|  13.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.6k|#define GET_BYTE { \
  |  |  |  |  392|  13.6k|  register int c0, c1; \
  |  |  |  |  393|  13.6k|  c0 = *buffer++; \
  |  |  |  |  394|  13.6k|  c1 = *buffer; \
  |  |  |  |  395|  13.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.6k|  bits_left += 8; \
  |  |  |  |  398|  13.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 84, False: 13.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|     84|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|     84|    buffer++; \
  |  |  |  |  401|     84|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 24, False: 60]
  |  |  |  |  ------------------
  |  |  |  |  402|     24|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     24|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     24|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     24|      buffer -= 2; \
  |  |  |  |  406|     24|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     24|    } \
  |  |  |  |  408|     84|  } \
  |  |  |  |  409|  13.6k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.6k|#define GET_BYTE { \
  |  |  |  |  392|  13.6k|  register int c0, c1; \
  |  |  |  |  393|  13.6k|  c0 = *buffer++; \
  |  |  |  |  394|  13.6k|  c1 = *buffer; \
  |  |  |  |  395|  13.6k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.6k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.6k|  bits_left += 8; \
  |  |  |  |  398|  13.6k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 105, False: 13.5k]
  |  |  |  |  ------------------
  |  |  |  |  399|    105|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    105|    buffer++; \
  |  |  |  |  401|    105|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 26, False: 79]
  |  |  |  |  ------------------
  |  |  |  |  402|     26|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|     26|      cinfo->unread_marker = c1; \
  |  |  |  |  404|     26|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|     26|      buffer -= 2; \
  |  |  |  |  406|     26|      get_buffer &= ~0xFF; \
  |  |  |  |  407|     26|    } \
  |  |  |  |  408|    105|  } \
  |  |  |  |  409|  13.6k|}
  |  |  ------------------
  |  |  417|  13.6k|  }
  ------------------
  686|   162k|      r = GET_BITS(s);
  ------------------
  |  |  169|   162k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|   162k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   162k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   162k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|   162k|    }
  689|       |
  690|   193k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 193k, False: 0]
  ------------------
  691|   193k|      int ci = cinfo->MCU_membership[blkn];
  692|       |      /* Refer to the comment in decode_mcu_slow() regarding the supression of
  693|       |       * a UBSan integer overflow error in this line of code.
  694|       |       */
  695|   193k|      s += state.last_dc_val[ci];
  696|   193k|      state.last_dc_val[ci] = s;
  697|   193k|      if (block)
  ------------------
  |  Branch (697:11): [True: 193k, False: 0]
  ------------------
  698|   193k|        (*block)[0] = (JCOEF)s;
  699|   193k|    }
  700|       |
  701|   193k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 193k, False: 0]
  |  Branch (701:37): [True: 193k, False: 0]
  ------------------
  702|       |
  703|  2.58M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  2.58M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 2.52M, False: 61.6k]
  ------------------
  704|  2.52M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  2.52M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  2.52M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 92.8k, False: 2.42M]
  |  |  |  |  ------------------
  |  |  |  |  416|  92.8k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  92.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  92.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  92.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  92.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  92.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  92.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  92.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  92.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 702, False: 92.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    702|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    702|    buffer++; \
  |  |  |  |  |  |  401|    702|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 219, False: 483]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    219|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    219|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    219|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    219|      buffer -= 2; \
  |  |  |  |  |  |  406|    219|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    219|    } \
  |  |  |  |  |  |  408|    702|  } \
  |  |  |  |  |  |  409|  92.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  92.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  92.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  92.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  92.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  92.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  92.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  92.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  92.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 522, False: 92.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    522|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    522|    buffer++; \
  |  |  |  |  |  |  401|    522|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 235, False: 287]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    235|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    235|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    235|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    235|      buffer -= 2; \
  |  |  |  |  |  |  406|    235|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    235|    } \
  |  |  |  |  |  |  408|    522|  } \
  |  |  |  |  |  |  409|  92.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  92.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  92.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  92.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  92.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  92.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  92.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  92.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  92.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 734, False: 92.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    734|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    734|    buffer++; \
  |  |  |  |  |  |  401|    734|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 251, False: 483]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    251|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    251|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    251|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    251|      buffer -= 2; \
  |  |  |  |  |  |  406|    251|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    251|    } \
  |  |  |  |  |  |  408|    734|  } \
  |  |  |  |  |  |  409|  92.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  92.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  92.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  92.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  92.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  92.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  92.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  92.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  92.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 636, False: 92.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    636|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    636|    buffer++; \
  |  |  |  |  |  |  401|    636|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 260, False: 376]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    260|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    260|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    260|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    260|      buffer -= 2; \
  |  |  |  |  |  |  406|    260|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    260|    } \
  |  |  |  |  |  |  408|    636|  } \
  |  |  |  |  |  |  409|  92.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  92.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  92.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  92.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  92.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  92.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  92.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  92.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  92.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 650, False: 92.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    650|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    650|    buffer++; \
  |  |  |  |  |  |  401|    650|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 270, False: 380]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    270|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    270|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    270|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    270|      buffer -= 2; \
  |  |  |  |  |  |  406|    270|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    270|    } \
  |  |  |  |  |  |  408|    650|  } \
  |  |  |  |  |  |  409|  92.8k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  92.8k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  92.8k|  register int c0, c1; \
  |  |  |  |  |  |  393|  92.8k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  92.8k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  92.8k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  92.8k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  92.8k|  bits_left += 8; \
  |  |  |  |  |  |  398|  92.8k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 776, False: 92.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    776|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    776|    buffer++; \
  |  |  |  |  |  |  401|    776|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 281, False: 495]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    281|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    281|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    281|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    281|      buffer -= 2; \
  |  |  |  |  |  |  406|    281|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    281|    } \
  |  |  |  |  |  |  408|    776|  } \
  |  |  |  |  |  |  409|  92.8k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  92.8k|  }
  |  |  ------------------
  |  |  225|  2.52M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.52M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  2.52M|  s = htbl->lookup[s]; \
  |  |  227|  2.52M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  2.52M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  2.52M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  2.52M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  2.52M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  2.52M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  2.52M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  2.52M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  5.04M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 43.4k, False: 2.47M]
  |  |  ------------------
  |  |  232|  43.4k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  43.4k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  43.4k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   111k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 67.8k, False: 43.4k]
  |  |  ------------------
  |  |  236|  67.8k|      s <<= 1; \
  |  |  237|  67.8k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  67.8k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  67.8k|      nb++; \
  |  |  239|  67.8k|    } \
  |  |  240|  43.4k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 42, False: 43.4k]
  |  |  ------------------
  |  |  241|  43.4k|      s = 0; \
  |  |  242|  43.4k|    else \
  |  |  243|  43.4k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  43.4k|  }
  ------------------
  705|  2.52M|        r = s >> 4;
  706|  2.52M|        s &= 15;
  707|       |
  708|  2.52M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 2.28M, False: 240k]
  ------------------
  709|  2.28M|          k += r;
  710|  2.28M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  2.28M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 127k, False: 2.15M]
  |  |  ------------------
  |  |  416|   127k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   127k|#define GET_BYTE { \
  |  |  |  |  392|   127k|  register int c0, c1; \
  |  |  |  |  393|   127k|  c0 = *buffer++; \
  |  |  |  |  394|   127k|  c1 = *buffer; \
  |  |  |  |  395|   127k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   127k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   127k|  bits_left += 8; \
  |  |  |  |  398|   127k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.12k, False: 126k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.12k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.12k|    buffer++; \
  |  |  |  |  401|  1.12k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 437, False: 687]
  |  |  |  |  ------------------
  |  |  |  |  402|    437|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    437|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    437|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    437|      buffer -= 2; \
  |  |  |  |  406|    437|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    437|    } \
  |  |  |  |  408|  1.12k|  } \
  |  |  |  |  409|   127k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   127k|#define GET_BYTE { \
  |  |  |  |  392|   127k|  register int c0, c1; \
  |  |  |  |  393|   127k|  c0 = *buffer++; \
  |  |  |  |  394|   127k|  c1 = *buffer; \
  |  |  |  |  395|   127k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   127k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   127k|  bits_left += 8; \
  |  |  |  |  398|   127k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 978, False: 126k]
  |  |  |  |  ------------------
  |  |  |  |  399|    978|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    978|    buffer++; \
  |  |  |  |  401|    978|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 470, False: 508]
  |  |  |  |  ------------------
  |  |  |  |  402|    470|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    470|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    470|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    470|      buffer -= 2; \
  |  |  |  |  406|    470|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    470|    } \
  |  |  |  |  408|    978|  } \
  |  |  |  |  409|   127k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   127k|#define GET_BYTE { \
  |  |  |  |  392|   127k|  register int c0, c1; \
  |  |  |  |  393|   127k|  c0 = *buffer++; \
  |  |  |  |  394|   127k|  c1 = *buffer; \
  |  |  |  |  395|   127k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   127k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   127k|  bits_left += 8; \
  |  |  |  |  398|   127k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.20k, False: 126k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.20k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.20k|    buffer++; \
  |  |  |  |  401|  1.20k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 518, False: 689]
  |  |  |  |  ------------------
  |  |  |  |  402|    518|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    518|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    518|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    518|      buffer -= 2; \
  |  |  |  |  406|    518|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    518|    } \
  |  |  |  |  408|  1.20k|  } \
  |  |  |  |  409|   127k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   127k|#define GET_BYTE { \
  |  |  |  |  392|   127k|  register int c0, c1; \
  |  |  |  |  393|   127k|  c0 = *buffer++; \
  |  |  |  |  394|   127k|  c1 = *buffer; \
  |  |  |  |  395|   127k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   127k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   127k|  bits_left += 8; \
  |  |  |  |  398|   127k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.01k, False: 126k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.01k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.01k|    buffer++; \
  |  |  |  |  401|  1.01k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 556, False: 460]
  |  |  |  |  ------------------
  |  |  |  |  402|    556|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    556|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    556|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    556|      buffer -= 2; \
  |  |  |  |  406|    556|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    556|    } \
  |  |  |  |  408|  1.01k|  } \
  |  |  |  |  409|   127k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   127k|#define GET_BYTE { \
  |  |  |  |  392|   127k|  register int c0, c1; \
  |  |  |  |  393|   127k|  c0 = *buffer++; \
  |  |  |  |  394|   127k|  c1 = *buffer; \
  |  |  |  |  395|   127k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   127k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   127k|  bits_left += 8; \
  |  |  |  |  398|   127k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.15k, False: 126k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.15k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.15k|    buffer++; \
  |  |  |  |  401|  1.15k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 583, False: 574]
  |  |  |  |  ------------------
  |  |  |  |  402|    583|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    583|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    583|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    583|      buffer -= 2; \
  |  |  |  |  406|    583|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    583|    } \
  |  |  |  |  408|  1.15k|  } \
  |  |  |  |  409|   127k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   127k|#define GET_BYTE { \
  |  |  |  |  392|   127k|  register int c0, c1; \
  |  |  |  |  393|   127k|  c0 = *buffer++; \
  |  |  |  |  394|   127k|  c1 = *buffer; \
  |  |  |  |  395|   127k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   127k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   127k|  bits_left += 8; \
  |  |  |  |  398|   127k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.49k, False: 125k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.49k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.49k|    buffer++; \
  |  |  |  |  401|  1.49k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 619, False: 877]
  |  |  |  |  ------------------
  |  |  |  |  402|    619|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    619|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    619|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    619|      buffer -= 2; \
  |  |  |  |  406|    619|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    619|    } \
  |  |  |  |  408|  1.49k|  } \
  |  |  |  |  409|   127k|}
  |  |  ------------------
  |  |  417|   127k|  }
  ------------------
  711|  2.28M|          r = GET_BITS(s);
  ------------------
  |  |  169|  2.28M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  2.28M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  2.28M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  2.28M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  2.28M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  2.28M|        } else {
  715|   240k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 131k, False: 108k]
  ------------------
  716|   108k|          k += 15;
  717|   108k|        }
  718|  2.52M|      }
  719|       |
  720|   193k|    } else {
  721|       |
  722|      0|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (722:19): [True: 0, False: 0]
  ------------------
  723|      0|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|      0|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|      0|    } \
  |  |  |  |  |  |  408|      0|  } \
  |  |  |  |  |  |  409|      0|}
  |  |  |  |  ------------------
  |  |  |  |  417|      0|  }
  |  |  ------------------
  |  |  225|      0|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|      0|  s = htbl->lookup[s]; \
  |  |  227|      0|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|      0|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|      0|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|      0|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|      0|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  232|      0|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|      0|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|      0|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|      0|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  236|      0|      s <<= 1; \
  |  |  237|      0|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|      0|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|      0|      nb++; \
  |  |  239|      0|    } \
  |  |  240|      0|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  241|      0|      s = 0; \
  |  |  242|      0|    else \
  |  |  243|      0|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|      0|  }
  ------------------
  724|      0|        r = s >> 4;
  725|      0|        s &= 15;
  726|       |
  727|      0|        if (s) {
  ------------------
  |  Branch (727:13): [True: 0, False: 0]
  ------------------
  728|      0|          k += r;
  729|      0|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|      0|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  416|      0|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|      0|#define GET_BYTE { \
  |  |  |  |  392|      0|  register int c0, c1; \
  |  |  |  |  393|      0|  c0 = *buffer++; \
  |  |  |  |  394|      0|  c1 = *buffer; \
  |  |  |  |  395|      0|  /* Pre-execute most common case */ \
  |  |  |  |  396|      0|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|      0|  bits_left += 8; \
  |  |  |  |  398|      0|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  399|      0|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|      0|    buffer++; \
  |  |  |  |  401|      0|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  402|      0|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|      0|      cinfo->unread_marker = c1; \
  |  |  |  |  404|      0|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|      0|      buffer -= 2; \
  |  |  |  |  406|      0|      get_buffer &= ~0xFF; \
  |  |  |  |  407|      0|    } \
  |  |  |  |  408|      0|  } \
  |  |  |  |  409|      0|}
  |  |  ------------------
  |  |  417|      0|  }
  ------------------
  730|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  731|      0|        } else {
  732|      0|          if (r != 15) break;
  ------------------
  |  Branch (732:15): [True: 0, False: 0]
  ------------------
  733|      0|          k += 15;
  734|      0|        }
  735|      0|      }
  736|      0|    }
  737|   193k|  }
  738|       |
  739|   193k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 412, False: 192k]
  ------------------
  740|    412|    cinfo->unread_marker = 0;
  741|    412|    return FALSE;
  ------------------
  |  |  207|    412|#define FALSE   0               /* values of boolean */
  ------------------
  742|    412|  }
  743|       |
  744|   192k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   192k|  br_state.next_input_byte = buffer;
  746|   192k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   192k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   192k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   192k|  permstate.get_buffer = get_buffer; \
  |  |  140|   192k|  permstate.bits_left = bits_left
  ------------------
  747|   192k|  entropy->saved = state;
  748|   192k|  return TRUE;
  ------------------
  |  |  210|   192k|#define TRUE    1
  ------------------
  749|   193k|}
jdhuff.c:decode_mcu_slow:
  553|  10.5k|{
  554|  10.5k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  10.5k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  10.5k|  register bit_buf_type get_buffer; \
  |  |  126|  10.5k|  register int bits_left; \
  |  |  127|  10.5k|  bitread_working_state br_state
  ------------------
  556|  10.5k|  int blkn;
  557|  10.5k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  10.5k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  10.5k|  br_state.cinfo = cinfop; \
  |  |  131|  10.5k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  10.5k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  10.5k|  get_buffer = permstate.get_buffer; \
  |  |  134|  10.5k|  bits_left = permstate.bits_left;
  ------------------
  562|  10.5k|  state = entropy->saved;
  563|       |
  564|  21.1k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 10.5k, False: 10.5k]
  ------------------
  565|  10.5k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 10.5k, False: 0]
  ------------------
  566|  10.5k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  10.5k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  10.5k|    register int s, k, r;
  569|       |
  570|       |    /* Decode a single block's worth of coefficients */
  571|       |
  572|       |    /* Section F.2.2.1: decode the DC coefficient difference */
  573|  10.5k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  10.5k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  10.5k|  register int nb, look; \
  |  |  202|  10.5k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  10.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 580, False: 10.0k]
  |  |  ------------------
  |  |  203|    580|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 580]
  |  |  ------------------
  |  |  204|    580|      { failaction; } \
  |  |  205|    580|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|    580|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|    580|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 36, False: 544]
  |  |  ------------------
  |  |  207|     36|      nb = 1;  goto slowlabel; \
  |  |  208|     36|    } \
  |  |  209|    580|  } \
  |  |  210|  10.5k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  10.5k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  10.5k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  10.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  10.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 10.4k, False: 87]
  |  |  ------------------
  |  |  212|  10.4k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  10.4k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  10.4k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  10.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  10.4k|  } else { \
  |  |  215|    122|slowlabel: \
  |  |  216|    122|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 122]
  |  |  ------------------
  |  |  217|    122|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    122|      { failaction; } \
  |  |  219|    122|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    122|  } \
  |  |  221|  10.5k|}
  ------------------
  574|  10.5k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 8.15k, False: 2.43k]
  ------------------
  575|  8.15k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  8.15k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  8.15k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 71, False: 8.08k]
  |  |  ------------------
  |  |  162|     71|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 71]
  |  |  ------------------
  |  |  163|     71|      { action; } \
  |  |  164|     71|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|     71|  } \
  |  |  166|  8.15k|}
  ------------------
  576|  8.15k|      r = GET_BITS(s);
  ------------------
  |  |  169|  8.15k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  8.15k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  8.15k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  8.15k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  8.15k|    }
  579|       |
  580|  10.5k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 10.5k, False: 84]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  10.5k|      int ci = cinfo->MCU_membership[blkn];
  583|       |      /* Certain malformed JPEG images produce repeated DC coefficient
  584|       |       * differences of 2047 or -2047, which causes state.last_dc_val[ci] to
  585|       |       * grow until it overflows or underflows a 32-bit signed integer.  This
  586|       |       * behavior is, to the best of our understanding, innocuous, and it is
  587|       |       * unclear how to work around it without potentially affecting
  588|       |       * performance.  Thus, we (hopefully temporarily) suppress UBSan integer
  589|       |       * overflow errors for this function and decode_mcu_fast().
  590|       |       */
  591|  10.5k|      s += state.last_dc_val[ci];
  592|  10.5k|      state.last_dc_val[ci] = s;
  593|  10.5k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 10.5k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  10.5k|        (*block)[0] = (JCOEF)s;
  596|  10.5k|      }
  597|  10.5k|    }
  598|       |
  599|  10.5k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 10.5k, False: 84]
  |  Branch (599:37): [True: 10.5k, False: 0]
  ------------------
  600|       |
  601|       |      /* Section F.2.2.2: decode the AC coefficients */
  602|       |      /* Since zeroes are skipped, output area must be cleared beforehand */
  603|  83.4k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  83.4k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 80.4k, False: 2.97k]
  ------------------
  604|  80.4k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|  80.4k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  80.4k|  register int nb, look; \
  |  |  202|  80.4k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  80.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 6.85k, False: 73.6k]
  |  |  ------------------
  |  |  203|  6.85k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 6.85k]
  |  |  ------------------
  |  |  204|  6.85k|      { failaction; } \
  |  |  205|  6.85k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  6.85k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  6.85k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 161, False: 6.69k]
  |  |  ------------------
  |  |  207|    161|      nb = 1;  goto slowlabel; \
  |  |  208|    161|    } \
  |  |  209|  6.85k|  } \
  |  |  210|  80.4k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  80.3k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  80.3k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  80.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  80.3k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 76.0k, False: 4.24k]
  |  |  ------------------
  |  |  212|  76.0k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  76.0k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  76.0k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  76.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  76.0k|  } else { \
  |  |  215|  4.34k|slowlabel: \
  |  |  216|  4.34k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 4.34k]
  |  |  ------------------
  |  |  217|  4.34k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  4.34k|      { failaction; } \
  |  |  219|  4.34k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  4.34k|  } \
  |  |  221|  80.3k|}
  ------------------
  605|       |
  606|  80.4k|        r = s >> 4;
  607|  80.4k|        s &= 15;
  608|       |
  609|  80.4k|        if (s) {
  ------------------
  |  Branch (609:13): [True: 65.1k, False: 15.2k]
  ------------------
  610|  65.1k|          k += r;
  611|  65.1k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  65.1k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  65.1k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 818, False: 64.3k]
  |  |  ------------------
  |  |  162|    818|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 818]
  |  |  ------------------
  |  |  163|    818|      { action; } \
  |  |  164|    818|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    818|  } \
  |  |  166|  65.1k|}
  ------------------
  612|  65.1k|          r = GET_BITS(s);
  ------------------
  |  |  169|  65.1k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|  65.1k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  65.1k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  65.1k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  614|       |          /* Output coefficient in natural (dezigzagged) order.
  615|       |           * Note: the extra entries in jpeg_natural_order[] will save us
  616|       |           * if k >= DCTSIZE2, which could happen if the data is corrupted.
  617|       |           */
  618|  65.1k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|  65.1k|        } else {
  620|  15.2k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 7.47k, False: 7.78k]
  ------------------
  621|  7.47k|            break;
  622|  7.78k|          k += 15;
  623|  7.78k|        }
  624|  80.4k|      }
  625|       |
  626|  10.5k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|     84|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|     84|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 84]
  ------------------
  631|      0|        HUFF_DECODE(s, br_state, actbl, return FALSE, label3);
  ------------------
  |  |  200|      0|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|      0|  register int nb, look; \
  |  |  202|      0|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  203|      0|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  204|      0|      { failaction; } \
  |  |  205|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|      0|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  207|      0|      nb = 1;  goto slowlabel; \
  |  |  208|      0|    } \
  |  |  209|      0|  } \
  |  |  210|      0|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|      0|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|      0|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  212|      0|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|      0|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|      0|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|      0|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|      0|  } else { \
  |  |  215|      0|slowlabel: \
  |  |  216|      0|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  217|      0|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|      0|      { failaction; } \
  |  |  219|      0|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|      0|  } \
  |  |  221|      0|}
  ------------------
  632|       |
  633|      0|        r = s >> 4;
  634|      0|        s &= 15;
  635|       |
  636|      0|        if (s) {
  ------------------
  |  Branch (636:13): [True: 0, False: 0]
  ------------------
  637|      0|          k += r;
  638|      0|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|      0|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|      0|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  162|      0|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  163|      0|      { action; } \
  |  |  164|      0|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|      0|  } \
  |  |  166|      0|}
  ------------------
  639|      0|          DROP_BITS(s);
  ------------------
  |  |  175|      0|  (bits_left -= (nbits))
  ------------------
  640|      0|        } else {
  641|      0|          if (r != 15)
  ------------------
  |  Branch (641:15): [True: 0, False: 0]
  ------------------
  642|      0|            break;
  643|      0|          k += 15;
  644|      0|        }
  645|      0|      }
  646|     84|    }
  647|  10.5k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  10.5k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  10.5k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  10.5k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  10.5k|  permstate.get_buffer = get_buffer; \
  |  |  140|  10.5k|  permstate.bits_left = bits_left
  ------------------
  651|  10.5k|  entropy->saved = state;
  652|  10.5k|  return TRUE;
  ------------------
  |  |  210|  10.5k|#define TRUE    1
  ------------------
  653|  10.5k|}

jinit_input_controller:
  405|    504|{
  406|    504|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|    504|  inputctl = (my_inputctl_ptr)
  410|    504|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    504|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|    504|                                sizeof(my_input_controller));
  412|    504|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|    504|  inputctl->pub.consume_input = consume_markers;
  415|    504|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|    504|  inputctl->pub.start_input_pass = start_input_pass;
  417|    504|  inputctl->pub.finish_input_pass = finish_input_pass;
  418|       |  /* Initialize state: can't use reset_input_controller since we don't
  419|       |   * want to try to reset other modules yet.
  420|       |   */
  421|    504|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|    504|#define FALSE   0               /* values of boolean */
  ------------------
  422|    504|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|    504|#define FALSE   0               /* values of boolean */
  ------------------
  423|    504|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|    504|#define TRUE    1
  ------------------
  424|    504|}
jdinput.c:consume_markers:
  332|    528|{
  333|    528|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|    528|  int val;
  335|       |
  336|    528|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 528]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|    528|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|    528|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 298, False: 230]
  ------------------
  342|    295|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|    295|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 295, False: 233]
  ------------------
  343|    295|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 295, False: 0]
  ------------------
  344|    295|      initial_setup(cinfo);
  345|    295|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|    295|#define FALSE   0               /* values of boolean */
  ------------------
  346|       |      /* Note: start_input_pass must be called by jdmaster.c
  347|       |       * before any more input can be consumed.  jdapimin.c is
  348|       |       * responsible for enforcing this sequencing.
  349|       |       */
  350|    295|    } else {                    /* 2nd or later SOS marker */
  351|      0|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 0, False: 0]
  ------------------
  352|      0|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|      0|      start_input_pass(cinfo);
  354|      0|    }
  355|    295|    break;
  356|      3|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|      3|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 3, False: 525]
  ------------------
  357|      3|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  358|      3|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 2, False: 1]
  ------------------
  359|      2|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (359:11): [True: 1, False: 1]
  ------------------
  360|      1|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|      2|    } else {
  362|       |      /* Prevent infinite loop in coef ctlr's decompress_data routine
  363|       |       * if user set output_scan_number larger than number of scans.
  364|       |       */
  365|      1|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 0, False: 1]
  ------------------
  366|      0|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|      1|    }
  368|      3|    break;
  369|      0|  case JPEG_SUSPENDED:
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (369:3): [True: 0, False: 528]
  ------------------
  370|      0|    break;
  371|    528|  }
  372|       |
  373|    291|  return val;
  374|    528|}
jdinput.c:initial_setup:
   49|    295|{
   50|    295|  int ci;
   51|    295|  jpeg_component_info *compptr;
   52|    295|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|    289|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 6, False: 289]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|    295|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|    590|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 1, False: 294]
  ------------------
   56|    294|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|    294|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 1, False: 293]
  ------------------
   57|      2|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   58|       |
   59|       |  /* Lossy JPEG images must have 8 or 12 bits per sample.  Lossless JPEG images
   60|       |   * can have 2 to 16 bits per sample.
   61|       |   */
   62|    295|#ifdef D_LOSSLESS_SUPPORTED
   63|    295|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (63:7): [True: 6, False: 289]
  ------------------
   64|      6|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (64:9): [True: 0, False: 6]
  |  Branch (64:38): [True: 1, False: 5]
  ------------------
   65|      1|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   66|      6|  } else
   67|    289|#endif
   68|    289|  {
   69|    289|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (69:9): [True: 4, False: 285]
  |  Branch (69:39): [True: 1, False: 3]
  ------------------
   70|      1|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   71|    289|  }
   72|       |
   73|       |  /* Check that number of components won't exceed internal array sizes */
   74|    295|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|    295|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (74:7): [True: 0, False: 295]
  ------------------
   75|      0|    ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   76|    295|             MAX_COMPONENTS);
   77|       |
   78|       |  /* Compute maximum sampling factors; check factor validity */
   79|    295|  cinfo->max_h_samp_factor = 1;
   80|    295|  cinfo->max_v_samp_factor = 1;
   81|    586|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (81:44): [True: 291, False: 295]
  ------------------
   82|    295|       ci++, compptr++) {
   83|    291|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (83:9): [True: 0, False: 291]
  ------------------
   84|    291|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|    582|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (84:9): [True: 1, False: 290]
  ------------------
   85|    290|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (85:9): [True: 0, False: 290]
  ------------------
   86|    290|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|    290|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (86:9): [True: 1, False: 289]
  ------------------
   87|      2|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|    291|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|    291|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 291]
  |  |  ------------------
  ------------------
   89|    291|                                   compptr->h_samp_factor);
   90|    291|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|    291|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 291]
  |  |  ------------------
  ------------------
   91|    291|                                   compptr->v_samp_factor);
   92|    291|  }
   93|       |
   94|       |#if JPEG_LIB_VERSION >= 80
   95|       |  cinfo->block_size = data_unit;
   96|       |  cinfo->natural_order = jpeg_natural_order;
   97|       |  cinfo->lim_Se = DCTSIZE2 - 1;
   98|       |#endif
   99|       |
  100|       |  /* We initialize DCT_scaled_size and min_DCT_scaled_size to DCTSIZE in lossy
  101|       |   * mode.  In the full decompressor, this will be overridden by jdmaster.c;
  102|       |   * but in the transcoder, jdmaster.c is not used, so we must do it here.
  103|       |   */
  104|       |#if JPEG_LIB_VERSION >= 70
  105|       |  cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = data_unit;
  106|       |#else
  107|    295|  cinfo->min_DCT_scaled_size = data_unit;
  108|    295|#endif
  109|       |
  110|       |  /* Compute dimensions of components */
  111|    584|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (111:44): [True: 289, False: 295]
  ------------------
  112|    295|       ci++, compptr++) {
  113|       |#if JPEG_LIB_VERSION >= 70
  114|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  115|       |#else
  116|    289|    compptr->DCT_scaled_size = data_unit;
  117|    289|#endif
  118|       |    /* Size in data units */
  119|    289|    compptr->width_in_blocks = (JDIMENSION)
  120|    289|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  121|    289|                    (long)(cinfo->max_h_samp_factor * data_unit));
  122|    289|    compptr->height_in_blocks = (JDIMENSION)
  123|    289|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  124|    289|                    (long)(cinfo->max_v_samp_factor * data_unit));
  125|       |    /* Set the first and last MCU columns to decompress from multi-scan images.
  126|       |     * By default, decompress all of the MCU columns.
  127|       |     */
  128|    289|    cinfo->master->first_MCU_col[ci] = 0;
  129|    289|    cinfo->master->last_MCU_col[ci] = compptr->width_in_blocks - 1;
  130|       |    /* downsampled_width and downsampled_height will also be overridden by
  131|       |     * jdmaster.c if we are doing full decompression.  The transcoder library
  132|       |     * doesn't use these values, but the calling application might.
  133|       |     */
  134|       |    /* Size in samples */
  135|    289|    compptr->downsampled_width = (JDIMENSION)
  136|    289|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  137|    289|                    (long)cinfo->max_h_samp_factor);
  138|    289|    compptr->downsampled_height = (JDIMENSION)
  139|    289|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  140|    289|                    (long)cinfo->max_v_samp_factor);
  141|       |    /* Mark component needed, until color conversion says otherwise */
  142|    289|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|    289|#define TRUE    1
  ------------------
  143|       |    /* Mark no quantization table yet saved for component */
  144|    289|    compptr->quant_table = NULL;
  145|    289|  }
  146|       |
  147|       |  /* Compute number of fully interleaved MCU rows. */
  148|    295|  cinfo->total_iMCU_rows = (JDIMENSION)
  149|    295|    jdiv_round_up((long)cinfo->image_height,
  150|    295|                  (long)(cinfo->max_v_samp_factor * data_unit));
  151|       |
  152|       |  /* Decide whether file contains multiple scans */
  153|    295|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (153:7): [True: 6, False: 289]
  |  Branch (153:55): [True: 2, False: 287]
  ------------------
  154|      2|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  155|    293|  else
  156|    293|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  207|    293|#define FALSE   0               /* values of boolean */
  ------------------
  157|    295|}
jdinput.c:reset_input_controller:
  383|    504|{
  384|    504|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  385|       |
  386|    504|  inputctl->pub.consume_input = consume_markers;
  387|    504|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|    504|#define FALSE   0               /* values of boolean */
  ------------------
  388|    504|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|    504|#define FALSE   0               /* values of boolean */
  ------------------
  389|    504|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|    504|#define TRUE    1
  ------------------
  390|       |  /* Reset other modules */
  391|    504|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  392|    504|  (*cinfo->marker->reset_marker_reader) (cinfo);
  393|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  394|       |  cinfo->coef_bits = NULL;
  395|    504|}
jdinput.c:start_input_pass:
  297|    286|{
  298|    286|  per_scan_setup(cinfo);
  299|    286|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (299:7): [True: 283, False: 3]
  ------------------
  300|    283|    latch_quant_tables(cinfo);
  301|    286|  (*cinfo->entropy->start_pass) (cinfo);
  302|    286|  (*cinfo->coef->start_input_pass) (cinfo);
  303|    286|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  304|    286|}
jdinput.c:per_scan_setup:
  164|    286|{
  165|    286|  int ci, mcublks, tmp;
  166|    286|  jpeg_component_info *compptr;
  167|    286|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|    283|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (167:19): [True: 3, False: 283]
  ------------------
  168|       |
  169|    286|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (169:7): [True: 286, False: 0]
  ------------------
  170|       |
  171|       |    /* Noninterleaved (single-component) scan */
  172|    286|    compptr = cinfo->cur_comp_info[0];
  173|       |
  174|       |    /* Overall image size in MCUs */
  175|    286|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  176|    286|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  177|       |
  178|       |    /* For noninterleaved scan, always one data unit per MCU */
  179|    286|    compptr->MCU_width = 1;
  180|    286|    compptr->MCU_height = 1;
  181|    286|    compptr->MCU_blocks = 1;
  182|    286|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|    286|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  183|    286|    compptr->last_col_width = 1;
  184|       |    /* For noninterleaved scans, it is convenient to define last_row_height
  185|       |     * as the number of data unit rows present in the last iMCU row.
  186|       |     */
  187|    286|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|    286|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (188:9): [True: 277, False: 9]
  ------------------
  189|    286|    compptr->last_row_height = tmp;
  190|       |
  191|       |    /* Prepare array describing MCU composition */
  192|    286|    cinfo->blocks_in_MCU = 1;
  193|    286|    cinfo->MCU_membership[0] = 0;
  194|       |
  195|    286|  } else {
  196|       |
  197|       |    /* Interleaved (multi-component) scan */
  198|      0|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|      0|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (198:9): [True: 0, False: 0]
  |  Branch (198:38): [True: 0, False: 0]
  ------------------
  199|      0|      ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
  ------------------
  |  |  247|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  200|      0|               MAX_COMPS_IN_SCAN);
  201|       |
  202|       |    /* Overall image size in MCUs */
  203|      0|    cinfo->MCUs_per_row = (JDIMENSION)
  204|      0|      jdiv_round_up((long)cinfo->image_width,
  205|      0|                    (long)(cinfo->max_h_samp_factor * data_unit));
  206|      0|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  207|      0|      jdiv_round_up((long)cinfo->image_height,
  208|      0|                    (long)(cinfo->max_v_samp_factor * data_unit));
  209|       |
  210|      0|    cinfo->blocks_in_MCU = 0;
  211|       |
  212|      0|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (212:18): [True: 0, False: 0]
  ------------------
  213|      0|      compptr = cinfo->cur_comp_info[ci];
  214|       |      /* Sampling factors give # of data units of component in each MCU */
  215|      0|      compptr->MCU_width = compptr->h_samp_factor;
  216|      0|      compptr->MCU_height = compptr->v_samp_factor;
  217|      0|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  218|      0|      compptr->MCU_sample_width = compptr->MCU_width *
  219|      0|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  220|       |      /* Figure number of non-dummy data units in last MCU column & row */
  221|      0|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  222|      0|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (222:11): [True: 0, False: 0]
  ------------------
  223|      0|      compptr->last_col_width = tmp;
  224|      0|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  225|      0|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (225:11): [True: 0, False: 0]
  ------------------
  226|      0|      compptr->last_row_height = tmp;
  227|       |      /* Prepare array describing MCU composition */
  228|      0|      mcublks = compptr->MCU_blocks;
  229|      0|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   82|      0|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (229:11): [True: 0, False: 0]
  ------------------
  230|      0|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  231|      0|      while (mcublks-- > 0) {
  ------------------
  |  Branch (231:14): [True: 0, False: 0]
  ------------------
  232|      0|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  233|      0|      }
  234|      0|    }
  235|       |
  236|      0|  }
  237|    286|}
jdinput.c:latch_quant_tables:
  263|    283|{
  264|    283|  int ci, qtblno;
  265|    283|  jpeg_component_info *compptr;
  266|    283|  JQUANT_TBL *qtbl;
  267|       |
  268|    566|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (268:16): [True: 283, False: 283]
  ------------------
  269|    283|    compptr = cinfo->cur_comp_info[ci];
  270|       |    /* No work if we already saved Q-table for this component */
  271|    283|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (271:9): [True: 0, False: 283]
  ------------------
  272|      0|      continue;
  273|       |    /* Make sure specified quantization table is present */
  274|    283|    qtblno = compptr->quant_tbl_no;
  275|    283|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|    566|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (275:9): [True: 0, False: 283]
  |  Branch (275:23): [True: 2, False: 281]
  ------------------
  276|    281|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (276:9): [True: 3, False: 278]
  ------------------
  277|      5|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |    /* OK, save away the quantization table */
  279|    283|    qtbl = (JQUANT_TBL *)
  280|    283|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    283|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  281|    283|                                  sizeof(JQUANT_TBL));
  282|    283|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  283|    283|    compptr->quant_table = qtbl;
  284|    283|  }
  285|    283|}
jdinput.c:finish_input_pass:
  315|     24|{
  316|     24|  cinfo->inputctl->consume_input = consume_markers;
  317|     24|}

jinit_lhuff_decoder:
  284|      3|{
  285|      3|  lhuff_entropy_ptr entropy;
  286|      3|  int i;
  287|       |
  288|      3|  entropy = (lhuff_entropy_ptr)
  289|      3|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      3|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|      3|                                sizeof(lhuff_entropy_decoder));
  291|      3|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  292|      3|  entropy->pub.start_pass = start_pass_lhuff_decoder;
  293|      3|  entropy->pub.decode_mcus = decode_mcus;
  294|      3|  entropy->pub.process_restart = process_restart;
  295|       |
  296|       |  /* Mark tables unallocated */
  297|     15|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|     15|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (297:15): [True: 12, False: 3]
  ------------------
  298|       |    entropy->derived_tbls[i] = NULL;
  299|     12|  }
  300|      3|}
jdlhuff.c:start_pass_lhuff_decoder:
   84|      3|{
   85|      3|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
   86|      3|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
   87|      3|  jpeg_component_info *compptr;
   88|       |
   89|      6|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (89:16): [True: 3, False: 3]
  ------------------
   90|      3|    compptr = cinfo->cur_comp_info[ci];
   91|      3|    dctbl = compptr->dc_tbl_no;
   92|       |    /* Make sure requested tables are present */
   93|      3|    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
  ------------------
  |  |   69|      6|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (93:9): [True: 0, False: 3]
  |  Branch (93:22): [True: 1, False: 2]
  ------------------
   94|      2|        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (94:9): [True: 2, False: 0]
  ------------------
   95|      3|      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   96|       |    /* Compute derived values for Huffman tables */
   97|       |    /* We may do this more than once for a table, but it's not expensive */
   98|      3|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
   99|      3|                            &entropy->derived_tbls[dctbl]);
  100|      3|  }
  101|       |
  102|       |  /* Precalculate decoding info for each sample in an MCU of this scan */
  103|      3|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (103:29): [True: 0, False: 3]
  ------------------
  104|      0|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  105|      0|    ci = compptr->component_index;
  106|      0|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (106:23): [True: 0, False: 0]
  ------------------
  107|       |      /* Precalculate the setup info for each output pointer */
  108|      0|      entropy->output_ptr_info[ptrn].ci = ci;
  109|      0|      entropy->output_ptr_info[ptrn].yoffset = yoffset;
  110|      0|      entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  111|      0|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (111:25): [True: 0, False: 0]
  ------------------
  112|       |        /* Precalculate the output pointer index for each sample */
  113|      0|        entropy->output_ptr_index[sampn] = ptrn;
  114|       |        /* Precalculate which table to use for each sample */
  115|      0|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  116|      0|      }
  117|      0|    }
  118|      0|  }
  119|      3|  entropy->num_output_ptrs = ptrn;
  120|       |
  121|       |  /* Initialize bitread state variables */
  122|      3|  entropy->bitstate.bits_left = 0;
  123|      3|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  124|      3|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|      3|#define FALSE   0               /* values of boolean */
  ------------------
  125|      3|}

jinit_lossless_decompressor:
  281|      2|{
  282|      2|  lossless_decomp_ptr losslessd;
  283|       |
  284|      2|#if BITS_IN_JSAMPLE == 8
  285|      2|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      4|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 2]
  |  Branch (285:50): [True: 0, False: 2]
  ------------------
  286|       |#else
  287|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  288|       |      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  289|       |#endif
  290|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  291|       |
  292|       |  /* Create subobject in permanent pool */
  293|      2|  losslessd = (lossless_decomp_ptr)
  294|      2|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|      2|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|      2|                                sizeof(jpeg_lossless_decompressor));
  296|      2|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|      2|  losslessd->pub.start_pass = start_pass_lossless;
  298|      2|}
j12init_lossless_decompressor:
  281|      1|{
  282|      1|  lossless_decomp_ptr losslessd;
  283|       |
  284|       |#if BITS_IN_JSAMPLE == 8
  285|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  286|       |#else
  287|      1|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 1]
  ------------------
  288|      1|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 1]
  ------------------
  289|      0|#endif
  290|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  291|       |
  292|       |  /* Create subobject in permanent pool */
  293|      1|  losslessd = (lossless_decomp_ptr)
  294|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|      1|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|      1|                                sizeof(jpeg_lossless_decompressor));
  296|      1|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|      1|  losslessd->pub.start_pass = start_pass_lossless;
  298|      1|}
j16init_lossless_decompressor:
  281|      1|{
  282|      1|  lossless_decomp_ptr losslessd;
  283|       |
  284|       |#if BITS_IN_JSAMPLE == 8
  285|       |  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  286|       |#else
  287|      1|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (287:7): [True: 0, False: 1]
  ------------------
  288|      1|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (288:7): [True: 0, False: 1]
  ------------------
  289|      0|#endif
  290|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  291|       |
  292|       |  /* Create subobject in permanent pool */
  293|      1|  losslessd = (lossless_decomp_ptr)
  294|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|      1|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|      1|                                sizeof(jpeg_lossless_decompressor));
  296|      1|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|      1|  losslessd->pub.start_pass = start_pass_lossless;
  298|      1|}

jinit_d_main_controller:
  429|    281|{
  430|    281|  my_main_ptr main_ptr;
  431|    281|  int ci, rgroup, ngroups;
  432|    281|  jpeg_component_info *compptr;
  433|       |
  434|    281|#ifdef D_LOSSLESS_SUPPORTED
  435|    281|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 1, False: 280]
  ------------------
  436|      1|#if BITS_IN_JSAMPLE == 8
  437|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 1]
  |  Branch (437:52): [True: 0, False: 1]
  ------------------
  438|       |#else
  439|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  440|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  441|       |#endif
  442|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  443|      1|  } else
  444|    280|#endif
  445|    280|  {
  446|    280|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    280|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (446:9): [True: 0, False: 280]
  ------------------
  447|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  448|    280|  }
  449|       |
  450|    281|  main_ptr = (my_main_ptr)
  451|    281|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    281|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|    281|                                sizeof(my_main_controller));
  453|    281|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|    281|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|    281|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|    281|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 281]
  ------------------
  458|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|       |
  460|       |  /* Allocate the workspace.
  461|       |   * ngroups is the number of row groups we need.
  462|       |   */
  463|    281|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 281]
  ------------------
  464|      0|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 0]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|      0|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|      0|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|    281|  } else {
  469|    281|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    281|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|    281|  }
  471|       |
  472|    562|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 281, False: 281]
  ------------------
  473|    281|       ci++, compptr++) {
  474|    281|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    281|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|    281|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    281|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|    281|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|    281|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    281|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|    281|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|    281|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|    281|                         (JDIMENSION)(rgroup * ngroups));
  480|    281|  }
  481|    281|}
jdmainct-8.c:start_pass_main:
  259|    257|{
  260|    257|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|    257|  switch (pass_mode) {
  263|    257|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 257, False: 0]
  ------------------
  264|    257|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 257]
  ------------------
  265|      0|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  256|      0|#define _process_data  process_data
  ------------------
  266|      0|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|      0|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|      0|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|      0|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|      0|      main_ptr->iMCU_row_ctr = 0;
  270|    257|    } else {
  271|       |      /* Simple case with no context needed */
  272|    257|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  256|    257|#define _process_data  process_data
  ------------------
  273|    257|    }
  274|    257|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|    257|#define FALSE   0               /* values of boolean */
  ------------------
  275|    257|    main_ptr->rowgroup_ctr = 0;
  276|    257|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 257]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  256|      0|#define _process_data  process_data
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 257]
  ------------------
  284|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  285|      0|    break;
  286|    257|  }
  287|    257|}
jdmainct-8.c:process_data_simple_main:
  298|  33.8k|{
  299|  33.8k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|  33.8k|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|  33.8k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 2.34k, False: 31.4k]
  ------------------
  304|  2.34k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  258|  2.34k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (304:9): [True: 0, False: 2.34k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  2.34k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  2.34k|#define TRUE    1
  ------------------
  307|  2.34k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|  33.8k|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  33.8k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  311|       |  /* Note: at the bottom of the image, we may pass extra garbage row groups
  312|       |   * to the postprocessor.  The postprocessor has to check for bottom
  313|       |   * of image anyway (at row resolution), so no point in us doing it too.
  314|       |   */
  315|       |
  316|       |  /* Feed the postprocessor */
  317|  33.8k|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  260|  33.8k|#define _post_process_data  post_process_data
  ------------------
  318|  33.8k|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|  33.8k|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|  33.8k|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 2.08k, False: 31.7k]
  ------------------
  323|  2.08k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  2.08k|#define FALSE   0               /* values of boolean */
  ------------------
  324|  2.08k|    main_ptr->rowgroup_ctr = 0;
  325|  2.08k|  }
  326|  33.8k|}
j12init_d_main_controller:
  429|      4|{
  430|      4|  my_main_ptr main_ptr;
  431|      4|  int ci, rgroup, ngroups;
  432|      4|  jpeg_component_info *compptr;
  433|       |
  434|      4|#ifdef D_LOSSLESS_SUPPORTED
  435|      4|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 1, False: 3]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (439:9): [True: 0, False: 1]
  ------------------
  440|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:9): [True: 0, False: 1]
  ------------------
  441|      0|#endif
  442|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  443|      1|  } else
  444|      3|#endif
  445|      3|  {
  446|      3|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      3|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (446:9): [True: 0, False: 3]
  ------------------
  447|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  448|      3|  }
  449|       |
  450|      4|  main_ptr = (my_main_ptr)
  451|      4|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|      4|                                sizeof(my_main_controller));
  453|      4|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|      4|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|      4|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|      4|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 4]
  ------------------
  458|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|       |
  460|       |  /* Allocate the workspace.
  461|       |   * ngroups is the number of row groups we need.
  462|       |   */
  463|      4|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 4]
  ------------------
  464|      0|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 0]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|      0|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|      0|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|      4|  } else {
  469|      4|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|      4|  }
  471|       |
  472|      8|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 4, False: 4]
  ------------------
  473|      4|       ci++, compptr++) {
  474|      4|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      4|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|      4|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|      4|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|      4|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|      4|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|      4|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|      4|                         (JDIMENSION)(rgroup * ngroups));
  480|      4|  }
  481|      4|}
jdmainct-12.c:start_pass_main:
  259|      1|{
  260|      1|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|      1|  switch (pass_mode) {
  263|      1|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 1, False: 0]
  ------------------
  264|      1|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 1]
  ------------------
  265|      0|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  140|      0|#define _process_data  process_data_12
  ------------------
  266|      0|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|      0|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|      0|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|      0|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|      0|      main_ptr->iMCU_row_ctr = 0;
  270|      1|    } else {
  271|       |      /* Simple case with no context needed */
  272|      1|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  140|      1|#define _process_data  process_data_12
  ------------------
  273|      1|    }
  274|      1|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  275|      1|    main_ptr->rowgroup_ctr = 0;
  276|      1|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 1]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |  140|      0|#define _process_data  process_data_12
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 1]
  ------------------
  284|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  285|      0|    break;
  286|      1|  }
  287|      1|}
j16init_d_main_controller:
  429|      1|{
  430|      1|  my_main_ptr main_ptr;
  431|      1|  int ci, rgroup, ngroups;
  432|      1|  jpeg_component_info *compptr;
  433|       |
  434|      1|#ifdef D_LOSSLESS_SUPPORTED
  435|      1|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 1, False: 0]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (439:9): [True: 0, False: 1]
  ------------------
  440|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (440:9): [True: 0, False: 1]
  ------------------
  441|      0|#endif
  442|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  443|      1|  } else
  444|      0|#endif
  445|      0|  {
  446|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (446:9): [True: 0, False: 0]
  ------------------
  447|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  448|      0|  }
  449|       |
  450|      1|  main_ptr = (my_main_ptr)
  451|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|      1|                                sizeof(my_main_controller));
  453|      1|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|      1|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|      1|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|      1|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 1]
  ------------------
  458|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|       |
  460|       |  /* Allocate the workspace.
  461|       |   * ngroups is the number of row groups we need.
  462|       |   */
  463|      1|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 1]
  ------------------
  464|      0|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 0]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|      0|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|      0|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|      1|  } else {
  469|      1|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      1|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|      1|  }
  471|       |
  472|      2|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 1, False: 1]
  ------------------
  473|      1|       ci++, compptr++) {
  474|      1|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      1|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|      1|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|      1|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|      1|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|      1|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|      1|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|      1|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|      1|                         (JDIMENSION)(rgroup * ngroups));
  480|      1|  }
  481|      1|}

jinit_marker_reader:
 1288|    504|{
 1289|    504|  my_marker_ptr marker;
 1290|    504|  int i;
 1291|       |
 1292|       |  /* Create subobject in permanent pool */
 1293|    504|  marker = (my_marker_ptr)
 1294|    504|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    504|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1295|    504|                                sizeof(my_marker_reader));
 1296|    504|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1297|       |  /* Initialize public method pointers */
 1298|    504|  marker->pub.reset_marker_reader = reset_marker_reader;
 1299|    504|  marker->pub.read_markers = read_markers;
 1300|    504|  marker->pub.read_restart_marker = read_restart_marker;
 1301|       |  /* Initialize COM/APPn processing.
 1302|       |   * By default, we examine and then discard APP0 and APP14,
 1303|       |   * but simply discard COM and all other APPn.
 1304|       |   */
 1305|    504|  marker->process_COM = skip_variable;
 1306|    504|  marker->length_limit_COM = 0;
 1307|  8.56k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1307:15): [True: 8.06k, False: 504]
  ------------------
 1308|  8.06k|    marker->process_APPn[i] = skip_variable;
 1309|  8.06k|    marker->length_limit_APPn[i] = 0;
 1310|  8.06k|  }
 1311|    504|  marker->process_APPn[0] = get_interesting_appn;
 1312|    504|  marker->process_APPn[14] = get_interesting_appn;
 1313|       |  /* Reset marker processing state */
 1314|    504|  reset_marker_reader(cinfo);
 1315|    504|}
jdmarker.c:next_marker:
  892|  2.24k|{
  893|  2.24k|  int c;
  894|  2.24k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.24k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.24k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.24k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  895|       |
  896|  3.09k|  for (;;) {
  897|  3.09k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.09k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.20k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 35]
  |  |  |  |  |  Branch (279:38): [True: 35, False: 3.06k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.09k|            bytes_in_buffer--; \
  |  |  156|  3.09k|            V = *next_input_byte++; )
  ------------------
  898|       |    /* Skip any non-FF bytes.
  899|       |     * This may look a bit inefficient, but it will not occur in a valid file.
  900|       |     * We sync after each discarded byte so that a suspending data source
  901|       |     * can discard the byte from its buffer.
  902|       |     */
  903|   199k|    while (c != 0xFF) {
  ------------------
  |  Branch (903:12): [True: 195k, False: 3.09k]
  ------------------
  904|   195k|      cinfo->marker->discarded_bytes++;
  905|   195k|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   195k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   195k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  906|   195k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   195k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   196k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 23]
  |  |  |  |  |  Branch (279:38): [True: 23, False: 195k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 195k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   195k|            bytes_in_buffer--; \
  |  |  156|   195k|            V = *next_input_byte++; )
  ------------------
  907|   195k|    }
  908|       |    /* This loop swallows any duplicate FF bytes.  Extra FFs are legal as
  909|       |     * pad bytes, so don't count them in discarded_bytes.  We assume there
  910|       |     * will not be so many consecutive FF bytes as to overflow a suspending
  911|       |     * data source's input buffer.
  912|       |     */
  913|  3.45k|    do {
  914|  3.45k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.45k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.46k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 3.45k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.45k|            bytes_in_buffer--; \
  |  |  156|  3.45k|            V = *next_input_byte++; )
  ------------------
  915|  3.45k|    } while (c == 0xFF);
  ------------------
  |  Branch (915:14): [True: 362, False: 3.09k]
  ------------------
  916|  3.09k|    if (c != 0)
  ------------------
  |  Branch (916:9): [True: 2.18k, False: 916]
  ------------------
  917|  2.18k|      break;                    /* found a valid marker, exit loop */
  918|       |    /* Reach here if we found a stuffed-zero data sequence (FF/00).
  919|       |     * Discard it and loop back to try again.
  920|       |     */
  921|    916|    cinfo->marker->discarded_bytes += 2;
  922|    916|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    916|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    916|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  923|    916|  }
  924|       |
  925|  2.24k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (925:7): [True: 50, False: 2.19k]
  ------------------
  926|     50|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|     50|  ((cinfo)->err->msg_code = (code), \
  |  |  291|     50|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|     50|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|     50|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  927|     50|    cinfo->marker->discarded_bytes = 0;
  928|     50|  }
  929|       |
  930|  2.24k|  cinfo->unread_marker = c;
  931|       |
  932|  2.24k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.24k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.24k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  933|  2.24k|  return TRUE;
  ------------------
  |  |  210|  2.24k|#define TRUE    1
  ------------------
  934|  2.24k|}
jdmarker.c:reset_marker_reader:
 1268|  1.00k|{
 1269|  1.00k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1270|       |
 1271|  1.00k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1272|  1.00k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1273|  1.00k|  cinfo->unread_marker = 0;             /* no pending marker */
 1274|  1.00k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|  1.00k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|  1.00k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|  1.00k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|  1.00k|  marker->pub.discarded_bytes = 0;
 1277|       |  marker->cur_marker = NULL;
 1278|  1.00k|}
jdmarker.c:read_markers:
  970|    528|{
  971|       |  /* Outer loop repeats once for each marker. */
  972|  2.74k|  for (;;) {
  973|       |    /* Collect the marker proper, unless we already did. */
  974|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  975|  2.74k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (975:9): [True: 2.74k, False: 1]
  ------------------
  976|  2.74k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (976:11): [True: 504, False: 2.24k]
  ------------------
  977|    504|        if (!first_marker(cinfo))
  ------------------
  |  Branch (977:13): [True: 0, False: 504]
  ------------------
  978|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  979|  2.24k|      } else {
  980|  2.24k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (980:13): [True: 0, False: 2.24k]
  ------------------
  981|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  982|  2.24k|      }
  983|  2.74k|    }
  984|       |    /* At this point cinfo->unread_marker contains the marker code and the
  985|       |     * input point is just past the marker proper, but before any parameters.
  986|       |     * A suspension will cause us to return with this state still true.
  987|       |     */
  988|  2.74k|    switch (cinfo->unread_marker) {
  989|    480|    case M_SOI:
  ------------------
  |  Branch (989:5): [True: 480, False: 2.26k]
  ------------------
  990|    480|      if (!get_soi(cinfo))
  ------------------
  |  Branch (990:11): [True: 0, False: 480]
  ------------------
  991|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  992|    480|      break;
  993|       |
  994|    480|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (994:5): [True: 336, False: 2.40k]
  ------------------
  995|    337|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (995:5): [True: 1, False: 2.74k]
  ------------------
  996|    337|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|    337|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|    337|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|    337|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (996:11): [True: 0, False: 337]
  ------------------
  997|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  998|    337|      break;
  999|       |
 1000|    337|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1000:5): [True: 1, False: 2.74k]
  ------------------
 1001|      1|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1001:11): [True: 0, False: 1]
  ------------------
 1002|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1003|      1|      break;
 1004|       |
 1005|      4|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1005:5): [True: 4, False: 2.74k]
  ------------------
 1006|      4|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1006:11): [True: 0, False: 4]
  ------------------
 1007|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1008|      4|      break;
 1009|       |
 1010|      4|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1010:5): [True: 2, False: 2.74k]
  ------------------
 1011|      2|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  |  Branch (1011:11): [True: 0, False: 2]
  ------------------
 1012|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1013|      2|      break;
 1014|       |
 1015|      2|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1015:5): [True: 2, False: 2.74k]
  ------------------
 1016|      2|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  |  Branch (1016:11): [True: 0, False: 2]
  ------------------
 1017|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1018|      2|      break;
 1019|       |
 1020|      2|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 2, False: 2.74k]
  ------------------
 1021|      2|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  |  Branch (1021:11): [True: 0, False: 2]
  ------------------
 1022|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1023|      2|      break;
 1024|       |
 1025|       |    /* Currently unsupported SOFn types */
 1026|      2|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1026:5): [True: 1, False: 2.74k]
  ------------------
 1027|      2|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1027:5): [True: 1, False: 2.74k]
  ------------------
 1028|      3|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1028:5): [True: 1, False: 2.74k]
  ------------------
 1029|      4|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1029:5): [True: 1, False: 2.74k]
  ------------------
 1030|      5|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 1, False: 2.74k]
  ------------------
 1031|      6|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 1, False: 2.74k]
  ------------------
 1032|      7|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 1, False: 2.74k]
  ------------------
 1033|      7|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      7|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1034|      7|      break;
 1035|       |
 1036|    301|    case M_SOS:
  ------------------
  |  Branch (1036:5): [True: 301, False: 2.44k]
  ------------------
 1037|    301|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 301]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|    301|      cinfo->unread_marker = 0; /* processed the marker */
 1040|    301|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|    301|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1041|       |
 1042|      3|    case M_EOI:
  ------------------
  |  Branch (1042:5): [True: 3, False: 2.74k]
  ------------------
 1043|      3|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  298|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1044|      3|      cinfo->unread_marker = 0; /* processed the marker */
 1045|      3|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      3|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1046|       |
 1047|      6|    case M_DAC:
  ------------------
  |  Branch (1047:5): [True: 6, False: 2.73k]
  ------------------
 1048|      6|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1048:11): [True: 0, False: 6]
  ------------------
 1049|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1050|      6|      break;
 1051|       |
 1052|    324|    case M_DHT:
  ------------------
  |  Branch (1052:5): [True: 324, False: 2.42k]
  ------------------
 1053|    324|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1053:11): [True: 0, False: 324]
  ------------------
 1054|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1055|    324|      break;
 1056|       |
 1057|    347|    case M_DQT:
  ------------------
  |  Branch (1057:5): [True: 347, False: 2.39k]
  ------------------
 1058|    347|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1058:11): [True: 0, False: 347]
  ------------------
 1059|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1060|    347|      break;
 1061|       |
 1062|    347|    case M_DRI:
  ------------------
  |  Branch (1062:5): [True: 1, False: 2.74k]
  ------------------
 1063|      1|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1063:11): [True: 0, False: 1]
  ------------------
 1064|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1065|      1|      break;
 1066|       |
 1067|    360|    case M_APP0:
  ------------------
  |  Branch (1067:5): [True: 360, False: 2.38k]
  ------------------
 1068|    361|    case M_APP1:
  ------------------
  |  Branch (1068:5): [True: 1, False: 2.74k]
  ------------------
 1069|    362|    case M_APP2:
  ------------------
  |  Branch (1069:5): [True: 1, False: 2.74k]
  ------------------
 1070|    377|    case M_APP3:
  ------------------
  |  Branch (1070:5): [True: 15, False: 2.73k]
  ------------------
 1071|    399|    case M_APP4:
  ------------------
  |  Branch (1071:5): [True: 22, False: 2.72k]
  ------------------
 1072|    400|    case M_APP5:
  ------------------
  |  Branch (1072:5): [True: 1, False: 2.74k]
  ------------------
 1073|    401|    case M_APP6:
  ------------------
  |  Branch (1073:5): [True: 1, False: 2.74k]
  ------------------
 1074|    402|    case M_APP7:
  ------------------
  |  Branch (1074:5): [True: 1, False: 2.74k]
  ------------------
 1075|    411|    case M_APP8:
  ------------------
  |  Branch (1075:5): [True: 9, False: 2.73k]
  ------------------
 1076|    412|    case M_APP9:
  ------------------
  |  Branch (1076:5): [True: 1, False: 2.74k]
  ------------------
 1077|    413|    case M_APP10:
  ------------------
  |  Branch (1077:5): [True: 1, False: 2.74k]
  ------------------
 1078|    414|    case M_APP11:
  ------------------
  |  Branch (1078:5): [True: 1, False: 2.74k]
  ------------------
 1079|    415|    case M_APP12:
  ------------------
  |  Branch (1079:5): [True: 1, False: 2.74k]
  ------------------
 1080|    416|    case M_APP13:
  ------------------
  |  Branch (1080:5): [True: 1, False: 2.74k]
  ------------------
 1081|    763|    case M_APP14:
  ------------------
  |  Branch (1081:5): [True: 347, False: 2.39k]
  ------------------
 1082|    764|    case M_APP15:
  ------------------
  |  Branch (1082:5): [True: 1, False: 2.74k]
  ------------------
 1083|    764|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1083:11): [True: 0, False: 764]
  ------------------
 1084|    764|               cinfo->unread_marker - (int)M_APP0]) (cinfo))
 1085|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1086|    764|      break;
 1087|       |
 1088|    764|    case M_COM:
  ------------------
  |  Branch (1088:5): [True: 1, False: 2.74k]
  ------------------
 1089|      1|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1089:11): [True: 0, False: 1]
  ------------------
 1090|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1091|      1|      break;
 1092|       |
 1093|      3|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1093:5): [True: 3, False: 2.74k]
  ------------------
 1094|      4|    case M_RST1:
  ------------------
  |  Branch (1094:5): [True: 1, False: 2.74k]
  ------------------
 1095|      5|    case M_RST2:
  ------------------
  |  Branch (1095:5): [True: 1, False: 2.74k]
  ------------------
 1096|      6|    case M_RST3:
  ------------------
  |  Branch (1096:5): [True: 1, False: 2.74k]
  ------------------
 1097|      8|    case M_RST4:
  ------------------
  |  Branch (1097:5): [True: 2, False: 2.74k]
  ------------------
 1098|      9|    case M_RST5:
  ------------------
  |  Branch (1098:5): [True: 1, False: 2.74k]
  ------------------
 1099|     10|    case M_RST6:
  ------------------
  |  Branch (1099:5): [True: 1, False: 2.74k]
  ------------------
 1100|     11|    case M_RST7:
  ------------------
  |  Branch (1100:5): [True: 1, False: 2.74k]
  ------------------
 1101|     12|    case M_TEM:
  ------------------
  |  Branch (1101:5): [True: 1, False: 2.74k]
  ------------------
 1102|     12|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     12|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     12|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1103|     12|      break;
 1104|       |
 1105|     15|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1105:5): [True: 15, False: 2.73k]
  ------------------
 1106|     15|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1106:11): [True: 0, False: 15]
  ------------------
 1107|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1108|     15|      break;
 1109|       |
 1110|     15|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1110:5): [True: 2, False: 2.74k]
  ------------------
 1111|       |      /* For now, we treat the reserved markers as fatal errors since they are
 1112|       |       * likely to be used to signal incompatible JPEG Part 3 extensions.
 1113|       |       * Once the JPEG 3 version-number marker is well defined, this code
 1114|       |       * ought to change!
 1115|       |       */
 1116|      2|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1117|      2|      break;
 1118|  2.74k|    }
 1119|       |    /* Successfully processed marker, so reset state variable */
 1120|  2.21k|    cinfo->unread_marker = 0;
 1121|  2.21k|  } /* end loop */
 1122|    528|}
jdmarker.c:first_marker:
  945|    504|{
  946|    504|  int c, c2;
  947|    504|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    504|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    504|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    504|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  948|       |
  949|    504|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    504|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    504|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 504]
  |  |  |  |  |  Branch (279:53): [Folded, False: 504]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    504|            bytes_in_buffer--; \
  |  |  156|    504|            V = *next_input_byte++; )
  ------------------
  950|    504|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|    504|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    507|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 503]
  |  |  |  |  |  Branch (279:53): [Folded, False: 504]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    504|            bytes_in_buffer--; \
  |  |  156|    504|            V = *next_input_byte++; )
  ------------------
  951|    504|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (951:7): [True: 24, False: 480]
  |  Branch (951:20): [True: 1, False: 479]
  ------------------
  952|     24|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     24|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     24|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     24|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  953|       |
  954|    504|  cinfo->unread_marker = c2;
  955|       |
  956|    504|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    504|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    504|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  957|    504|  return TRUE;
  ------------------
  |  |  210|    504|#define TRUE    1
  ------------------
  958|    504|}
jdmarker.c:get_soi:
  204|    480|{
  205|    480|  int i;
  206|       |
  207|    480|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|    480|  ((cinfo)->err->msg_code = (code), \
  |  |  298|    480|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|    480|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 1, False: 479]
  ------------------
  210|      1|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|  8.14k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  8.14k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 7.66k, False: 480]
  ------------------
  215|  7.66k|    cinfo->arith_dc_L[i] = 0;
  216|  7.66k|    cinfo->arith_dc_U[i] = 1;
  217|  7.66k|    cinfo->arith_ac_K[i] = 5;
  218|  7.66k|  }
  219|    480|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|    480|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|    480|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|    480|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|    480|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|    480|#define FALSE   0               /* values of boolean */
  ------------------
  227|    480|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|    480|  cinfo->JFIF_minor_version = 1;
  229|    480|  cinfo->density_unit = 0;
  230|    480|  cinfo->X_density = 1;
  231|    480|  cinfo->Y_density = 1;
  232|    480|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|    480|#define FALSE   0               /* values of boolean */
  ------------------
  233|    480|  cinfo->Adobe_transform = 0;
  234|       |
  235|    480|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|    480|#define TRUE    1
  ------------------
  236|       |
  237|    480|  return TRUE;
  ------------------
  |  |  210|    480|#define TRUE    1
  ------------------
  238|    480|}
jdmarker.c:get_sof:
  245|    348|{
  246|    348|  JLONG length;
  247|    348|  int c, ci;
  248|    348|  jpeg_component_info *compptr;
  249|    348|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    348|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    348|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    348|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|    348|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 2, False: 346]
  ------------------
  252|      2|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|    348|  cinfo->progressive_mode = is_prog;
  255|    348|  cinfo->master->lossless = is_lossless;
  256|    348|  cinfo->arith_code = is_arith;
  257|       |
  258|    348|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    348|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    696|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:53): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    348|            bytes_in_buffer--; \
  |  |  164|    348|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    348|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    348|            bytes_in_buffer--; \
  |  |  167|    348|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|    348|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|    348|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    348|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:53): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    348|            bytes_in_buffer--; \
  |  |  156|    348|            V = *next_input_byte++; )
  ------------------
  261|    348|  cinfo->master->jpeg_data_precision = cinfo->data_precision;
  262|    348|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|    348|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    696|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:53): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    348|            bytes_in_buffer--; \
  |  |  164|    348|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    348|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    348|            bytes_in_buffer--; \
  |  |  167|    348|            V += *next_input_byte++; )
  ------------------
  263|    348|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|    348|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    696|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:53): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    348|            bytes_in_buffer--; \
  |  |  164|    348|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    348|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    348|            bytes_in_buffer--; \
  |  |  167|    348|            V += *next_input_byte++; )
  ------------------
  264|    348|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|    348|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    348|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 348]
  |  |  |  |  |  Branch (279:53): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    348|            bytes_in_buffer--; \
  |  |  156|    348|            V = *next_input_byte++; )
  ------------------
  265|       |
  266|    348|  length -= 8;
  267|       |
  268|    348|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|    348|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    348|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    348|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    348|           (cinfo)->err->msg_code = (code); \
  |  |  317|    348|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  269|    348|           (int)cinfo->image_width, (int)cinfo->image_height,
  270|    348|           cinfo->num_components);
  271|       |
  272|       |  /* We don't support files in which the image height is initially specified */
  273|       |  /* as 0 and is later redefined by DNL.  As long as we have to check that,  */
  274|       |  /* might as well have a general sanity check. */
  275|    348|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (275:7): [True: 3, False: 345]
  |  Branch (275:35): [True: 1, False: 344]
  ------------------
  276|    344|      cinfo->num_components <= 0)
  ------------------
  |  Branch (276:7): [True: 1, False: 343]
  ------------------
  277|      3|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |
  279|    348|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (279:7): [True: 16, False: 332]
  ------------------
  280|     16|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     16|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     16|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|    348|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (282:7): [True: 327, False: 21]
  ------------------
  283|    327|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  284|    327|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    327|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  285|    327|                         cinfo->num_components * sizeof(jpeg_component_info));
  286|       |
  287|    675|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 327, False: 348]
  ------------------
  288|    348|       ci++, compptr++) {
  289|    327|    compptr->component_index = ci;
  290|    327|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|    327|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    327|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 327]
  |  |  |  |  |  Branch (279:53): [Folded, False: 327]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    327|            bytes_in_buffer--; \
  |  |  156|    327|            V = *next_input_byte++; )
  ------------------
  291|    327|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    327|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    327|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 327]
  |  |  |  |  |  Branch (279:53): [Folded, False: 327]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    327|            bytes_in_buffer--; \
  |  |  156|    327|            V = *next_input_byte++; )
  ------------------
  292|    327|    compptr->h_samp_factor = (c >> 4) & 15;
  293|    327|    compptr->v_samp_factor = (c     ) & 15;
  294|    327|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|    327|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    327|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 327]
  |  |  |  |  |  Branch (279:53): [Folded, False: 327]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    327|            bytes_in_buffer--; \
  |  |  156|    327|            V = *next_input_byte++; )
  ------------------
  295|       |
  296|    327|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|    327|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    327|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 327]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    327|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    327|           (cinfo)->err->msg_code = (code); \
  |  |  317|    327|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  297|    327|             compptr->component_id, compptr->h_samp_factor,
  298|    327|             compptr->v_samp_factor, compptr->quant_tbl_no);
  299|    327|  }
  300|       |
  301|    348|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|    348|#define TRUE    1
  ------------------
  302|       |
  303|    348|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    348|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    348|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  304|    348|  return TRUE;
  ------------------
  |  |  210|    348|#define TRUE    1
  ------------------
  305|    348|}
jdmarker.c:get_sos:
  311|    301|{
  312|    301|  JLONG length;
  313|    301|  int i, ci, n, c, cc, pi;
  314|    301|  jpeg_component_info *compptr;
  315|    301|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    301|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    301|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    301|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  316|       |
  317|    301|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (317:7): [True: 4, False: 297]
  ------------------
  318|      4|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|    301|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    301|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    602|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 301]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 301]
  |  |  |  |  |  Branch (279:53): [Folded, False: 301]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    301|            bytes_in_buffer--; \
  |  |  164|    301|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    301|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    301|            bytes_in_buffer--; \
  |  |  167|    301|            V += *next_input_byte++; )
  ------------------
  321|       |
  322|    301|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|    301|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    301|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 301]
  |  |  |  |  |  Branch (279:53): [Folded, False: 301]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    301|            bytes_in_buffer--; \
  |  |  156|    301|            V = *next_input_byte++; )
  ------------------
  323|       |
  324|    301|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|    301|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    301|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    301|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  325|       |
  326|    301|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|    296|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (326:7): [True: 5, False: 296]
  |  Branch (326:32): [True: 0, False: 296]
  |  Branch (326:41): [True: 0, False: 296]
  ------------------
  327|      1|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  328|       |
  329|    301|  cinfo->comps_in_scan = n;
  330|       |
  331|       |  /* Collect the component-spec parameters */
  332|       |
  333|  1.48k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|  1.48k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:15): [True: 1.18k, False: 301]
  ------------------
  334|  1.18k|    cinfo->cur_comp_info[i] = NULL;
  335|       |
  336|    596|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (336:15): [True: 296, False: 300]
  ------------------
  337|    296|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|    296|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    296|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 296]
  |  |  |  |  |  Branch (279:53): [Folded, False: 296]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    296|            bytes_in_buffer--; \
  |  |  156|    296|            V = *next_input_byte++; )
  ------------------
  338|    296|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    296|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    296|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 296]
  |  |  |  |  |  Branch (279:53): [Folded, False: 296]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    296|            bytes_in_buffer--; \
  |  |  156|    296|            V = *next_input_byte++; )
  ------------------
  339|       |
  340|    296|    for (ci = 0, compptr = cinfo->comp_info;
  341|    297|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|    296|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (341:10): [True: 296, False: 1]
  |  Branch (341:40): [True: 296, False: 0]
  ------------------
  342|    296|         ci++, compptr++) {
  343|    296|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (343:11): [True: 295, False: 1]
  |  Branch (343:42): [True: 295, False: 0]
  ------------------
  344|    295|        goto id_found;
  345|    296|    }
  346|       |
  347|      1|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|    295|id_found:
  350|       |
  351|    295|    cinfo->cur_comp_info[i] = compptr;
  352|    295|    compptr->dc_tbl_no = (c >> 4) & 15;
  353|    295|    compptr->ac_tbl_no = (c     ) & 15;
  354|       |
  355|    295|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|    295|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    295|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 295]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|    295|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|    295|           (cinfo)->err->msg_code = (code); \
  |  |  312|    295|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  356|    295|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  357|       |
  358|       |    /* This CSi (cc) should differ from the previous CSi */
  359|    295|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (359:18): [True: 0, False: 295]
  ------------------
  360|      0|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (360:11): [True: 0, False: 0]
  ------------------
  361|      0|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  362|      0|      }
  363|      0|    }
  364|    295|  }
  365|       |
  366|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  367|    300|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    300|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    300|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 300]
  |  |  |  |  |  Branch (279:53): [Folded, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    300|            bytes_in_buffer--; \
  |  |  156|    300|            V = *next_input_byte++; )
  ------------------
  368|    300|  cinfo->Ss = c;
  369|    300|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    300|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    300|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 300]
  |  |  |  |  |  Branch (279:53): [Folded, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    300|            bytes_in_buffer--; \
  |  |  156|    300|            V = *next_input_byte++; )
  ------------------
  370|    300|  cinfo->Se = c;
  371|    300|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|    300|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    300|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 300]
  |  |  |  |  |  Branch (279:53): [Folded, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    300|            bytes_in_buffer--; \
  |  |  156|    300|            V = *next_input_byte++; )
  ------------------
  372|    300|  cinfo->Ah = (c >> 4) & 15;
  373|    300|  cinfo->Al = (c     ) & 15;
  374|       |
  375|    300|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|    300|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    300|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 300]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    300|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    300|           (cinfo)->err->msg_code = (code); \
  |  |  317|    300|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  376|    300|           cinfo->Ah, cinfo->Al);
  377|       |
  378|       |  /* Prepare to scan data & restart markers */
  379|    300|  cinfo->marker->next_restart_num = 0;
  380|       |
  381|       |  /* Count another SOS marker */
  382|    300|  cinfo->input_scan_number++;
  383|       |
  384|    300|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    300|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    300|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  385|    300|  return TRUE;
  ------------------
  |  |  210|    300|#define TRUE    1
  ------------------
  386|    300|}
jdmarker.c:get_dac:
  394|      6|{
  395|      6|  JLONG length;
  396|      6|  int index, val;
  397|      6|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|      6|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|      6|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|      6|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  398|       |
  399|      6|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|      6|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     12|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:53): [Folded, False: 6]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|      6|            bytes_in_buffer--; \
  |  |  164|      6|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|      6|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|      6|            bytes_in_buffer--; \
  |  |  167|      6|            V += *next_input_byte++; )
  ------------------
  400|      6|  length -= 2;
  401|       |
  402|     22|  while (length > 0) {
  ------------------
  |  Branch (402:10): [True: 16, False: 6]
  ------------------
  403|     16|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|     16|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     16|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 16]
  |  |  |  |  |  Branch (279:53): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|     16|            bytes_in_buffer--; \
  |  |  156|     16|            V = *next_input_byte++; )
  ------------------
  404|     16|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|     16|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     16|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 16]
  |  |  |  |  |  Branch (279:53): [Folded, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|     16|            bytes_in_buffer--; \
  |  |  156|     16|            V = *next_input_byte++; )
  ------------------
  405|       |
  406|     16|    length -= 2;
  407|       |
  408|     16|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|     16|  ((cinfo)->err->msg_code = (code), \
  |  |  305|     16|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|     16|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|     16|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  409|       |
  410|     16|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|     16|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (410:9): [True: 0, False: 16]
  |  Branch (410:22): [True: 5, False: 11]
  ------------------
  411|      5|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|       |
  413|     16|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|     16|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (413:9): [True: 7, False: 9]
  ------------------
  414|      7|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|      7|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  415|      9|    } else {                    /* define DC table */
  416|      9|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  417|      9|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  418|      9|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (418:11): [True: 1, False: 8]
  ------------------
  419|      1|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  420|      9|    }
  421|     16|  }
  422|       |
  423|      6|  if (length != 0)
  ------------------
  |  Branch (423:7): [True: 0, False: 6]
  ------------------
  424|      0|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  425|       |
  426|      6|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|      6|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|      6|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  427|      6|  return TRUE;
  ------------------
  |  |  210|      6|#define TRUE    1
  ------------------
  428|      6|}
jdmarker.c:get_dht:
  440|    324|{
  441|    324|  JLONG length;
  442|    324|  UINT8 bits[17];
  443|    324|  UINT8 huffval[256];
  444|    324|  int i, index, count;
  445|    324|  JHUFF_TBL **htblptr;
  446|    324|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    324|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    324|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    324|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  447|       |
  448|    324|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    324|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    648|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 324]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 324]
  |  |  |  |  |  Branch (279:53): [Folded, False: 324]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    324|            bytes_in_buffer--; \
  |  |  164|    324|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    324|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    324|            bytes_in_buffer--; \
  |  |  167|    324|            V += *next_input_byte++; )
  ------------------
  449|    324|  length -= 2;
  450|       |
  451|    994|  while (length > 16) {
  ------------------
  |  Branch (451:10): [True: 670, False: 324]
  ------------------
  452|    670|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|    670|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    670|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 670]
  |  |  |  |  |  Branch (279:53): [Folded, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    670|            bytes_in_buffer--; \
  |  |  156|    670|            V = *next_input_byte++; )
  ------------------
  453|       |
  454|    670|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|    670|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    670|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    670|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  455|       |
  456|    670|    bits[0] = 0;
  457|    670|    count = 0;
  458|  11.3k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (458:17): [True: 10.7k, False: 670]
  ------------------
  459|  10.7k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  10.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  10.7k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 10.7k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 10.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  10.7k|            bytes_in_buffer--; \
  |  |  156|  10.7k|            V = *next_input_byte++; )
  ------------------
  460|  10.7k|      count += bits[i];
  461|  10.7k|    }
  462|       |
  463|    670|    length -= 1 + 16;
  464|       |
  465|    670|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|    670|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    670|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|    670|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|    670|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|    670|           (cinfo)->err->msg_code = (code); \
  |  |  329|    670|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  466|    670|             bits[1], bits[2], bits[3], bits[4],
  467|    670|             bits[5], bits[6], bits[7], bits[8]);
  468|    670|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|    670|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    670|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 670]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|    670|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|    670|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|    670|           (cinfo)->err->msg_code = (code); \
  |  |  329|    670|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|    670|             bits[9], bits[10], bits[11], bits[12],
  470|    670|             bits[13], bits[14], bits[15], bits[16]);
  471|       |
  472|       |    /* Here we just do minimal validation of the counts to avoid walking
  473|       |     * off the end of our table space.  jdhuff.c will check more carefully.
  474|       |     */
  475|    670|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (475:9): [True: 11, False: 659]
  |  Branch (475:24): [True: 3, False: 656]
  ------------------
  476|     13|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     13|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  477|       |
  478|  38.9k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (478:17): [True: 38.2k, False: 670]
  ------------------
  479|  38.2k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|  38.2k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  38.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 38.2k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 38.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    670|            bytes_in_buffer--; \
  |  |  156|    670|            V = *next_input_byte++; )
  ------------------
  480|       |
  481|    670|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  482|       |
  483|    670|    length -= count;
  484|       |
  485|    670|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (485:9): [True: 300, False: 370]
  ------------------
  486|    300|      index -= 0x10;
  487|    300|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|    300|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (487:11): [True: 0, False: 300]
  |  Branch (487:24): [True: 1, False: 299]
  ------------------
  488|      1|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  489|    300|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  490|    370|    } else {                    /* DC table definition */
  491|    370|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|    354|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (491:11): [True: 16, False: 354]
  |  Branch (491:24): [True: 2, False: 352]
  ------------------
  492|      2|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  493|    370|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  494|    370|    }
  495|       |
  496|    670|    if (*htblptr == NULL)
  ------------------
  |  Branch (496:9): [True: 610, False: 60]
  ------------------
  497|    610|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  498|       |
  499|    670|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  500|    670|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  501|    670|  }
  502|       |
  503|    324|  if (length != 0)
  ------------------
  |  Branch (503:7): [True: 6, False: 318]
  ------------------
  504|      6|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|    324|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    324|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    324|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  507|    324|  return TRUE;
  ------------------
  |  |  210|    324|#define TRUE    1
  ------------------
  508|    324|}
jdmarker.c:get_dqt:
  514|    347|{
  515|    347|  JLONG length;
  516|    347|  int n, i, prec;
  517|    347|  unsigned int tmp;
  518|    347|  JQUANT_TBL *quant_ptr;
  519|    347|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    347|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    347|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    347|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  520|       |
  521|    347|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    347|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    694|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 347]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 347]
  |  |  |  |  |  Branch (279:53): [Folded, False: 347]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    347|            bytes_in_buffer--; \
  |  |  164|    347|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    347|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    347|            bytes_in_buffer--; \
  |  |  167|    347|            V += *next_input_byte++; )
  ------------------
  522|    347|  length -= 2;
  523|       |
  524|    737|  while (length > 0) {
  ------------------
  |  Branch (524:10): [True: 390, False: 347]
  ------------------
  525|    390|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|    390|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    390|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 390]
  |  |  |  |  |  Branch (279:53): [Folded, False: 390]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    390|            bytes_in_buffer--; \
  |  |  156|    390|            V = *next_input_byte++; )
  ------------------
  526|    390|    prec = n >> 4;
  527|    390|    n &= 0x0F;
  528|       |
  529|    390|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|    390|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    390|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    390|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    390|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  530|       |
  531|    390|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|    390|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (531:9): [True: 8, False: 382]
  ------------------
  532|      8|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|       |
  534|    390|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (534:9): [True: 365, False: 25]
  ------------------
  535|    365|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  536|    390|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  537|       |
  538|  24.2k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  24.2k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (538:17): [True: 23.8k, False: 390]
  ------------------
  539|  23.8k|      if (prec)
  ------------------
  |  Branch (539:11): [True: 2.34k, False: 21.5k]
  ------------------
  540|  23.8k|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  2.34k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.71k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5]
  |  |  |  |  |  Branch (279:38): [True: 5, False: 2.33k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:38): [True: 4, False: 2.34k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.34k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  23.8k|            bytes_in_buffer--; \
  |  |  164|  23.8k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  23.8k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  23.8k|            bytes_in_buffer--; \
  |  |  167|  23.8k|            V += *next_input_byte++; )
  ------------------
  541|  21.5k|      else
  542|  23.8k|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|  21.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  21.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3]
  |  |  |  |  |  Branch (279:38): [True: 3, False: 21.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 21.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  23.8k|            bytes_in_buffer--; \
  |  |  156|  23.8k|            V = *next_input_byte++; )
  ------------------
  543|       |      /* We convert the zigzag-order table to natural array order. */
  544|  23.8k|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  545|  23.8k|    }
  546|       |
  547|    390|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (547:9): [True: 0, False: 390]
  ------------------
  548|      0|      for (i = 0; i < DCTSIZE2; i += 8) {
  ------------------
  |  |   67|      0|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (548:19): [True: 0, False: 0]
  ------------------
  549|      0|        TRACEMS8(cinfo, 2, JTRC_QUANTVALS,
  ------------------
  |  |  325|      0|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|      0|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|      0|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|      0|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|      0|           (cinfo)->err->msg_code = (code); \
  |  |  329|      0|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  550|      0|                 quant_ptr->quantval[i],     quant_ptr->quantval[i + 1],
  551|      0|                 quant_ptr->quantval[i + 2], quant_ptr->quantval[i + 3],
  552|      0|                 quant_ptr->quantval[i + 4], quant_ptr->quantval[i + 5],
  553|      0|                 quant_ptr->quantval[i + 6], quant_ptr->quantval[i + 7]);
  554|      0|      }
  555|      0|    }
  556|       |
  557|    390|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|    390|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  558|    390|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|     34|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (558:9): [True: 34, False: 356]
  ------------------
  559|    390|  }
  560|       |
  561|    347|  if (length != 0)
  ------------------
  |  Branch (561:7): [True: 3, False: 344]
  ------------------
  562|      3|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|       |
  564|    347|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    347|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    347|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  565|    347|  return TRUE;
  ------------------
  |  |  210|    347|#define TRUE    1
  ------------------
  566|    347|}
jdmarker.c:get_dri:
  572|      1|{
  573|      1|  JLONG length;
  574|      1|  unsigned int tmp;
  575|      1|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|      1|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|      1|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|      1|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  576|       |
  577|      1|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|      1|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|      2|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:53): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|      1|            bytes_in_buffer--; \
  |  |  164|      1|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|      1|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|      1|            bytes_in_buffer--; \
  |  |  167|      1|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|      1|  if (length != 4)
  ------------------
  |  Branch (579:7): [True: 1, False: 0]
  ------------------
  580|      1|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|      1|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|      1|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|      2|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:53): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|      1|            bytes_in_buffer--; \
  |  |  164|      1|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|      1|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|      1|            bytes_in_buffer--; \
  |  |  167|      1|            V += *next_input_byte++; )
  ------------------
  583|       |
  584|      1|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  585|       |
  586|      1|  cinfo->restart_interval = tmp;
  587|       |
  588|      1|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|      1|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|      1|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  589|      1|  return TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  590|      1|}
jdmarker.c:skip_variable:
  864|     73|{
  865|     73|  JLONG length;
  866|     73|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|     73|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|     73|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|     73|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  867|       |
  868|     73|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|     73|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    146|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 73]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 73]
  |  |  |  |  |  Branch (279:53): [Folded, False: 73]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|     73|            bytes_in_buffer--; \
  |  |  164|     73|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|     73|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|     73|            bytes_in_buffer--; \
  |  |  167|     73|            V += *next_input_byte++; )
  ------------------
  869|     73|  length -= 2;
  870|       |
  871|     73|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|     73|  ((cinfo)->err->msg_code = (code), \
  |  |  305|     73|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|     73|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|     73|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  872|       |
  873|     73|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|     73|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|     73|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  874|     73|  if (length > 0)
  ------------------
  |  Branch (874:7): [True: 71, False: 2]
  ------------------
  875|     71|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  876|       |
  877|     73|  return TRUE;
  ------------------
  |  |  210|     73|#define TRUE    1
  ------------------
  878|     73|}
jdmarker.c:get_interesting_appn:
  712|    707|{
  713|    707|  JLONG length;
  714|    707|  JOCTET b[APPN_DATA_LEN];
  715|    707|  unsigned int i, numtoread;
  716|    707|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    707|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    707|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    707|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  717|       |
  718|    707|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    707|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  1.41k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 707]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 707]
  |  |  |  |  |  Branch (279:53): [Folded, False: 707]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    707|            bytes_in_buffer--; \
  |  |  164|    707|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    707|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    707|            bytes_in_buffer--; \
  |  |  167|    707|            V += *next_input_byte++; )
  ------------------
  719|    707|  length -= 2;
  720|       |
  721|       |  /* get the interesting part of the marker data */
  722|    707|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  602|    707|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (722:7): [True: 358, False: 349]
  ------------------
  723|    358|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  602|    358|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  724|    349|  else if (length > 0)
  ------------------
  |  Branch (724:12): [True: 348, False: 1]
  ------------------
  725|    348|    numtoread = (unsigned int)length;
  726|      1|  else
  727|      1|    numtoread = 0;
  728|  9.82k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (728:15): [True: 9.11k, False: 707]
  ------------------
  729|  9.11k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|  9.11k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  9.82k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3]
  |  |  |  |  |  Branch (279:38): [True: 3, False: 9.11k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 9.11k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    707|            bytes_in_buffer--; \
  |  |  156|    707|            V = *next_input_byte++; )
  ------------------
  730|    707|  length -= numtoread;
  731|       |
  732|       |  /* process it */
  733|    707|  switch (cinfo->unread_marker) {
  734|    357|  case M_APP0:
  ------------------
  |  Branch (734:3): [True: 357, False: 350]
  ------------------
  735|    357|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  736|    357|    break;
  737|    347|  case M_APP14:
  ------------------
  |  Branch (737:3): [True: 347, False: 360]
  ------------------
  738|    347|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  739|    347|    break;
  740|      0|  default:
  ------------------
  |  Branch (740:3): [True: 0, False: 707]
  ------------------
  741|       |    /* can't get here unless jpeg_save_markers chooses wrong processor */
  742|      0|    ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  743|      0|    break;
  744|    707|  }
  745|       |
  746|       |  /* skip any remaining data -- could be lots */
  747|    703|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    703|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    703|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  748|    703|  if (length > 0)
  ------------------
  |  Branch (748:7): [True: 5, False: 698]
  ------------------
  749|      5|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  750|       |
  751|    703|  return TRUE;
  ------------------
  |  |  210|    703|#define TRUE    1
  ------------------
  752|    707|}
jdmarker.c:examine_app0:
  612|    357|{
  613|    357|  JLONG totallen = (JLONG)datalen + remaining;
  614|       |
  615|    357|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  600|    714|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (615:7): [True: 351, False: 6]
  ------------------
  616|    351|      data[0] == 0x4A &&
  ------------------
  |  Branch (616:7): [True: 350, False: 1]
  ------------------
  617|    350|      data[1] == 0x46 &&
  ------------------
  |  Branch (617:7): [True: 349, False: 1]
  ------------------
  618|    349|      data[2] == 0x49 &&
  ------------------
  |  Branch (618:7): [True: 348, False: 1]
  ------------------
  619|    348|      data[3] == 0x46 &&
  ------------------
  |  Branch (619:7): [True: 346, False: 2]
  ------------------
  620|    346|      data[4] == 0) {
  ------------------
  |  Branch (620:7): [True: 343, False: 3]
  ------------------
  621|       |    /* Found JFIF APP0 marker: save info */
  622|    343|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|    343|#define TRUE    1
  ------------------
  623|    343|    cinfo->JFIF_major_version = data[5];
  624|    343|    cinfo->JFIF_minor_version = data[6];
  625|    343|    cinfo->density_unit = data[7];
  626|    343|    cinfo->X_density = (data[8] << 8) + data[9];
  627|    343|    cinfo->Y_density = (data[10] << 8) + data[11];
  628|       |    /* Check version.
  629|       |     * Major version must be 1, anything else signals an incompatible change.
  630|       |     * (We used to treat this as an error, but now it's a nonfatal warning,
  631|       |     * because some bozo at Hijaak couldn't read the spec.)
  632|       |     * Minor version should be 0..2, but process anyway if newer.
  633|       |     */
  634|    343|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (634:9): [True: 1, False: 342]
  ------------------
  635|      1|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  636|    343|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  637|       |    /* Generate trace messages */
  638|    343|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|    343|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    343|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 343]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|    343|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|    343|           _mp[4] = (p5); \
  |  |  322|    343|           (cinfo)->err->msg_code = (code); \
  |  |  323|    343|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  639|    343|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  640|    343|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  641|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  642|    343|    if (data[12] | data[13])
  ------------------
  |  Branch (642:9): [True: 2, False: 341]
  ------------------
  643|      2|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  305|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|      2|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  644|    343|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  600|    343|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  645|    343|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (645:9): [True: 1, False: 342]
  ------------------
  646|      1|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  647|    343|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (647:14): [True: 12, False: 2]
  ------------------
  648|     12|             data[0] == 0x4A &&
  ------------------
  |  Branch (648:14): [True: 8, False: 4]
  ------------------
  649|      8|             data[1] == 0x46 &&
  ------------------
  |  Branch (649:14): [True: 7, False: 1]
  ------------------
  650|      7|             data[2] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 0, False: 7]
  ------------------
  651|      0|             data[3] == 0x58 &&
  ------------------
  |  Branch (651:14): [True: 0, False: 0]
  ------------------
  652|      0|             data[4] == 0) {
  ------------------
  |  Branch (652:14): [True: 0, False: 0]
  ------------------
  653|       |    /* Found JFIF "JFXX" extension APP0 marker */
  654|       |    /* The library doesn't actually do anything with these,
  655|       |     * but we try to produce a helpful trace message.
  656|       |     */
  657|      0|    switch (data[5]) {
  658|      0|    case 0x10:
  ------------------
  |  Branch (658:5): [True: 0, False: 0]
  ------------------
  659|      0|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  660|      0|      break;
  661|      0|    case 0x11:
  ------------------
  |  Branch (661:5): [True: 0, False: 0]
  ------------------
  662|      0|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  663|      0|      break;
  664|      0|    case 0x13:
  ------------------
  |  Branch (664:5): [True: 0, False: 0]
  ------------------
  665|      0|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  300|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  666|      0|      break;
  667|      0|    default:
  ------------------
  |  Branch (667:5): [True: 0, False: 0]
  ------------------
  668|      0|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  305|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|      0|      break;
  670|      0|    }
  671|     14|  } else {
  672|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  673|     14|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     14|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     14|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  674|     14|  }
  675|    357|}
jdmarker.c:examine_app14:
  685|    347|{
  686|    347|  unsigned int version, flags0, flags1, transform;
  687|       |
  688|    347|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  601|    694|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (688:7): [True: 345, False: 2]
  ------------------
  689|    345|      data[0] == 0x41 &&
  ------------------
  |  Branch (689:7): [True: 341, False: 4]
  ------------------
  690|    341|      data[1] == 0x64 &&
  ------------------
  |  Branch (690:7): [True: 335, False: 6]
  ------------------
  691|    335|      data[2] == 0x6F &&
  ------------------
  |  Branch (691:7): [True: 329, False: 6]
  ------------------
  692|    329|      data[3] == 0x62 &&
  ------------------
  |  Branch (692:7): [True: 327, False: 2]
  ------------------
  693|    327|      data[4] == 0x65) {
  ------------------
  |  Branch (693:7): [True: 325, False: 2]
  ------------------
  694|       |    /* Found Adobe APP14 marker */
  695|    325|    version = (data[5] << 8) + data[6];
  696|    325|    flags0 = (data[7] << 8) + data[8];
  697|    325|    flags1 = (data[9] << 8) + data[10];
  698|    325|    transform = data[11];
  699|    325|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|    325|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    325|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 325]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    325|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    325|           (cinfo)->err->msg_code = (code); \
  |  |  317|    325|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  700|    325|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|    325|#define TRUE    1
  ------------------
  701|    325|    cinfo->Adobe_transform = (UINT8)transform;
  702|    325|  } else {
  703|       |    /* Start of APP14 does not match "Adobe", or too short */
  704|     22|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|     22|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     22|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     22|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  705|     22|  }
  706|    347|}

jpeg_calc_output_dimensions:
  269|    576|{
  270|    576|#ifdef IDCT_SCALING_SUPPORTED
  271|    576|  int ci;
  272|    576|  jpeg_component_info *compptr;
  273|    576|#endif
  274|       |
  275|       |  /* Prevent application from calling me at wrong times */
  276|    576|  if (cinfo->global_state != DSTATE_READY)
  ------------------
  |  |   50|    576|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (276:7): [True: 0, False: 576]
  ------------------
  277|      0|    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |
  279|       |  /* Compute core output image dimensions and DCT scaling choices. */
  280|    576|  jpeg_core_output_dimensions(cinfo);
  281|       |
  282|    576|#ifdef IDCT_SCALING_SUPPORTED
  283|       |
  284|    576|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (284:7): [True: 567, False: 9]
  ------------------
  285|       |    /* In selecting the actual DCT scaling for each component, we try to
  286|       |     * scale up the chroma components via IDCT scaling rather than upsampling.
  287|       |     * This saves time if the upsampler gets to use 1:1 scaling.
  288|       |     * Note this code adapts subsampling ratios which are powers of 2.
  289|       |     */
  290|  1.13k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (290:46): [True: 567, False: 567]
  ------------------
  291|    567|         ci++, compptr++) {
  292|    567|      int ssize = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    567|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  293|    567|      while (ssize < DCTSIZE &&
  ------------------
  |  |   66|  1.13k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (293:14): [True: 0, False: 567]
  ------------------
  294|      0|             ((cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) %
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (294:14): [True: 0, False: 0]
  ------------------
  295|      0|              (compptr->h_samp_factor * ssize * 2) == 0) &&
  296|      0|             ((cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size) %
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (296:14): [True: 0, False: 0]
  ------------------
  297|      0|              (compptr->v_samp_factor * ssize * 2) == 0)) {
  298|      0|        ssize = ssize * 2;
  299|      0|      }
  300|       |#if JPEG_LIB_VERSION >= 70
  301|       |      compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = ssize;
  302|       |#else
  303|    567|      compptr->DCT_scaled_size = ssize;
  304|    567|#endif
  305|    567|    }
  306|       |
  307|       |    /* Recompute downsampled dimensions of components;
  308|       |     * application needs to know these if using raw downsampled data.
  309|       |     */
  310|  1.13k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:46): [True: 567, False: 567]
  ------------------
  311|    567|         ci++, compptr++) {
  312|       |      /* Size in samples, after IDCT scaling */
  313|    567|      compptr->downsampled_width = (JDIMENSION)
  314|    567|        jdiv_round_up((long)cinfo->image_width *
  315|    567|                      (long)(compptr->h_samp_factor *
  316|    567|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|    567|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  317|    567|                      (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  318|    567|      compptr->downsampled_height = (JDIMENSION)
  319|    567|        jdiv_round_up((long)cinfo->image_height *
  320|    567|                      (long)(compptr->v_samp_factor *
  321|    567|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|    567|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  322|    567|                      (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  323|    567|    }
  324|    567|  } else
  325|      9|#endif /* IDCT_SCALING_SUPPORTED */
  326|      9|  {
  327|       |    /* Hardwire it to "no scaling" */
  328|      9|    cinfo->output_width = cinfo->image_width;
  329|      9|    cinfo->output_height = cinfo->image_height;
  330|       |    /* jdinput.c has already initialized DCT_scaled_size to DCTSIZE,
  331|       |     * and has computed unscaled downsampled_width and downsampled_height.
  332|       |     */
  333|      9|  }
  334|       |
  335|       |  /* Report number of components in selected colorspace. */
  336|       |  /* Probably this should be in the color conversion module... */
  337|    576|  switch (cinfo->out_color_space) {
  338|    576|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (338:3): [True: 576, False: 0]
  ------------------
  339|    576|    cinfo->out_color_components = 1;
  340|    576|    break;
  341|      0|  case JCS_RGB:
  ------------------
  |  Branch (341:3): [True: 0, False: 576]
  ------------------
  342|      0|  case JCS_EXT_RGB:
  ------------------
  |  Branch (342:3): [True: 0, False: 576]
  ------------------
  343|      0|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (343:3): [True: 0, False: 576]
  ------------------
  344|      0|  case JCS_EXT_BGR:
  ------------------
  |  Branch (344:3): [True: 0, False: 576]
  ------------------
  345|      0|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (345:3): [True: 0, False: 576]
  ------------------
  346|      0|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (346:3): [True: 0, False: 576]
  ------------------
  347|      0|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (347:3): [True: 0, False: 576]
  ------------------
  348|      0|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (348:3): [True: 0, False: 576]
  ------------------
  349|      0|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (349:3): [True: 0, False: 576]
  ------------------
  350|      0|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (350:3): [True: 0, False: 576]
  ------------------
  351|      0|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (351:3): [True: 0, False: 576]
  ------------------
  352|      0|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  353|      0|    break;
  354|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (354:3): [True: 0, False: 576]
  ------------------
  355|      0|  case JCS_RGB565:
  ------------------
  |  Branch (355:3): [True: 0, False: 576]
  ------------------
  356|      0|    cinfo->out_color_components = 3;
  357|      0|    break;
  358|      0|  case JCS_CMYK:
  ------------------
  |  Branch (358:3): [True: 0, False: 576]
  ------------------
  359|      0|  case JCS_YCCK:
  ------------------
  |  Branch (359:3): [True: 0, False: 576]
  ------------------
  360|      0|    cinfo->out_color_components = 4;
  361|      0|    break;
  362|      0|  default:                      /* else must be same colorspace as in file */
  ------------------
  |  Branch (362:3): [True: 0, False: 576]
  ------------------
  363|      0|    cinfo->out_color_components = cinfo->num_components;
  364|      0|    break;
  365|    576|  }
  366|    576|  cinfo->output_components = (cinfo->quantize_colors ? 1 :
  ------------------
  |  Branch (366:31): [True: 0, False: 576]
  ------------------
  367|    576|                              cinfo->out_color_components);
  368|       |
  369|       |  /* See if upsampler will want to emit more than one row at a time */
  370|    576|  if (use_merged_upsample(cinfo))
  ------------------
  |  Branch (370:7): [True: 0, False: 576]
  ------------------
  371|      0|    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  372|    576|  else
  373|    576|    cinfo->rec_outbuf_height = 1;
  374|    576|}
jinit_master_decompress:
  902|    287|{
  903|    287|  my_master_ptr master = (my_master_ptr)cinfo->master;
  904|       |
  905|       |#ifdef WITH_PROFILE
  906|       |  master->pub.total_start = getTime();
  907|       |#endif
  908|       |
  909|    287|  master->pub.prepare_for_output_pass = prepare_for_output_pass;
  910|    287|  master->pub.finish_output_pass = finish_output_pass;
  911|       |
  912|    287|  master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  207|    287|#define FALSE   0               /* values of boolean */
  ------------------
  913|    287|  master->pub.jinit_upsampler_no_alloc = FALSE;
  ------------------
  |  |  207|    287|#define FALSE   0               /* values of boolean */
  ------------------
  914|       |
  915|    287|  master_selection(cinfo);
  916|    287|}
jdmaster.c:jpeg_core_output_dimensions:
  103|    576|{
  104|    576|#ifdef IDCT_SCALING_SUPPORTED
  105|    576|  int ci;
  106|    576|  jpeg_component_info *compptr;
  107|       |
  108|    576|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (108:7): [True: 567, False: 9]
  ------------------
  109|       |    /* Compute actual output image dimensions and DCT scaling choices. */
  110|    567|    if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (110:9): [True: 0, False: 567]
  ------------------
  111|       |      /* Provide 1/block_size scaling */
  112|      0|      cinfo->output_width = (JDIMENSION)
  113|      0|        jdiv_round_up((long)cinfo->image_width, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  114|      0|      cinfo->output_height = (JDIMENSION)
  115|      0|        jdiv_round_up((long)cinfo->image_height, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  116|      0|      cinfo->_min_DCT_h_scaled_size = 1;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  117|      0|      cinfo->_min_DCT_v_scaled_size = 1;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  118|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (118:16): [True: 0, False: 567]
  ------------------
  119|       |      /* Provide 2/block_size scaling */
  120|      0|      cinfo->output_width = (JDIMENSION)
  121|      0|        jdiv_round_up((long)cinfo->image_width * 2L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  122|      0|      cinfo->output_height = (JDIMENSION)
  123|      0|        jdiv_round_up((long)cinfo->image_height * 2L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  124|      0|      cinfo->_min_DCT_h_scaled_size = 2;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  125|      0|      cinfo->_min_DCT_v_scaled_size = 2;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  126|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (126:16): [True: 0, False: 567]
  ------------------
  127|       |      /* Provide 3/block_size scaling */
  128|      0|      cinfo->output_width = (JDIMENSION)
  129|      0|        jdiv_round_up((long)cinfo->image_width * 3L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  130|      0|      cinfo->output_height = (JDIMENSION)
  131|      0|        jdiv_round_up((long)cinfo->image_height * 3L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  132|      0|      cinfo->_min_DCT_h_scaled_size = 3;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  133|      0|      cinfo->_min_DCT_v_scaled_size = 3;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  134|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (134:16): [True: 0, False: 567]
  ------------------
  135|       |      /* Provide 4/block_size scaling */
  136|      0|      cinfo->output_width = (JDIMENSION)
  137|      0|        jdiv_round_up((long)cinfo->image_width * 4L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  138|      0|      cinfo->output_height = (JDIMENSION)
  139|      0|        jdiv_round_up((long)cinfo->image_height * 4L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  140|      0|      cinfo->_min_DCT_h_scaled_size = 4;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  141|      0|      cinfo->_min_DCT_v_scaled_size = 4;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  142|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (142:16): [True: 0, False: 567]
  ------------------
  143|       |      /* Provide 5/block_size scaling */
  144|      0|      cinfo->output_width = (JDIMENSION)
  145|      0|        jdiv_round_up((long)cinfo->image_width * 5L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  146|      0|      cinfo->output_height = (JDIMENSION)
  147|      0|        jdiv_round_up((long)cinfo->image_height * 5L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  148|      0|      cinfo->_min_DCT_h_scaled_size = 5;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  149|      0|      cinfo->_min_DCT_v_scaled_size = 5;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  150|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (150:16): [True: 0, False: 567]
  ------------------
  151|       |      /* Provide 6/block_size scaling */
  152|      0|      cinfo->output_width = (JDIMENSION)
  153|      0|        jdiv_round_up((long)cinfo->image_width * 6L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  154|      0|      cinfo->output_height = (JDIMENSION)
  155|      0|        jdiv_round_up((long)cinfo->image_height * 6L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  156|      0|      cinfo->_min_DCT_h_scaled_size = 6;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  157|      0|      cinfo->_min_DCT_v_scaled_size = 6;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  158|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (158:16): [True: 0, False: 567]
  ------------------
  159|       |      /* Provide 7/block_size scaling */
  160|      0|      cinfo->output_width = (JDIMENSION)
  161|      0|        jdiv_round_up((long)cinfo->image_width * 7L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  162|      0|      cinfo->output_height = (JDIMENSION)
  163|      0|        jdiv_round_up((long)cinfo->image_height * 7L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  164|      0|      cinfo->_min_DCT_h_scaled_size = 7;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  165|      0|      cinfo->_min_DCT_v_scaled_size = 7;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  166|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (166:16): [True: 567, False: 0]
  ------------------
  167|       |      /* Provide 8/block_size scaling */
  168|    567|      cinfo->output_width = (JDIMENSION)
  169|    567|        jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  170|    567|      cinfo->output_height = (JDIMENSION)
  171|    567|        jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|    567|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  172|    567|      cinfo->_min_DCT_h_scaled_size = 8;
  ------------------
  |  |   28|    567|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  173|    567|      cinfo->_min_DCT_v_scaled_size = 8;
  ------------------
  |  |   29|    567|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  174|    567|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 9) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (174:16): [True: 0, False: 0]
  ------------------
  175|       |      /* Provide 9/block_size scaling */
  176|      0|      cinfo->output_width = (JDIMENSION)
  177|      0|        jdiv_round_up((long)cinfo->image_width * 9L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  178|      0|      cinfo->output_height = (JDIMENSION)
  179|      0|        jdiv_round_up((long)cinfo->image_height * 9L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  180|      0|      cinfo->_min_DCT_h_scaled_size = 9;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  181|      0|      cinfo->_min_DCT_v_scaled_size = 9;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  182|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 10) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (182:16): [True: 0, False: 0]
  ------------------
  183|       |      /* Provide 10/block_size scaling */
  184|      0|      cinfo->output_width = (JDIMENSION)
  185|      0|        jdiv_round_up((long)cinfo->image_width * 10L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  186|      0|      cinfo->output_height = (JDIMENSION)
  187|      0|        jdiv_round_up((long)cinfo->image_height * 10L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  188|      0|      cinfo->_min_DCT_h_scaled_size = 10;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  189|      0|      cinfo->_min_DCT_v_scaled_size = 10;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  190|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 11) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (190:16): [True: 0, False: 0]
  ------------------
  191|       |      /* Provide 11/block_size scaling */
  192|      0|      cinfo->output_width = (JDIMENSION)
  193|      0|        jdiv_round_up((long)cinfo->image_width * 11L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  194|      0|      cinfo->output_height = (JDIMENSION)
  195|      0|        jdiv_round_up((long)cinfo->image_height * 11L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  196|      0|      cinfo->_min_DCT_h_scaled_size = 11;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  197|      0|      cinfo->_min_DCT_v_scaled_size = 11;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  198|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 12) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (198:16): [True: 0, False: 0]
  ------------------
  199|       |      /* Provide 12/block_size scaling */
  200|      0|      cinfo->output_width = (JDIMENSION)
  201|      0|        jdiv_round_up((long)cinfo->image_width * 12L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  202|      0|      cinfo->output_height = (JDIMENSION)
  203|      0|        jdiv_round_up((long)cinfo->image_height * 12L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  204|      0|      cinfo->_min_DCT_h_scaled_size = 12;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  205|      0|      cinfo->_min_DCT_v_scaled_size = 12;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  206|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 13) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (206:16): [True: 0, False: 0]
  ------------------
  207|       |      /* Provide 13/block_size scaling */
  208|      0|      cinfo->output_width = (JDIMENSION)
  209|      0|        jdiv_round_up((long)cinfo->image_width * 13L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  210|      0|      cinfo->output_height = (JDIMENSION)
  211|      0|        jdiv_round_up((long)cinfo->image_height * 13L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  212|      0|      cinfo->_min_DCT_h_scaled_size = 13;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  213|      0|      cinfo->_min_DCT_v_scaled_size = 13;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  214|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 14) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (214:16): [True: 0, False: 0]
  ------------------
  215|       |      /* Provide 14/block_size scaling */
  216|      0|      cinfo->output_width = (JDIMENSION)
  217|      0|        jdiv_round_up((long)cinfo->image_width * 14L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  218|      0|      cinfo->output_height = (JDIMENSION)
  219|      0|        jdiv_round_up((long)cinfo->image_height * 14L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  220|      0|      cinfo->_min_DCT_h_scaled_size = 14;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  221|      0|      cinfo->_min_DCT_v_scaled_size = 14;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  222|      0|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 15) {
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (222:16): [True: 0, False: 0]
  ------------------
  223|       |      /* Provide 15/block_size scaling */
  224|      0|      cinfo->output_width = (JDIMENSION)
  225|      0|        jdiv_round_up((long)cinfo->image_width * 15L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  226|      0|      cinfo->output_height = (JDIMENSION)
  227|      0|        jdiv_round_up((long)cinfo->image_height * 15L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  228|      0|      cinfo->_min_DCT_h_scaled_size = 15;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  229|      0|      cinfo->_min_DCT_v_scaled_size = 15;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  230|      0|    } else {
  231|       |      /* Provide 16/block_size scaling */
  232|      0|      cinfo->output_width = (JDIMENSION)
  233|      0|        jdiv_round_up((long)cinfo->image_width * 16L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  234|      0|      cinfo->output_height = (JDIMENSION)
  235|      0|        jdiv_round_up((long)cinfo->image_height * 16L, (long)DCTSIZE);
  ------------------
  |  |   66|      0|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  236|      0|      cinfo->_min_DCT_h_scaled_size = 16;
  ------------------
  |  |   28|      0|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  237|      0|      cinfo->_min_DCT_v_scaled_size = 16;
  ------------------
  |  |   29|      0|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  238|      0|    }
  239|       |
  240|       |    /* Recompute dimensions of components */
  241|  1.13k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (241:46): [True: 567, False: 567]
  ------------------
  242|    567|         ci++, compptr++) {
  243|    567|      compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   25|    567|#define _DCT_h_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|    567|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  244|    567|      compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   26|    567|#define _DCT_v_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|    567|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  245|    567|    }
  246|    567|  } else
  247|      9|#endif /* !IDCT_SCALING_SUPPORTED */
  248|      9|  {
  249|       |    /* Hardwire it to "no scaling" */
  250|      9|    cinfo->output_width = cinfo->image_width;
  251|      9|    cinfo->output_height = cinfo->image_height;
  252|       |    /* jdinput.c has already initialized DCT_scaled_size,
  253|       |     * and has computed unscaled downsampled_width and downsampled_height.
  254|       |     */
  255|      9|  }
  256|    576|}
jdmaster.c:use_merged_upsample:
   39|    863|{
   40|    863|#ifdef UPSAMPLE_MERGING_SUPPORTED
   41|       |  /* Colorspace conversion is not supported with lossless JPEG images */
   42|    863|  if (cinfo->master->lossless)
  ------------------
  |  Branch (42:7): [True: 13, False: 850]
  ------------------
   43|     13|    return FALSE;
  ------------------
  |  |  207|     13|#define FALSE   0               /* values of boolean */
  ------------------
   44|       |  /* Merging is the equivalent of plain box-filter upsampling */
   45|    850|  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
  ------------------
  |  Branch (45:7): [True: 850, False: 0]
  |  Branch (45:37): [True: 0, False: 0]
  ------------------
   46|    850|    return FALSE;
  ------------------
  |  |  207|    850|#define FALSE   0               /* values of boolean */
  ------------------
   47|       |  /* jdmerge.c only supports YCC=>RGB and YCC=>RGB565 color conversion */
   48|      0|  if (cinfo->jpeg_color_space != JCS_YCbCr || cinfo->num_components != 3 ||
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  |  Branch (48:47): [True: 0, False: 0]
  ------------------
   49|      0|      (cinfo->out_color_space != JCS_RGB &&
  ------------------
  |  Branch (49:8): [True: 0, False: 0]
  ------------------
   50|      0|       cinfo->out_color_space != JCS_RGB565 &&
  ------------------
  |  Branch (50:8): [True: 0, False: 0]
  ------------------
   51|      0|       cinfo->out_color_space != JCS_EXT_RGB &&
  ------------------
  |  Branch (51:8): [True: 0, False: 0]
  ------------------
   52|      0|       cinfo->out_color_space != JCS_EXT_RGBX &&
  ------------------
  |  Branch (52:8): [True: 0, False: 0]
  ------------------
   53|      0|       cinfo->out_color_space != JCS_EXT_BGR &&
  ------------------
  |  Branch (53:8): [True: 0, False: 0]
  ------------------
   54|      0|       cinfo->out_color_space != JCS_EXT_BGRX &&
  ------------------
  |  Branch (54:8): [True: 0, False: 0]
  ------------------
   55|      0|       cinfo->out_color_space != JCS_EXT_XBGR &&
  ------------------
  |  Branch (55:8): [True: 0, False: 0]
  ------------------
   56|      0|       cinfo->out_color_space != JCS_EXT_XRGB &&
  ------------------
  |  Branch (56:8): [True: 0, False: 0]
  ------------------
   57|      0|       cinfo->out_color_space != JCS_EXT_RGBA &&
  ------------------
  |  Branch (57:8): [True: 0, False: 0]
  ------------------
   58|      0|       cinfo->out_color_space != JCS_EXT_BGRA &&
  ------------------
  |  Branch (58:8): [True: 0, False: 0]
  ------------------
   59|      0|       cinfo->out_color_space != JCS_EXT_ABGR &&
  ------------------
  |  Branch (59:8): [True: 0, False: 0]
  ------------------
   60|      0|       cinfo->out_color_space != JCS_EXT_ARGB))
  ------------------
  |  Branch (60:8): [True: 0, False: 0]
  ------------------
   61|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   62|      0|  if ((cinfo->out_color_space == JCS_RGB565 &&
  ------------------
  |  Branch (62:8): [True: 0, False: 0]
  ------------------
   63|      0|       cinfo->out_color_components != 3) ||
  ------------------
  |  Branch (63:8): [True: 0, False: 0]
  ------------------
   64|      0|      (cinfo->out_color_space != JCS_RGB565 &&
  ------------------
  |  Branch (64:8): [True: 0, False: 0]
  ------------------
   65|      0|       cinfo->out_color_components != rgb_pixelsize[cinfo->out_color_space]))
  ------------------
  |  Branch (65:8): [True: 0, False: 0]
  ------------------
   66|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   67|       |  /* and it only handles 2h1v or 2h2v sampling ratios */
   68|      0|  if (cinfo->comp_info[0].h_samp_factor != 2 ||
  ------------------
  |  Branch (68:7): [True: 0, False: 0]
  ------------------
   69|      0|      cinfo->comp_info[1].h_samp_factor != 1 ||
  ------------------
  |  Branch (69:7): [True: 0, False: 0]
  ------------------
   70|      0|      cinfo->comp_info[2].h_samp_factor != 1 ||
  ------------------
  |  Branch (70:7): [True: 0, False: 0]
  ------------------
   71|      0|      cinfo->comp_info[0].v_samp_factor >  2 ||
  ------------------
  |  Branch (71:7): [True: 0, False: 0]
  ------------------
   72|      0|      cinfo->comp_info[1].v_samp_factor != 1 ||
  ------------------
  |  Branch (72:7): [True: 0, False: 0]
  ------------------
   73|      0|      cinfo->comp_info[2].v_samp_factor != 1)
  ------------------
  |  Branch (73:7): [True: 0, False: 0]
  ------------------
   74|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   75|       |  /* furthermore, it doesn't work if we've scaled the IDCTs differently */
   76|      0|  if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                if (cinfo->comp_info[0]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (76:7): [True: 0, False: 0]
  ------------------
   77|      0|      cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                    cinfo->comp_info[1]._DCT_scaled_size != cinfo->_min_DCT_scaled_size ||
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (77:7): [True: 0, False: 0]
  ------------------
   78|      0|      cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
  ------------------
  |  |   24|      0|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
                    cinfo->comp_info[2]._DCT_scaled_size != cinfo->_min_DCT_scaled_size)
  ------------------
  |  |   27|      0|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (78:7): [True: 0, False: 0]
  ------------------
   79|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   80|       |  /* ??? also need to test for upsample-time rescaling, when & if supported */
   81|      0|  return TRUE;                  /* by golly, it'll work... */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
   82|       |#else
   83|       |  return FALSE;
   84|       |#endif
   85|      0|}
jdmaster.c:prepare_for_output_pass:
  797|    258|{
  798|    258|  my_master_ptr master = (my_master_ptr)cinfo->master;
  799|       |
  800|    258|  if (master->pub.is_dummy_pass) {
  ------------------
  |  Branch (800:7): [True: 0, False: 258]
  ------------------
  801|      0|#ifdef QUANT_2PASS_SUPPORTED
  802|       |    /* Final pass of 2-pass quantization */
  803|      0|    master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  804|      0|    (*cinfo->cquantize->start_pass) (cinfo, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  805|      0|    (*cinfo->post->start_pass) (cinfo, JBUF_CRANK_DEST);
  806|      0|    (*cinfo->main->start_pass) (cinfo, JBUF_CRANK_DEST);
  807|       |#else
  808|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  809|       |#endif /* QUANT_2PASS_SUPPORTED */
  810|    258|  } else {
  811|    258|    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
  ------------------
  |  Branch (811:9): [True: 0, False: 258]
  |  Branch (811:35): [True: 0, False: 0]
  ------------------
  812|       |      /* Select new quantization method */
  813|      0|      if (cinfo->two_pass_quantize && cinfo->enable_2pass_quant) {
  ------------------
  |  Branch (813:11): [True: 0, False: 0]
  |  Branch (813:39): [True: 0, False: 0]
  ------------------
  814|      0|        cinfo->cquantize = master->quantizer_2pass;
  815|      0|        master->pub.is_dummy_pass = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  816|      0|      } else if (cinfo->enable_1pass_quant) {
  ------------------
  |  Branch (816:18): [True: 0, False: 0]
  ------------------
  817|      0|        cinfo->cquantize = master->quantizer_1pass;
  818|      0|      } else {
  819|      0|        ERREXIT(cinfo, JERR_MODE_CHANGE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  820|      0|      }
  821|      0|    }
  822|    258|    (*cinfo->idct->start_pass) (cinfo);
  823|    258|    (*cinfo->coef->start_output_pass) (cinfo);
  824|    258|    if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (824:9): [True: 258, False: 0]
  ------------------
  825|    258|      if (!master->using_merged_upsample)
  ------------------
  |  Branch (825:11): [True: 258, False: 0]
  ------------------
  826|    258|        (*cinfo->cconvert->start_pass) (cinfo);
  827|    258|      (*cinfo->upsample->start_pass) (cinfo);
  828|    258|      if (cinfo->quantize_colors)
  ------------------
  |  Branch (828:11): [True: 0, False: 258]
  ------------------
  829|      0|        (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
  830|    258|      (*cinfo->post->start_pass) (cinfo,
  831|    258|            (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  ------------------
  |  Branch (831:14): [True: 0, False: 258]
  ------------------
  832|    258|      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  833|    258|    }
  834|    258|  }
  835|       |
  836|       |  /* Set up progress monitor's pass info if present */
  837|    258|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (837:7): [True: 258, False: 0]
  ------------------
  838|    258|    cinfo->progress->completed_passes = master->pass_number;
  839|    258|    cinfo->progress->total_passes = master->pass_number +
  840|    258|                                    (master->pub.is_dummy_pass ? 2 : 1);
  ------------------
  |  Branch (840:38): [True: 0, False: 258]
  ------------------
  841|       |    /* In buffered-image mode, we assume one more output pass if EOI not
  842|       |     * yet reached, but no more passes if EOI has been reached.
  843|       |     */
  844|    258|    if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (844:9): [True: 0, False: 258]
  |  Branch (844:34): [True: 0, False: 0]
  ------------------
  845|      0|      cinfo->progress->total_passes += (cinfo->enable_2pass_quant ? 2 : 1);
  ------------------
  |  Branch (845:41): [True: 0, False: 0]
  ------------------
  846|      0|    }
  847|    258|  }
  848|    258|}
jdmaster.c:finish_output_pass:
  857|     24|{
  858|     24|  my_master_ptr master = (my_master_ptr)cinfo->master;
  859|       |
  860|     24|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (860:7): [True: 0, False: 24]
  ------------------
  861|      0|    (*cinfo->cquantize->finish_pass) (cinfo);
  862|     24|  master->pass_number++;
  863|     24|}
jdmaster.c:master_selection:
  515|    287|{
  516|    287|  my_master_ptr master = (my_master_ptr)cinfo->master;
  517|    287|  boolean use_c_buffer;
  518|    287|  long samplesperrow;
  519|    287|  JDIMENSION jd_samplesperrow;
  520|       |
  521|       |  /* When decompressing an 8-bit-per-sample lossy JPEG image, we allow the
  522|       |   * caller to request 12-bit-per-sample output in order to facilitate shadow
  523|       |   * recovery in underexposed images.  However, in all other cases, setting the
  524|       |   * output data precision to a different value than the JPEG data precision
  525|       |   * will produce unexpected results, such as a bogus output image.
  526|       |   */
  527|    287|  if (cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (527:7): [True: 287, False: 0]
  ------------------
  528|    287|      cinfo->data_precision != cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (528:7): [True: 0, False: 287]
  ------------------
  529|      0|      (cinfo->master->lossless || cinfo->data_precision != 12))
  ------------------
  |  Branch (529:8): [True: 0, False: 0]
  |  Branch (529:35): [True: 0, False: 0]
  ------------------
  530|      0|    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  531|       |
  532|       |  /* Disable IDCT scaling and raw (downsampled) data output in lossless mode.
  533|       |   * IDCT scaling is not useful in lossless mode, and it must be disabled in
  534|       |   * order to properly calculate the output dimensions.  Raw data output isn't
  535|       |   * particularly useful without subsampling and has not been tested in
  536|       |   * lossless mode.
  537|       |   */
  538|    287|#ifdef D_LOSSLESS_SUPPORTED
  539|    287|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (539:7): [True: 4, False: 283]
  ------------------
  540|      4|    cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  541|      4|    cinfo->scale_num = cinfo->scale_denom = 1;
  542|      4|  }
  543|    287|#endif
  544|       |
  545|       |  /* Initialize dimensions and other stuff */
  546|    287|  jpeg_calc_output_dimensions(cinfo);
  547|    287|  prepare_range_limit_table(cinfo);
  548|       |
  549|       |  /* Width of an output scanline must be representable as JDIMENSION. */
  550|    287|  samplesperrow = (long)cinfo->output_width *
  551|    287|                  (long)cinfo->out_color_components;
  552|    287|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  553|    287|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (553:7): [True: 0, False: 287]
  ------------------
  554|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  555|       |
  556|       |  /* Initialize my private state */
  557|    287|  master->pass_number = 0;
  558|    287|  master->using_merged_upsample = use_merged_upsample(cinfo);
  559|       |
  560|       |  /* Color quantizer selection */
  561|    287|  master->quantizer_1pass = NULL;
  562|    287|  master->quantizer_2pass = NULL;
  563|       |  /* No mode changes if not using buffered-image mode. */
  564|    287|  if (!cinfo->quantize_colors || !cinfo->buffered_image) {
  ------------------
  |  Branch (564:7): [True: 287, False: 0]
  |  Branch (564:34): [True: 0, False: 0]
  ------------------
  565|    287|    cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|    287|#define FALSE   0               /* values of boolean */
  ------------------
  566|    287|    cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|    287|#define FALSE   0               /* values of boolean */
  ------------------
  567|    287|    cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|    287|#define FALSE   0               /* values of boolean */
  ------------------
  568|    287|  }
  569|    287|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (569:7): [True: 0, False: 287]
  ------------------
  570|      0|    if (cinfo->raw_data_out)
  ------------------
  |  Branch (570:9): [True: 0, False: 0]
  ------------------
  571|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  572|       |    /* 2-pass quantizer only works in 3-component color space. */
  573|      0|    if (cinfo->out_color_components != 3 ||
  ------------------
  |  Branch (573:9): [True: 0, False: 0]
  ------------------
  574|      0|        cinfo->out_color_space == JCS_RGB565) {
  ------------------
  |  Branch (574:9): [True: 0, False: 0]
  ------------------
  575|      0|      cinfo->enable_1pass_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  576|      0|      cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  577|      0|      cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  578|      0|      cinfo->colormap = NULL;
  579|      0|    } else if (cinfo->colormap != NULL) {
  ------------------
  |  Branch (579:16): [True: 0, False: 0]
  ------------------
  580|      0|      cinfo->enable_external_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  581|      0|    } else if (cinfo->two_pass_quantize) {
  ------------------
  |  Branch (581:16): [True: 0, False: 0]
  ------------------
  582|      0|      cinfo->enable_2pass_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  583|      0|    } else {
  584|      0|      cinfo->enable_1pass_quant = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  585|      0|    }
  586|       |
  587|      0|    if (cinfo->enable_1pass_quant) {
  ------------------
  |  Branch (587:9): [True: 0, False: 0]
  ------------------
  588|      0|#ifdef QUANT_1PASS_SUPPORTED
  589|      0|      if (cinfo->data_precision == 8)
  ------------------
  |  Branch (589:11): [True: 0, False: 0]
  ------------------
  590|      0|        jinit_1pass_quantizer(cinfo);
  591|      0|      else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (591:16): [True: 0, False: 0]
  ------------------
  592|      0|        j12init_1pass_quantizer(cinfo);
  593|      0|      else
  594|      0|        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  595|      0|      master->quantizer_1pass = cinfo->cquantize;
  596|       |#else
  597|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  598|       |#endif
  599|      0|    }
  600|       |
  601|       |    /* We use the 2-pass code to map to external colormaps. */
  602|      0|    if (cinfo->enable_2pass_quant || cinfo->enable_external_quant) {
  ------------------
  |  Branch (602:9): [True: 0, False: 0]
  |  Branch (602:38): [True: 0, False: 0]
  ------------------
  603|      0|#ifdef QUANT_2PASS_SUPPORTED
  604|      0|      if (cinfo->data_precision == 8)
  ------------------
  |  Branch (604:11): [True: 0, False: 0]
  ------------------
  605|      0|        jinit_2pass_quantizer(cinfo);
  606|      0|      else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (606:16): [True: 0, False: 0]
  ------------------
  607|      0|        j12init_2pass_quantizer(cinfo);
  608|      0|      else
  609|      0|        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  610|      0|      master->quantizer_2pass = cinfo->cquantize;
  611|       |#else
  612|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  613|       |#endif
  614|      0|    }
  615|       |    /* If both quantizers are initialized, the 2-pass one is left active;
  616|       |     * this is necessary for starting with quantization to an external map.
  617|       |     */
  618|      0|  }
  619|       |
  620|       |  /* Post-processing: in particular, color conversion first */
  621|    287|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (621:7): [True: 287, False: 0]
  ------------------
  622|    287|    if (master->using_merged_upsample) {
  ------------------
  |  Branch (622:9): [True: 0, False: 287]
  ------------------
  623|      0|#ifdef UPSAMPLE_MERGING_SUPPORTED
  624|      0|      if (cinfo->data_precision == 8)
  ------------------
  |  Branch (624:11): [True: 0, False: 0]
  ------------------
  625|      0|        jinit_merged_upsampler(cinfo); /* does color conversion too */
  626|      0|      else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (626:16): [True: 0, False: 0]
  ------------------
  627|      0|        j12init_merged_upsampler(cinfo); /* does color conversion too */
  628|      0|      else
  629|      0|        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  630|       |#else
  631|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
  632|       |#endif
  633|    287|    } else {
  634|    287|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (634:11): [True: 282, False: 5]
  ------------------
  635|    282|        jinit_color_deconverter(cinfo);
  636|    282|        jinit_upsampler(cinfo);
  637|    282|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (637:18): [True: 4, False: 1]
  ------------------
  638|      4|        j12init_color_deconverter(cinfo);
  639|      4|        j12init_upsampler(cinfo);
  640|      4|      } else {
  641|      1|#ifdef D_LOSSLESS_SUPPORTED
  642|      1|        j16init_color_deconverter(cinfo);
  643|      1|        j16init_upsampler(cinfo);
  644|       |#else
  645|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  646|       |#endif
  647|      1|      }
  648|    287|    }
  649|    287|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (649:9): [True: 282, False: 5]
  ------------------
  650|    282|      jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  651|      5|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (651:14): [True: 4, False: 1]
  ------------------
  652|      4|      j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  653|      1|    else
  654|      1|#ifdef D_LOSSLESS_SUPPORTED
  655|      1|      j16init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  656|       |#else
  657|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  658|       |#endif
  659|    287|  }
  660|       |
  661|    287|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (661:7): [True: 4, False: 283]
  ------------------
  662|      4|#ifdef D_LOSSLESS_SUPPORTED
  663|       |    /* Prediction, sample undifferencing, point transform, and sample size
  664|       |     * scaling
  665|       |     */
  666|      4|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (666:9): [True: 2, False: 2]
  ------------------
  667|      2|      jinit_lossless_decompressor(cinfo);
  668|      2|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (668:14): [True: 1, False: 1]
  ------------------
  669|      1|      j12init_lossless_decompressor(cinfo);
  670|      1|    else
  671|      1|      j16init_lossless_decompressor(cinfo);
  672|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  673|      4|    if (cinfo->arith_code) {
  ------------------
  |  Branch (673:9): [True: 1, False: 3]
  ------------------
  674|      1|      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  675|      3|    } else {
  676|      3|      jinit_lhuff_decoder(cinfo);
  677|      3|    }
  678|       |
  679|       |    /* Initialize principal buffer controllers. */
  680|      4|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (680:20): [True: 1, False: 3]
  ------------------
  681|      3|                   cinfo->buffered_image;
  ------------------
  |  Branch (681:20): [True: 0, False: 3]
  ------------------
  682|      4|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (682:9): [True: 1, False: 3]
  ------------------
  683|      1|      jinit_d_diff_controller(cinfo, use_c_buffer);
  684|      3|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (684:14): [True: 1, False: 2]
  ------------------
  685|      1|      j12init_d_diff_controller(cinfo, use_c_buffer);
  686|      2|    else
  687|      2|      j16init_d_diff_controller(cinfo, use_c_buffer);
  688|       |#else
  689|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  690|       |#endif
  691|    283|  } else {
  692|    283|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) || \
  693|    283|    defined(DCT_FLOAT_SUPPORTED)
  694|       |    /* Inverse DCT */
  695|    283|    if (cinfo->data_precision == 8)
  ------------------
  |  Branch (695:9): [True: 280, False: 3]
  ------------------
  696|    280|      jinit_inverse_dct(cinfo);
  697|      3|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (697:14): [True: 3, False: 0]
  ------------------
  698|      3|      j12init_inverse_dct(cinfo);
  699|      0|    else
  700|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  701|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  702|    283|    if (cinfo->arith_code) {
  ------------------
  |  Branch (702:9): [True: 3, False: 280]
  ------------------
  703|      3|#ifdef D_ARITH_CODING_SUPPORTED
  704|      3|      jinit_arith_decoder(cinfo);
  705|       |#else
  706|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  707|       |#endif
  708|    280|    } else {
  709|    280|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (709:11): [True: 1, False: 279]
  ------------------
  710|      1|#ifdef D_PROGRESSIVE_SUPPORTED
  711|      1|        jinit_phuff_decoder(cinfo);
  712|       |#else
  713|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  714|       |#endif
  715|      1|      } else
  716|    279|        jinit_huff_decoder(cinfo);
  717|    280|    }
  718|       |
  719|       |    /* Initialize principal buffer controllers. */
  720|    283|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (720:20): [True: 2, False: 281]
  ------------------
  721|    281|                   cinfo->buffered_image;
  ------------------
  |  Branch (721:20): [True: 0, False: 281]
  ------------------
  722|    283|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (722:9): [True: 3, False: 280]
  ------------------
  723|      3|      j12init_d_coef_controller(cinfo, use_c_buffer);
  724|    280|    else
  725|    280|      jinit_d_coef_controller(cinfo, use_c_buffer);
  726|       |#else
  727|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  728|       |#endif
  729|    283|  }
  730|       |
  731|    287|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (731:7): [True: 286, False: 1]
  ------------------
  732|    286|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (732:9): [True: 281, False: 5]
  ------------------
  733|    281|      jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|    281|#define FALSE   0               /* values of boolean */
  ------------------
  734|      5|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (734:14): [True: 4, False: 1]
  ------------------
  735|      4|      j12init_d_main_controller(cinfo,
  736|      4|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  737|      1|    else
  738|      1|#ifdef D_LOSSLESS_SUPPORTED
  739|      1|      j16init_d_main_controller(cinfo,
  740|      1|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  741|       |#else
  742|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  743|       |#endif
  744|    286|  }
  745|       |
  746|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  747|    287|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  748|       |
  749|       |  /* Initialize input side of decompressor to consume first scan. */
  750|    287|  (*cinfo->inputctl->start_input_pass) (cinfo);
  751|       |
  752|       |  /* Set the first and last iMCU columns to decompress from single-scan images.
  753|       |   * By default, decompress all of the iMCU columns.
  754|       |   */
  755|    287|  cinfo->master->first_iMCU_col = 0;
  756|    287|  cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
  757|    287|  cinfo->master->last_good_iMCU_row = 0;
  758|       |
  759|    287|#ifdef D_MULTISCAN_FILES_SUPPORTED
  760|       |  /* If jpeg_start_decompress will read the whole file, initialize
  761|       |   * progress monitoring appropriately.  The input step is counted
  762|       |   * as one pass.
  763|       |   */
  764|    287|  if (cinfo->progress != NULL && !cinfo->buffered_image &&
  ------------------
  |  Branch (764:7): [True: 258, False: 29]
  |  Branch (764:34): [True: 258, False: 0]
  ------------------
  765|    258|      cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (765:7): [True: 0, False: 258]
  ------------------
  766|      0|    int nscans;
  767|       |    /* Estimate number of scans to set pass_limit. */
  768|      0|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (768:9): [True: 0, False: 0]
  ------------------
  769|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  770|      0|      nscans = 2 + 3 * cinfo->num_components;
  771|      0|    } else {
  772|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  773|      0|      nscans = cinfo->num_components;
  774|      0|    }
  775|      0|    cinfo->progress->pass_counter = 0L;
  776|      0|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  777|      0|    cinfo->progress->completed_passes = 0;
  778|      0|    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
  ------------------
  |  Branch (778:38): [True: 0, False: 0]
  ------------------
  779|       |    /* Count the input pass as done */
  780|      0|    master->pass_number++;
  781|      0|  }
  782|    287|#endif /* D_MULTISCAN_FILES_SUPPORTED */
  783|    287|}
jdmaster.c:prepare_range_limit_table:
  420|    287|{
  421|    287|  JSAMPLE *table;
  422|    287|  J12SAMPLE *table12;
  423|    287|#ifdef D_LOSSLESS_SUPPORTED
  424|    287|  J16SAMPLE *table16;
  425|    287|#endif
  426|    287|  int i;
  427|       |
  428|    287|  if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (428:7): [True: 282, False: 5]
  ------------------
  429|    282|    table = (JSAMPLE *)
  430|    282|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    282|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  431|    282|                  (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
                                (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|    282|#define CENTERJSAMPLE    128
  ------------------
  432|    282|    table += (MAXJSAMPLE + 1);  /* allow negative subscripts of simple table */
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
  433|    282|    cinfo->sample_range_limit = table;
  434|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  435|    282|    memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
                  memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
  436|       |    /* Main part of "simple" table: limit[x] = x */
  437|  72.4k|    for (i = 0; i <= MAXJSAMPLE; i++)
  ------------------
  |  |   52|  72.4k|#define MAXJSAMPLE       255
  ------------------
  |  Branch (437:17): [True: 72.1k, False: 282]
  ------------------
  438|  72.1k|      table[i] = (JSAMPLE)i;
  439|    282|    table += CENTERJSAMPLE;     /* Point to where post-IDCT table starts */
  ------------------
  |  |   53|    282|#define CENTERJSAMPLE    128
  ------------------
  440|       |    /* End of simple table, rest of first half of post-IDCT table */
  441|   108k|    for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   53|    282|#define CENTERJSAMPLE    128
  ------------------
                  for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   52|   108k|#define MAXJSAMPLE       255
  ------------------
  |  Branch (441:29): [True: 108k, False: 282]
  ------------------
  442|   108k|      table[i] = MAXJSAMPLE;
  ------------------
  |  |   52|   108k|#define MAXJSAMPLE       255
  ------------------
  443|       |    /* Second half of post-IDCT table */
  444|    282|    memset(table + (2 * (MAXJSAMPLE + 1)), 0,
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
  445|    282|           (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
                         (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|    282|#define CENTERJSAMPLE    128
  ------------------
  446|    282|    memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   52|    282|#define MAXJSAMPLE       255
  ------------------
                  memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   53|    282|#define CENTERJSAMPLE    128
  ------------------
  447|    282|           cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
  ------------------
  |  |   53|    282|#define CENTERJSAMPLE    128
  ------------------
  448|    282|  } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (448:14): [True: 4, False: 1]
  ------------------
  449|      4|    table12 = (J12SAMPLE *)
  450|      4|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  451|      4|                  (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
                                (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   61|      4|#define CENTERJ12SAMPLE  2048
  ------------------
  452|      4|                  sizeof(J12SAMPLE));
  453|      4|    table12 += (MAXJ12SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
  454|       |                                       table */
  455|      4|    cinfo->sample_range_limit = (JSAMPLE *)table12;
  456|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  457|      4|    memset(table12 - (MAXJ12SAMPLE + 1), 0,
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
  458|      4|           (MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
  459|       |    /* Main part of "simple" table: limit[x] = x */
  460|  16.3k|    for (i = 0; i <= MAXJ12SAMPLE; i++)
  ------------------
  |  |   60|  16.3k|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (460:17): [True: 16.3k, False: 4]
  ------------------
  461|  16.3k|      table12[i] = (J12SAMPLE)i;
  462|      4|    table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   61|      4|#define CENTERJ12SAMPLE  2048
  ------------------
  463|       |    /* End of simple table, rest of first half of post-IDCT table */
  464|  24.5k|    for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   61|      4|#define CENTERJ12SAMPLE  2048
  ------------------
                  for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   60|  24.5k|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (464:31): [True: 24.5k, False: 4]
  ------------------
  465|  24.5k|      table12[i] = MAXJ12SAMPLE;
  ------------------
  |  |   60|  24.5k|#define MAXJ12SAMPLE     4095
  ------------------
  466|       |    /* Second half of post-IDCT table */
  467|      4|    memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
  468|      4|           (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
                         (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   61|      4|#define CENTERJ12SAMPLE  2048
  ------------------
  469|      4|    memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   60|      4|#define MAXJ12SAMPLE     4095
  ------------------
                  memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   61|      4|#define CENTERJ12SAMPLE  2048
  ------------------
  470|      4|           cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
  ------------------
  |  |   61|      4|#define CENTERJ12SAMPLE  2048
  ------------------
  471|      4|  } else {
  472|      1|#ifdef D_LOSSLESS_SUPPORTED
  473|      1|    table16 = (J16SAMPLE *)
  474|      1|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  475|      1|                  (5 * (MAXJ16SAMPLE + 1) + CENTERJ16SAMPLE) *
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
                                (5 * (MAXJ16SAMPLE + 1) + CENTERJ16SAMPLE) *
  ------------------
  |  |   69|      1|#define CENTERJ16SAMPLE  32768
  ------------------
  476|      1|                  sizeof(J16SAMPLE));
  477|      1|    table16 += (MAXJ16SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
  478|       |                                       table */
  479|      1|    cinfo->sample_range_limit = (JSAMPLE *)table16;
  480|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  481|      1|    memset(table16 - (MAXJ16SAMPLE + 1), 0,
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
  482|      1|           (MAXJ16SAMPLE + 1) * sizeof(J16SAMPLE));
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
  483|       |    /* Main part of "simple" table: limit[x] = x */
  484|  65.5k|    for (i = 0; i <= MAXJ16SAMPLE; i++)
  ------------------
  |  |   68|  65.5k|#define MAXJ16SAMPLE     65535
  ------------------
  |  Branch (484:17): [True: 65.5k, False: 1]
  ------------------
  485|  65.5k|      table16[i] = (J16SAMPLE)i;
  486|      1|    table16 += CENTERJ16SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   69|      1|#define CENTERJ16SAMPLE  32768
  ------------------
  487|       |    /* End of simple table, rest of first half of post-IDCT table */
  488|  98.3k|    for (i = CENTERJ16SAMPLE; i < 2 * (MAXJ16SAMPLE + 1); i++)
  ------------------
  |  |   69|      1|#define CENTERJ16SAMPLE  32768
  ------------------
                  for (i = CENTERJ16SAMPLE; i < 2 * (MAXJ16SAMPLE + 1); i++)
  ------------------
  |  |   68|  98.3k|#define MAXJ16SAMPLE     65535
  ------------------
  |  Branch (488:31): [True: 98.3k, False: 1]
  ------------------
  489|  98.3k|      table16[i] = MAXJ16SAMPLE;
  ------------------
  |  |   68|  98.3k|#define MAXJ16SAMPLE     65535
  ------------------
  490|       |    /* Second half of post-IDCT table */
  491|      1|    memset(table16 + (2 * (MAXJ16SAMPLE + 1)), 0,
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
  492|      1|           (2 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE) * sizeof(J16SAMPLE));
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
                         (2 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE) * sizeof(J16SAMPLE));
  ------------------
  |  |   69|      1|#define CENTERJ16SAMPLE  32768
  ------------------
  493|      1|    memcpy(table16 + (4 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE),
  ------------------
  |  |   68|      1|#define MAXJ16SAMPLE     65535
  ------------------
                  memcpy(table16 + (4 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE),
  ------------------
  |  |   69|      1|#define CENTERJ16SAMPLE  32768
  ------------------
  494|      1|           cinfo->sample_range_limit, CENTERJ16SAMPLE * sizeof(J16SAMPLE));
  ------------------
  |  |   69|      1|#define CENTERJ16SAMPLE  32768
  ------------------
  495|       |#else
  496|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  497|       |#endif
  498|      1|  }
  499|    287|}

jinit_phuff_decoder:
  654|      1|{
  655|      1|  phuff_entropy_ptr entropy;
  656|      1|  int *coef_bit_ptr;
  657|      1|  int ci, i;
  658|       |
  659|      1|  entropy = (phuff_entropy_ptr)
  660|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|      1|                                sizeof(phuff_entropy_decoder));
  662|      1|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|      1|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|      5|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|      5|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 4, False: 1]
  ------------------
  667|      4|    entropy->derived_tbls[i] = NULL;
  668|      4|  }
  669|       |
  670|       |  /* Create progression status table */
  671|      1|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|      1|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|      1|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|      1|                                sizeof(int));
  675|      1|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|      2|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 1, False: 1]
  ------------------
  677|     65|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|     65|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 64, False: 1]
  ------------------
  678|     64|      *coef_bit_ptr++ = -1;
  679|      1|}

jinit_d_post_controller:
  267|    282|{
  268|    282|  my_post_ptr post;
  269|       |
  270|    282|#ifdef D_LOSSLESS_SUPPORTED
  271|    282|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 2, False: 280]
  ------------------
  272|      2|#if BITS_IN_JSAMPLE == 8
  273|      2|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      4|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (273:9): [True: 0, False: 2]
  |  Branch (273:52): [True: 0, False: 2]
  ------------------
  274|       |#else
  275|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  276|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  277|       |#endif
  278|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  279|      2|  } else
  280|    280|#endif
  281|    280|  {
  282|    280|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    280|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (282:9): [True: 0, False: 280]
  ------------------
  283|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  284|    280|  }
  285|       |
  286|    282|  post = (my_post_ptr)
  287|    282|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    282|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|    282|                                sizeof(my_post_controller));
  289|    282|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|    282|  post->pub.start_pass = start_pass_dpost;
  291|    282|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|    282|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|    282|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 282]
  ------------------
  296|      0|#if BITS_IN_JSAMPLE != 16
  297|       |    /* The buffer strip height is max_v_samp_factor, which is typically
  298|       |     * an efficient number of rows for upsampling to return.
  299|       |     * (In the presence of output rescaling, we might want to be smarter?)
  300|       |     */
  301|      0|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|      0|    if (need_full_buffer) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|       |      /* Two-pass color quantization: need full-image storage. */
  304|       |      /* We round up the number of rows to a multiple of the strip height. */
  305|      0|#ifdef QUANT_2PASS_SUPPORTED
  306|      0|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  308|      0|         cinfo->output_width * cinfo->out_color_components,
  309|      0|         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|      0|                               (long)post->strip_height),
  311|      0|         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|      0|    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|      0|      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  319|      0|         cinfo->output_width * cinfo->out_color_components,
  320|      0|         post->strip_height);
  321|      0|    }
  322|       |#else
  323|       |    ERREXIT(cinfo, JERR_NOTIMPL);
  324|       |#endif
  325|      0|  }
  326|    282|}
jdpostct-8.c:start_pass_dpost:
   85|    257|{
   86|    257|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|    257|  switch (pass_mode) {
   89|    257|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 257, False: 0]
  ------------------
   90|    257|#if BITS_IN_JSAMPLE != 16
   91|    257|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 257]
  ------------------
   92|       |      /* Single-pass processing with color quantization. */
   93|      0|      post->pub._post_process_data = post_process_1pass;
  ------------------
  |  |  260|      0|#define _post_process_data  post_process_data
  ------------------
   94|       |      /* We could be doing buffered-image output before starting a 2-pass
   95|       |       * color quantization; in that case, jinit_d_post_controller did not
   96|       |       * allocate a strip buffer.  Use the virtual-array buffer as workspace.
   97|       |       */
   98|      0|      if (post->buffer == NULL) {
  ------------------
  |  Branch (98:11): [True: 0, False: 0]
  ------------------
   99|      0|        post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  100|      0|          ((j_common_ptr)cinfo, post->whole_image,
  101|      0|           (JDIMENSION)0, post->strip_height, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  102|      0|      }
  103|      0|    } else
  104|    257|#endif
  105|    257|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|    257|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  260|    257|#define _post_process_data  post_process_data
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  265|    257|#define _upsample  upsample
  ------------------
  110|    257|    }
  111|    257|    break;
  112|      0|#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|      0|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (113:3): [True: 0, False: 257]
  ------------------
  114|       |    /* First pass of 2-pass quantization */
  115|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (115:9): [True: 0, False: 0]
  ------------------
  116|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  117|      0|    post->pub._post_process_data = post_process_prepass;
  ------------------
  |  |  260|      0|#define _post_process_data  post_process_data
  ------------------
  118|      0|    break;
  119|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (119:3): [True: 0, False: 257]
  ------------------
  120|       |    /* Second pass of 2-pass quantization */
  121|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (121:9): [True: 0, False: 0]
  ------------------
  122|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  123|      0|    post->pub._post_process_data = post_process_2pass;
  ------------------
  |  |  260|      0|#define _post_process_data  post_process_data
  ------------------
  124|      0|    break;
  125|      0|#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 257]
  ------------------
  127|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  128|      0|    break;
  129|    257|  }
  130|    257|  post->starting_row = post->next_row = 0;
  131|    257|}
j12init_d_post_controller:
  267|      4|{
  268|      4|  my_post_ptr post;
  269|       |
  270|      4|#ifdef D_LOSSLESS_SUPPORTED
  271|      4|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 1, False: 3]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (275:9): [True: 0, False: 1]
  ------------------
  276|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (276:9): [True: 0, False: 1]
  ------------------
  277|      0|#endif
  278|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  279|      1|  } else
  280|      3|#endif
  281|      3|  {
  282|      3|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      3|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (282:9): [True: 0, False: 3]
  ------------------
  283|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  284|      3|  }
  285|       |
  286|      4|  post = (my_post_ptr)
  287|      4|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|      4|                                sizeof(my_post_controller));
  289|      4|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|      4|  post->pub.start_pass = start_pass_dpost;
  291|      4|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|      4|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|      4|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 4]
  ------------------
  296|      0|#if BITS_IN_JSAMPLE != 16
  297|       |    /* The buffer strip height is max_v_samp_factor, which is typically
  298|       |     * an efficient number of rows for upsampling to return.
  299|       |     * (In the presence of output rescaling, we might want to be smarter?)
  300|       |     */
  301|      0|    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|      0|    if (need_full_buffer) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|       |      /* Two-pass color quantization: need full-image storage. */
  304|       |      /* We round up the number of rows to a multiple of the strip height. */
  305|      0|#ifdef QUANT_2PASS_SUPPORTED
  306|      0|      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  308|      0|         cinfo->output_width * cinfo->out_color_components,
  309|      0|         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|      0|                               (long)post->strip_height),
  311|      0|         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|      0|    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|      0|      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  319|      0|         cinfo->output_width * cinfo->out_color_components,
  320|      0|         post->strip_height);
  321|      0|    }
  322|       |#else
  323|       |    ERREXIT(cinfo, JERR_NOTIMPL);
  324|       |#endif
  325|      0|  }
  326|      4|}
jdpostct-12.c:start_pass_dpost:
   85|      1|{
   86|      1|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|      1|  switch (pass_mode) {
   89|      1|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 1, False: 0]
  ------------------
   90|      1|#if BITS_IN_JSAMPLE != 16
   91|      1|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1]
  ------------------
   92|       |      /* Single-pass processing with color quantization. */
   93|      0|      post->pub._post_process_data = post_process_1pass;
  ------------------
  |  |  144|      0|#define _post_process_data  post_process_data_12
  ------------------
   94|       |      /* We could be doing buffered-image output before starting a 2-pass
   95|       |       * color quantization; in that case, jinit_d_post_controller did not
   96|       |       * allocate a strip buffer.  Use the virtual-array buffer as workspace.
   97|       |       */
   98|      0|      if (post->buffer == NULL) {
  ------------------
  |  Branch (98:11): [True: 0, False: 0]
  ------------------
   99|      0|        post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  100|      0|          ((j_common_ptr)cinfo, post->whole_image,
  101|      0|           (JDIMENSION)0, post->strip_height, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  102|      0|      }
  103|      0|    } else
  104|      1|#endif
  105|      1|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|      1|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  144|      1|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  149|      1|#define _upsample  upsample_12
  ------------------
  110|      1|    }
  111|      1|    break;
  112|      0|#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|      0|  case JBUF_SAVE_AND_PASS:
  ------------------
  |  Branch (113:3): [True: 0, False: 1]
  ------------------
  114|       |    /* First pass of 2-pass quantization */
  115|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (115:9): [True: 0, False: 0]
  ------------------
  116|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  117|      0|    post->pub._post_process_data = post_process_prepass;
  ------------------
  |  |  144|      0|#define _post_process_data  post_process_data_12
  ------------------
  118|      0|    break;
  119|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (119:3): [True: 0, False: 1]
  ------------------
  120|       |    /* Second pass of 2-pass quantization */
  121|      0|    if (post->whole_image == NULL)
  ------------------
  |  Branch (121:9): [True: 0, False: 0]
  ------------------
  122|      0|      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  123|      0|    post->pub._post_process_data = post_process_2pass;
  ------------------
  |  |  144|      0|#define _post_process_data  post_process_data_12
  ------------------
  124|      0|    break;
  125|      0|#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 1]
  ------------------
  127|      0|    ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  128|      0|    break;
  129|      1|  }
  130|      1|  post->starting_row = post->next_row = 0;
  131|      1|}
j16init_d_post_controller:
  267|      1|{
  268|      1|  my_post_ptr post;
  269|       |
  270|      1|#ifdef D_LOSSLESS_SUPPORTED
  271|      1|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 1, False: 0]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (275:9): [True: 0, False: 1]
  ------------------
  276|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (276:9): [True: 0, False: 1]
  ------------------
  277|      0|#endif
  278|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  279|      1|  } else
  280|      0|#endif
  281|      0|  {
  282|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (282:9): [True: 0, False: 0]
  ------------------
  283|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  284|      0|  }
  285|       |
  286|      1|  post = (my_post_ptr)
  287|      1|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|      1|                                sizeof(my_post_controller));
  289|      1|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|      1|  post->pub.start_pass = start_pass_dpost;
  291|      1|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|      1|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|      1|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 1]
  ------------------
  296|       |#if BITS_IN_JSAMPLE != 16
  297|       |    /* The buffer strip height is max_v_samp_factor, which is typically
  298|       |     * an efficient number of rows for upsampling to return.
  299|       |     * (In the presence of output rescaling, we might want to be smarter?)
  300|       |     */
  301|       |    post->strip_height = (JDIMENSION)cinfo->max_v_samp_factor;
  302|       |    if (need_full_buffer) {
  303|       |      /* Two-pass color quantization: need full-image storage. */
  304|       |      /* We round up the number of rows to a multiple of the strip height. */
  305|       |#ifdef QUANT_2PASS_SUPPORTED
  306|       |      post->whole_image = (*cinfo->mem->request_virt_sarray)
  307|       |        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  308|       |         cinfo->output_width * cinfo->out_color_components,
  309|       |         (JDIMENSION)jround_up((long)cinfo->output_height,
  310|       |                               (long)post->strip_height),
  311|       |         post->strip_height);
  312|       |#else
  313|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  314|       |#endif /* QUANT_2PASS_SUPPORTED */
  315|       |    } else {
  316|       |      /* One-pass color quantization: just make a strip buffer. */
  317|       |      post->buffer = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  318|       |        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  319|       |         cinfo->output_width * cinfo->out_color_components,
  320|       |         post->strip_height);
  321|       |    }
  322|       |#else
  323|      0|    ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  324|      0|#endif
  325|      0|  }
  326|      1|}

jinit_upsampler:
  438|    282|{
  439|    282|  my_upsample_ptr upsample;
  440|    282|  int ci;
  441|    282|  jpeg_component_info *compptr;
  442|    282|  boolean need_buffer, do_fancy;
  443|    282|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|    282|#ifdef D_LOSSLESS_SUPPORTED
  446|    282|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 2, False: 280]
  ------------------
  447|      2|#if BITS_IN_JSAMPLE == 8
  448|      2|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|      4|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 2]
  |  Branch (448:52): [True: 0, False: 2]
  ------------------
  449|       |#else
  450|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  451|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  452|       |#endif
  453|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  454|      2|  } else
  455|    280|#endif
  456|    280|  {
  457|    280|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    280|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 280]
  ------------------
  458|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|    280|  }
  460|       |
  461|    282|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 282, False: 0]
  ------------------
  462|    282|    upsample = (my_upsample_ptr)
  463|    282|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    282|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|    282|                                  sizeof(my_upsampler));
  465|    282|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|    282|    upsample->pub.start_pass = start_pass_upsample;
  467|    282|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|    282|#define _upsample  upsample
  ------------------
  468|    282|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    282|#define FALSE   0               /* values of boolean */
  ------------------
  469|    282|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|    282|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 282]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|       |
  475|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  476|       |   * so don't ask for it.
  477|       |   */
  478|    282|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    282|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 282, False: 0]
  |  Branch (478:44): [True: 280, False: 2]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|    564|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 282, False: 282]
  ------------------
  484|    282|       ci++, compptr++) {
  485|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  486|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  487|       |     */
  488|    282|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    282|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|    282|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    282|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|    282|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    282|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|    282|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    282|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|    282|    h_out_group = cinfo->max_h_samp_factor;
  493|    282|    v_out_group = cinfo->max_v_samp_factor;
  494|    282|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|    282|    need_buffer = TRUE;
  ------------------
  |  |  210|    282|#define TRUE    1
  ------------------
  496|    282|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 282]
  ------------------
  497|       |      /* Don't bother to upsample an uninteresting component. */
  498|      0|      upsample->methods[ci] = noop_upsample;
  499|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  500|    282|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 282, False: 0]
  |  Branch (500:45): [True: 282, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|    282|      upsample->methods[ci] = fullsize_upsample;
  503|    282|      need_buffer = FALSE;
  ------------------
  |  |  207|    282|#define FALSE   0               /* values of boolean */
  ------------------
  504|    282|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 0, False: 0]
  |  Branch (504:49): [True: 0, False: 0]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 0]
  |  Branch (506:23): [True: 0, False: 0]
  ------------------
  507|      0|#ifdef WITH_SIMD
  508|      0|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 0, False: 0]
  ------------------
  509|      0|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|      0|        else
  511|      0|#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      0|      } else {
  514|      0|#ifdef WITH_SIMD
  515|      0|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 0, False: 0]
  ------------------
  516|      0|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|      0|        else
  518|      0|#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|      0|      }
  521|      0|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 0, False: 0]
  ------------------
  522|      0|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 0, False: 0]
  |  Branch (522:49): [True: 0, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  531|      0|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 0, False: 0]
  ------------------
  532|      0|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 0, False: 0]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 0]
  |  Branch (534:23): [True: 0, False: 0]
  ------------------
  535|      0|#ifdef WITH_SIMD
  536|      0|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 0, False: 0]
  ------------------
  537|      0|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|      0|        else
  539|      0|#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|      0|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  542|      0|      } else {
  543|      0|#ifdef WITH_SIMD
  544|      0|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 0, False: 0]
  ------------------
  545|      0|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|      0|        else
  547|      0|#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|      0|      }
  550|      0|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 0, False: 0]
  ------------------
  551|      0|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 0, False: 0]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|      0|      upsample->methods[ci] = int_upsample;
  554|      0|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|      0|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|      0|    } else
  557|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|    282|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 0, False: 282]
  |  Branch (558:24): [True: 0, False: 0]
  ------------------
  559|      0|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|      0|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|      0|                               (long)cinfo->max_h_samp_factor),
  563|      0|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|      0|    }
  565|    282|  }
  566|    282|}
jdsample-8.c:start_pass_upsample:
   47|    257|{
   48|    257|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|    257|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|    257|  upsample->rows_to_go = cinfo->output_height;
   54|    257|}
jdsample-8.c:sep_upsample:
   70|  33.5k|{
   71|  33.5k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|  33.5k|  int ci;
   73|  33.5k|  jpeg_component_info *compptr;
   74|  33.5k|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|  33.5k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 16.8k, False: 16.7k]
  ------------------
   78|  33.6k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 16.8k, False: 16.8k]
  ------------------
   79|  16.8k|         ci++, compptr++) {
   80|       |      /* Invoke per-component upsample method.  Notice we pass a POINTER
   81|       |       * to color_buf[ci], so that fullsize_upsample can change it.
   82|       |       */
   83|       |#ifdef WITH_PROFILE
   84|       |      cinfo->master->start = getTime();
   85|       |#endif
   86|  16.8k|      (*upsample->methods[ci]) (cinfo, compptr,
   87|  16.8k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|  16.8k|        upsample->color_buf + ci);
   89|       |#ifdef WITH_PROFILE
   90|       |      cinfo->master->upsample_elapsed += getTime() - cinfo->master->start;
   91|       |      cinfo->master->upsample_msamples +=
   92|       |        (double)cinfo->output_width * cinfo->max_v_samp_factor / 1000000.;
   93|       |#endif
   94|  16.8k|    }
   95|  16.8k|    upsample->next_row_out = 0;
   96|  16.8k|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|  33.5k|  num_rows = (JDIMENSION)(cinfo->max_v_samp_factor - upsample->next_row_out);
  102|       |  /* Not more than the distance to the end of the image.  Need this test
  103|       |   * in case the image height is not a multiple of max_v_samp_factor:
  104|       |   */
  105|  33.5k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 21, False: 33.5k]
  ------------------
  106|     21|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|  33.5k|  out_rows_avail -= *out_row_ctr;
  109|  33.5k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 16.7k, False: 16.8k]
  ------------------
  110|  16.7k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|  33.5k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|  33.5k|#define _color_convert  color_convert
  ------------------
  116|  33.5k|                                      (JDIMENSION)upsample->next_row_out,
  117|  33.5k|                                      output_buf + *out_row_ctr,
  118|  33.5k|                                      (int)num_rows);
  119|       |#ifdef WITH_PROFILE
  120|       |  cinfo->master->cconvert_elapsed += getTime() - cinfo->master->start;
  121|       |  cinfo->master->cconvert_mpixels +=
  122|       |    (double)cinfo->output_width * num_rows / 1000000.;
  123|       |#endif
  124|       |
  125|       |  /* Adjust counts */
  126|  33.5k|  *out_row_ctr += num_rows;
  127|  33.5k|  upsample->rows_to_go -= num_rows;
  128|  33.5k|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|  33.5k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 16.7k, False: 16.8k]
  ------------------
  131|  16.7k|    (*in_row_group_ctr)++;
  132|  33.5k|}
jdsample-8.c:fullsize_upsample:
  151|  16.8k|{
  152|  16.8k|  *output_data_ptr = input_data;
  153|  16.8k|}
j12init_upsampler:
  438|      4|{
  439|      4|  my_upsample_ptr upsample;
  440|      4|  int ci;
  441|      4|  jpeg_component_info *compptr;
  442|      4|  boolean need_buffer, do_fancy;
  443|      4|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|      4|#ifdef D_LOSSLESS_SUPPORTED
  446|      4|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 1, False: 3]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 1]
  ------------------
  451|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 1]
  ------------------
  452|      0|#endif
  453|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  454|      1|  } else
  455|      3|#endif
  456|      3|  {
  457|      3|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      3|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 3]
  ------------------
  458|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|      3|  }
  460|       |
  461|      4|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 4, False: 0]
  ------------------
  462|      4|    upsample = (my_upsample_ptr)
  463|      4|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|      4|                                  sizeof(my_upsampler));
  465|      4|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|      4|    upsample->pub.start_pass = start_pass_upsample;
  467|      4|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|      4|#define _upsample  upsample_12
  ------------------
  468|      4|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  469|      4|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|      4|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 4]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|       |
  475|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  476|       |   * so don't ask for it.
  477|       |   */
  478|      4|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 4, False: 0]
  |  Branch (478:44): [True: 3, False: 1]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|      8|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 4, False: 4]
  ------------------
  484|      4|       ci++, compptr++) {
  485|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  486|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  487|       |     */
  488|      4|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      4|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|      4|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|      4|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      4|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|      4|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|      4|    h_out_group = cinfo->max_h_samp_factor;
  493|      4|    v_out_group = cinfo->max_v_samp_factor;
  494|      4|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|      4|    need_buffer = TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
  496|      4|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 4]
  ------------------
  497|       |      /* Don't bother to upsample an uninteresting component. */
  498|      0|      upsample->methods[ci] = noop_upsample;
  499|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  500|      4|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 4, False: 0]
  |  Branch (500:45): [True: 4, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|      4|      upsample->methods[ci] = fullsize_upsample;
  503|      4|      need_buffer = FALSE;
  ------------------
  |  |  207|      4|#define FALSE   0               /* values of boolean */
  ------------------
  504|      4|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 0, False: 0]
  |  Branch (504:49): [True: 0, False: 0]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 0]
  |  Branch (506:23): [True: 0, False: 0]
  ------------------
  507|       |#ifdef WITH_SIMD
  508|       |        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  509|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|       |        else
  511|       |#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      0|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|      0|      }
  521|      0|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 0, False: 0]
  ------------------
  522|      0|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 0, False: 0]
  |  Branch (522:49): [True: 0, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  531|      0|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 0, False: 0]
  ------------------
  532|      0|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 0, False: 0]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 0]
  |  Branch (534:23): [True: 0, False: 0]
  ------------------
  535|       |#ifdef WITH_SIMD
  536|       |        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  537|       |          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|       |        else
  539|       |#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|      0|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  542|      0|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|      0|      }
  550|      0|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 0, False: 0]
  ------------------
  551|      0|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 0, False: 0]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|      0|      upsample->methods[ci] = int_upsample;
  554|      0|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|      0|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|      0|    } else
  557|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|      4|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 0, False: 4]
  |  Branch (558:24): [True: 0, False: 0]
  ------------------
  559|      0|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|      0|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|      0|                               (long)cinfo->max_h_samp_factor),
  563|      0|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|      0|    }
  565|      4|  }
  566|      4|}
jdsample-12.c:start_pass_upsample:
   47|      1|{
   48|      1|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|      1|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|      1|  upsample->rows_to_go = cinfo->output_height;
   54|      1|}
j16init_upsampler:
  438|      1|{
  439|      1|  my_upsample_ptr upsample;
  440|      1|  int ci;
  441|      1|  jpeg_component_info *compptr;
  442|      1|  boolean need_buffer, do_fancy;
  443|      1|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|      1|#ifdef D_LOSSLESS_SUPPORTED
  446|      1|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 1, False: 0]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|      1|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|      2|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (450:9): [True: 0, False: 1]
  ------------------
  451|      1|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|      1|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (451:9): [True: 0, False: 1]
  ------------------
  452|      0|#endif
  453|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  454|      1|  } else
  455|      0|#endif
  456|      0|  {
  457|      0|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|      0|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (457:9): [True: 0, False: 0]
  ------------------
  458|      0|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  459|      0|  }
  460|       |
  461|      1|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 1, False: 0]
  ------------------
  462|      1|    upsample = (my_upsample_ptr)
  463|      1|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      1|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|      1|                                  sizeof(my_upsampler));
  465|      1|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|      1|    upsample->pub.start_pass = start_pass_upsample;
  467|      1|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |   57|      1|#define _upsample  upsample_16
  ------------------
  468|      1|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  469|      1|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|      1|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 1]
  ------------------
  473|      0|    ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  474|       |
  475|       |  /* jdmainct.c doesn't support context rows when min_DCT_scaled_size = 1,
  476|       |   * so don't ask for it.
  477|       |   */
  478|      1|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|      1|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 1, False: 0]
  |  Branch (478:44): [True: 0, False: 1]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|      2|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 1, False: 1]
  ------------------
  484|      1|       ci++, compptr++) {
  485|       |    /* Compute size of an "input group" after IDCT scaling.  This many samples
  486|       |     * are to be converted to max_h_samp_factor * max_v_samp_factor components.
  487|       |     */
  488|      1|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      1|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|      1|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      1|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|      1|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|      1|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|      1|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      1|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|      1|    h_out_group = cinfo->max_h_samp_factor;
  493|      1|    v_out_group = cinfo->max_v_samp_factor;
  494|      1|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|      1|    need_buffer = TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  496|      1|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 1]
  ------------------
  497|       |      /* Don't bother to upsample an uninteresting component. */
  498|      0|      upsample->methods[ci] = noop_upsample;
  499|      0|      need_buffer = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  500|      1|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 1, False: 0]
  |  Branch (500:45): [True: 1, False: 0]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|      1|      upsample->methods[ci] = fullsize_upsample;
  503|      1|      need_buffer = FALSE;
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  504|      1|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 0, False: 0]
  |  Branch (504:49): [True: 0, False: 0]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 0]
  |  Branch (506:23): [True: 0, False: 0]
  ------------------
  507|       |#ifdef WITH_SIMD
  508|       |        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  509|       |          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|       |        else
  511|       |#endif
  512|      0|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      0|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      0|          upsample->methods[ci] = h2v1_upsample;
  520|      0|      }
  521|      0|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 0, False: 0]
  ------------------
  522|      0|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 0, False: 0]
  |  Branch (522:49): [True: 0, False: 0]
  ------------------
  523|       |      /* Non-fancy upsampling is handled by the generic method */
  524|       |#if defined(WITH_SIMD) && (SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM)
  525|       |      if (jsimd_set_h1v2_fancy_upsample(cinfo))
  526|       |        upsample->methods[ci] = jsimd_h1v2_fancy_upsample;
  527|       |      else
  528|       |#endif
  529|      0|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      0|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  531|      0|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 0, False: 0]
  ------------------
  532|      0|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 0, False: 0]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      0|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 0]
  |  Branch (534:23): [True: 0, False: 0]
  ------------------
  535|       |#ifdef WITH_SIMD
  536|       |        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  537|       |          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|       |        else
  539|       |#endif
  540|      0|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|      0|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  542|      0|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      0|          upsample->methods[ci] = h2v2_upsample;
  549|      0|      }
  550|      0|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 0, False: 0]
  ------------------
  551|      0|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 0, False: 0]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|      0|      upsample->methods[ci] = int_upsample;
  554|      0|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|      0|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|      0|    } else
  557|      0|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|      1|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 0, False: 1]
  |  Branch (558:24): [True: 0, False: 0]
  ------------------
  559|      0|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|      0|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|      0|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|      0|                               (long)cinfo->max_h_samp_factor),
  563|      0|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|      0|    }
  565|      1|  }
  566|      1|}

jpeg_std_error:
  229|  1.00k|{
  230|  1.00k|  memset(err, 0, sizeof(struct jpeg_error_mgr));
  231|       |
  232|  1.00k|  err->error_exit = error_exit;
  233|  1.00k|  err->emit_message = emit_message;
  234|  1.00k|  err->output_message = output_message;
  235|  1.00k|  err->format_message = format_message;
  236|  1.00k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|       |  /* Initialize message table pointers */
  239|  1.00k|  err->jpeg_message_table = jpeg_std_message_table;
  240|  1.00k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  241|       |
  242|  1.00k|  return err;
  243|  1.00k|}
jerror.c:format_message:
  155|    133|{
  156|    133|  struct jpeg_error_mgr *err = cinfo->err;
  157|    133|  int msg_code = err->msg_code;
  158|    133|  const char *msgtext = NULL;
  159|    133|  const char *msgptr;
  160|    133|  char ch;
  161|    133|  boolean isstring;
  162|       |
  163|       |  /* Look up message string in proper table */
  164|    133|  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
  ------------------
  |  Branch (164:7): [True: 133, False: 0]
  |  Branch (164:23): [True: 133, False: 0]
  ------------------
  165|    133|    msgtext = err->jpeg_message_table[msg_code];
  166|    133|  } else if (err->addon_message_table != NULL &&
  ------------------
  |  Branch (166:14): [True: 0, False: 0]
  ------------------
  167|      0|             msg_code >= err->first_addon_message &&
  ------------------
  |  Branch (167:14): [True: 0, False: 0]
  ------------------
  168|      0|             msg_code <= err->last_addon_message) {
  ------------------
  |  Branch (168:14): [True: 0, False: 0]
  ------------------
  169|      0|    msgtext = err->addon_message_table[msg_code - err->first_addon_message];
  170|      0|  }
  171|       |
  172|       |  /* Defend against bogus message number */
  173|    133|  if (msgtext == NULL) {
  ------------------
  |  Branch (173:7): [True: 0, False: 133]
  ------------------
  174|      0|    err->msg_parm.i[0] = msg_code;
  175|      0|    msgtext = err->jpeg_message_table[0];
  176|      0|  }
  177|       |
  178|       |  /* Check for string parameter, as indicated by %s in the message text */
  179|    133|  isstring = FALSE;
  ------------------
  |  |  207|    133|#define FALSE   0               /* values of boolean */
  ------------------
  180|    133|  msgptr = msgtext;
  181|  3.68k|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (181:10): [True: 3.61k, False: 67]
  ------------------
  182|  3.61k|    if (ch == '%') {
  ------------------
  |  Branch (182:9): [True: 66, False: 3.54k]
  ------------------
  183|     66|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (183:11): [True: 0, False: 66]
  ------------------
  184|     66|      break;
  185|     66|    }
  186|  3.61k|  }
  187|       |
  188|       |  /* Format the message into the passed buffer */
  189|    133|  if (isstring)
  ------------------
  |  Branch (189:7): [True: 0, False: 133]
  ------------------
  190|      0|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |   55|      0|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext, err->msg_parm.s);
  ------------------
  |  |  792|      0|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  191|    133|  else
  192|    133|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |   55|    133|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |  792|    133|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  193|    133|             err->msg_parm.i[0], err->msg_parm.i[1],
  194|    133|             err->msg_parm.i[2], err->msg_parm.i[3],
  195|    133|             err->msg_parm.i[4], err->msg_parm.i[5],
  196|    133|             err->msg_parm.i[6], err->msg_parm.i[7]);
  197|    133|}
jerror.c:reset_error_mgr:
  210|    504|{
  211|    504|  cinfo->err->num_warnings = 0;
  212|       |  /* trace_level is not reset since it is an application-supplied parameter */
  213|    504|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  214|    504|}

jpeg_idct_islow:
  198|   203k|{
  199|   203k|  JLONG tmp0, tmp1, tmp2, tmp3;
  200|   203k|  JLONG tmp10, tmp11, tmp12, tmp13;
  201|   203k|  JLONG z1, z2, z3, z4, z5;
  202|   203k|  JCOEFPTR inptr;
  203|   203k|  ISLOW_MULT_TYPE *quantptr;
  204|   203k|  int *wsptr;
  205|   203k|  _JSAMPROW outptr;
  ------------------
  |  |  229|   203k|#define _JSAMPROW  JSAMPROW
  ------------------
  206|   203k|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  224|   203k|#define _JSAMPLE  JSAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   95|   203k|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  227|   203k|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|   203k|#define CENTERJSAMPLE    128
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|   203k|  int ctr;
  208|   203k|  int workspace[DCTSIZE2];      /* buffers data between passes */
  209|       |  SHIFT_TEMPS
  210|       |  SCALING_FACTOR
  211|       |
  212|       |  /* Pass 1: process columns from input, store into work array. */
  213|       |  /* Note results are scaled up by sqrt(8) compared to a true IDCT; */
  214|       |  /* furthermore, we scale the results by 2**PASS1_BITS. */
  215|       |
  216|   203k|  inptr = coef_block;
  217|   203k|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  218|   203k|  wsptr = workspace;
  219|  1.82M|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|   203k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (219:23): [True: 1.62M, False: 203k]
  ------------------
  220|       |    /* Due to quantization, we will usually find that many of the input
  221|       |     * coefficients are zero, especially the AC terms.  We can exploit this
  222|       |     * by short-circuiting the IDCT calculation for any column in which all
  223|       |     * the AC terms are zero.  In that case each output is equal to the
  224|       |     * DC coefficient (with scale factor as needed).
  225|       |     * With typical images and quantization tables, half or more of the
  226|       |     * column DCT calculations can be simplified this way.
  227|       |     */
  228|       |
  229|  1.62M|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  1.62M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  1.28M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (229:9): [True: 1.28M, False: 341k]
  |  Branch (229:36): [True: 1.25M, False: 29.8k]
  ------------------
  230|  1.25M|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  1.25M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  1.23M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (230:9): [True: 1.23M, False: 19.0k]
  |  Branch (230:36): [True: 1.20M, False: 29.2k]
  ------------------
  231|  1.20M|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  1.20M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  1.19M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (231:9): [True: 1.19M, False: 14.0k]
  |  Branch (231:36): [True: 1.16M, False: 23.3k]
  ------------------
  232|  1.16M|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|  1.16M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (232:9): [True: 1.15M, False: 12.8k]
  ------------------
  233|       |      /* AC terms all zero */
  234|  1.15M|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|  1.15M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  235|  1.15M|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  236|       |
  237|  1.15M|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  238|  1.15M|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  239|  1.15M|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  240|  1.15M|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  241|  1.15M|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  242|  1.15M|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  243|  1.15M|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  244|  1.15M|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|  1.15M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  245|       |
  246|  1.15M|      inptr++;                  /* advance pointers to next column */
  247|  1.15M|      quantptr++;
  248|  1.15M|      wsptr++;
  249|  1.15M|      continue;
  250|  1.15M|    }
  251|       |
  252|       |    /* Even part: reverse the even part of the forward DCT. */
  253|       |    /* The rotator is sqrt(2)*c(-6). */
  254|       |
  255|   469k|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  256|   469k|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  257|       |
  258|   469k|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  259|   469k|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  260|   469k|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  261|       |
  262|   469k|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  263|   469k|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  264|       |
  265|   469k|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|   469k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  266|   469k|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|   469k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  267|       |
  268|   469k|    tmp10 = tmp0 + tmp3;
  269|   469k|    tmp13 = tmp0 - tmp3;
  270|   469k|    tmp11 = tmp1 + tmp2;
  271|   469k|    tmp12 = tmp1 - tmp2;
  272|       |
  273|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  274|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  275|       |     */
  276|       |
  277|   469k|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  278|   469k|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  279|   469k|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  280|   469k|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  183|   469k|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  281|       |
  282|   469k|    z1 = tmp0 + tmp3;
  283|   469k|    z2 = tmp1 + tmp2;
  284|   469k|    z3 = tmp0 + tmp2;
  285|   469k|    z4 = tmp1 + tmp3;
  286|   469k|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  287|       |
  288|   469k|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  289|   469k|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  290|   469k|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  291|   469k|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  292|   469k|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  293|   469k|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  294|   469k|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  295|   469k|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|   469k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   469k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  296|       |
  297|   469k|    z3 += z5;
  298|   469k|    z4 += z5;
  299|       |
  300|   469k|    tmp0 += z1 + z3;
  301|   469k|    tmp1 += z2 + z4;
  302|   469k|    tmp2 += z2 + z3;
  303|   469k|    tmp3 += z1 + z4;
  304|       |
  305|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  306|       |
  307|   469k|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  308|   469k|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  309|   469k|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  310|   469k|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  311|   469k|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  312|   469k|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  313|   469k|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  314|   469k|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|   469k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|   469k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   469k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  315|       |
  316|   469k|    inptr++;                    /* advance pointers to next column */
  317|   469k|    quantptr++;
  318|   469k|    wsptr++;
  319|   469k|  }
  320|       |
  321|       |  /* Pass 2: process rows from work array, store into output array. */
  322|       |  /* Note that we must descale the results by a factor of 8 == 2**3, */
  323|       |  /* and also undo the PASS1_BITS scaling. */
  324|       |
  325|   203k|  wsptr = workspace;
  326|  1.82M|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|  1.82M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (326:17): [True: 1.62M, False: 203k]
  ------------------
  327|  1.62M|    outptr = output_buf[ctr] + output_col;
  328|       |    /* Rows of zeroes can be exploited in the same way as we did with columns.
  329|       |     * However, the column calculation has created many nonzero AC terms, so
  330|       |     * the simplification applies less often (typically 5% to 10% of the time).
  331|       |     * On machines with very fast multiplication, it's possible that the
  332|       |     * test takes more time than it's worth.  In that case this section
  333|       |     * may be commented out.
  334|       |     */
  335|       |
  336|  1.62M|#ifndef NO_ZERO_ROW_TEST
  337|  1.62M|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (337:9): [True: 979k, False: 645k]
  |  Branch (337:26): [True: 830k, False: 149k]
  |  Branch (337:43): [True: 813k, False: 16.4k]
  |  Branch (337:60): [True: 804k, False: 9.17k]
  ------------------
  338|   804k|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (338:9): [True: 792k, False: 12.4k]
  |  Branch (338:26): [True: 791k, False: 857]
  |  Branch (338:43): [True: 790k, False: 357]
  ------------------
  339|       |      /* AC terms all zero */
  340|   790k|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  224|   790k|#define _JSAMPLE  JSAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  216|   790k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   790k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  341|   790k|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   97|   790k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   790k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   790k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|       |
  343|   790k|      outptr[0] = dcval;
  344|   790k|      outptr[1] = dcval;
  345|   790k|      outptr[2] = dcval;
  346|   790k|      outptr[3] = dcval;
  347|   790k|      outptr[4] = dcval;
  348|   790k|      outptr[5] = dcval;
  349|   790k|      outptr[6] = dcval;
  350|   790k|      outptr[7] = dcval;
  351|       |
  352|   790k|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|   790k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  353|   790k|      continue;
  354|   790k|    }
  355|   834k|#endif
  356|       |
  357|       |    /* Even part: reverse the even part of the forward DCT. */
  358|       |    /* The rotator is sqrt(2)*c(-6). */
  359|       |
  360|   834k|    z2 = (JLONG)wsptr[2];
  361|   834k|    z3 = (JLONG)wsptr[6];
  362|       |
  363|   834k|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  364|   834k|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  365|   834k|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  366|       |
  367|   834k|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|   834k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  368|   834k|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|   834k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  369|       |
  370|   834k|    tmp10 = tmp0 + tmp3;
  371|   834k|    tmp13 = tmp0 - tmp3;
  372|   834k|    tmp11 = tmp1 + tmp2;
  373|   834k|    tmp12 = tmp1 - tmp2;
  374|       |
  375|       |    /* Odd part per figure 8; the matrix is unitary and hence its
  376|       |     * transpose is its inverse.  i0..i3 are y7,y5,y3,y1 respectively.
  377|       |     */
  378|       |
  379|   834k|    tmp0 = (JLONG)wsptr[7];
  380|   834k|    tmp1 = (JLONG)wsptr[5];
  381|   834k|    tmp2 = (JLONG)wsptr[3];
  382|   834k|    tmp3 = (JLONG)wsptr[1];
  383|       |
  384|   834k|    z1 = tmp0 + tmp3;
  385|   834k|    z2 = tmp1 + tmp2;
  386|   834k|    z3 = tmp0 + tmp2;
  387|   834k|    z4 = tmp1 + tmp3;
  388|   834k|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  389|       |
  390|   834k|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  391|   834k|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  392|   834k|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  393|   834k|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  394|   834k|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  395|   834k|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  396|   834k|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  397|   834k|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|   834k|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|   834k|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  398|       |
  399|   834k|    z3 += z5;
  400|   834k|    z4 += z5;
  401|       |
  402|   834k|    tmp0 += z1 + z3;
  403|   834k|    tmp1 += z2 + z4;
  404|   834k|    tmp2 += z2 + z3;
  405|   834k|    tmp3 += z1 + z4;
  406|       |
  407|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  408|       |
  409|   834k|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  410|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  411|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|   834k|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  413|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  414|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|   834k|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  416|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  417|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|   834k|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  419|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  420|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  421|   834k|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  422|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  423|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  424|   834k|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  425|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  426|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|   834k|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  428|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  429|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  430|   834k|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  216|   834k|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|   834k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  431|   834k|                                         CONST_BITS + PASS1_BITS + 3) &
  432|   834k|                            RANGE_MASK];
  ------------------
  |  |   97|   834k|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|   834k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|   834k|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|       |
  434|   834k|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|   834k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  435|   834k|  }
  436|   203k|}

jmemmgr.c:GETENV_S:
   80|    504|{
   81|    504|  char *env;
   82|       |
   83|    504|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 504]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|    504|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 504]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|    504|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 504]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|    504|  env = getenv(name);
   97|    504|  if (!env)
  ------------------
  |  Branch (97:7): [True: 504, False: 0]
  ------------------
   98|    504|  {
   99|    504|    *buffer = 0;
  100|    504|    return 0;
  101|    504|  }
  102|       |
  103|      0|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 0]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|      0|  strncpy(buffer, env, buffer_size);
  109|       |
  110|      0|  return 0;
  111|      0|}
jsimd.c:GETENV_S:
   80|    771|{
   81|    771|  char *env;
   82|       |
   83|    771|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 771]
  ------------------
   84|      0|    if (buffer_size == 0)
  ------------------
  |  Branch (84:9): [True: 0, False: 0]
  ------------------
   85|      0|      return 0;
   86|      0|    else
   87|      0|      return (errno = EINVAL);
   88|      0|  }
   89|    771|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 771]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|    771|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 771]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|    771|  env = getenv(name);
   97|    771|  if (!env)
  ------------------
  |  Branch (97:7): [True: 514, False: 257]
  ------------------
   98|    514|  {
   99|    514|    *buffer = 0;
  100|    514|    return 0;
  101|    514|  }
  102|       |
  103|    257|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 257]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|    257|  strncpy(buffer, env, buffer_size);
  109|       |
  110|    257|  return 0;
  111|    257|}

jinit_memory_mgr:
 1196|    504|{
 1197|    504|  my_mem_ptr mem;
 1198|    504|  long max_to_use;
 1199|    504|  int pool;
 1200|    504|  size_t test_mac;
 1201|       |
 1202|    504|  cinfo->mem = NULL;            /* for safety if init fails */
 1203|       |
 1204|       |  /* Check for configuration errors.
 1205|       |   * sizeof(ALIGN_TYPE) should be a power of 2; otherwise, it probably
 1206|       |   * doesn't reflect any real hardware alignment requirement.
 1207|       |   * The test is a little tricky: for X>0, X and X-1 have no one-bits
 1208|       |   * in common if and only if X is a power of 2, ie has only one one-bit.
 1209|       |   * Some compilers may give an "unreachable code" warning here; ignore it.
 1210|       |   */
 1211|    504|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|    504|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|    504|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 504]
  ------------------
 1212|      0|    ERREXIT(cinfo, JERR_BAD_ALIGN_TYPE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1213|       |  /* MAX_ALLOC_CHUNK must be representable as type size_t, and must be
 1214|       |   * a multiple of ALIGN_SIZE.
 1215|       |   * Again, an "unreachable code" warning may be ignored here.
 1216|       |   * But a "constant too large" warning means you need to fix MAX_ALLOC_CHUNK.
 1217|       |   */
 1218|    504|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|    504|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|    504|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  1.00k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 504]
  ------------------
 1220|    504|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|    504|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|    504|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1220:7): [Folded, False: 0]
  ------------------
 1221|      0|    ERREXIT(cinfo, JERR_BAD_ALLOC_CHUNK);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1222|       |
 1223|    504|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|    504|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|    504|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 504]
  ------------------
 1229|      0|    jpeg_mem_term(cinfo);       /* system-dependent cleanup */
 1230|      0|    ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 0);
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1231|      0|  }
 1232|       |
 1233|       |  /* OK, fill in the method pointers */
 1234|    504|  mem->pub.alloc_small = alloc_small;
 1235|    504|  mem->pub.alloc_large = alloc_large;
 1236|    504|  mem->pub.alloc_sarray = alloc_sarray;
 1237|    504|  mem->pub.alloc_barray = alloc_barray;
 1238|    504|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|    504|  mem->pub.request_virt_barray = request_virt_barray;
 1240|    504|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|    504|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|    504|  mem->pub.access_virt_barray = access_virt_barray;
 1243|    504|  mem->pub.free_pool = free_pool;
 1244|    504|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|    504|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|    504|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|    504|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|  1.51k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|    504|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  1.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 1.00k, False: 504]
  ------------------
 1253|  1.00k|    mem->small_list[pool] = NULL;
 1254|  1.00k|    mem->large_list[pool] = NULL;
 1255|  1.00k|  }
 1256|    504|  mem->virt_sarray_list = NULL;
 1257|    504|  mem->virt_barray_list = NULL;
 1258|       |
 1259|    504|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|    504|  cinfo->mem = &mem->pub;
 1263|       |
 1264|       |  /* Check for an environment variable JPEGMEM; if found, override the
 1265|       |   * default max_memory setting from jpeg_mem_init.  Note that the
 1266|       |   * surrounding application may again override this value.
 1267|       |   * If your system doesn't support getenv(), define NO_GETENV to disable
 1268|       |   * this feature.
 1269|       |   */
 1270|    504|#ifndef NO_GETENV
 1271|    504|  {
 1272|    504|    char memenv[30] = { 0 };
 1273|       |
 1274|    504|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 504, False: 0]
  |  Branch (1274:45): [True: 0, False: 504]
  ------------------
 1275|      0|      char ch = 'x';
 1276|       |
 1277|       |#ifdef _MSC_VER
 1278|       |      if (sscanf_s(memenv, "%ld%c", &max_to_use, &ch, 1) > 0) {
 1279|       |#else
 1280|      0|      if (sscanf(memenv, "%ld%c", &max_to_use, &ch) > 0) {
  ------------------
  |  Branch (1280:11): [True: 0, False: 0]
  ------------------
 1281|      0|#endif
 1282|      0|        if (ch == 'm' || ch == 'M')
  ------------------
  |  Branch (1282:13): [True: 0, False: 0]
  |  Branch (1282:26): [True: 0, False: 0]
  ------------------
 1283|      0|          max_to_use *= 1000L;
 1284|      0|        mem->pub.max_memory_to_use = max_to_use * 1000L;
 1285|      0|      }
 1286|      0|    }
 1287|    504|  }
 1288|    504|#endif
 1289|       |
 1290|    504|}
jmemmgr.c:alloc_small:
  269|  8.13k|{
  270|  8.13k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|  8.13k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|  8.13k|  char *data_ptr;
  273|  8.13k|  size_t min_request, slop;
  274|       |
  275|       |  /*
  276|       |   * Round up the requested size to a multiple of ALIGN_SIZE in order
  277|       |   * to assure alignment for the next object allocated in the same pool
  278|       |   * and so that algorithms can straddle outside the proper area up
  279|       |   * to the next alignment.
  280|       |   */
  281|  8.13k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  8.13k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 8.13k]
  ------------------
  282|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  283|       |       is close to SIZE_MAX. */
  284|      0|    out_of_memory(cinfo, 7);
  285|      0|  }
  286|  8.13k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  8.13k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  287|       |
  288|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  289|  8.13k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  8.13k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 8.13k]
  ------------------
  290|  8.13k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  8.13k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  291|      0|    out_of_memory(cinfo, 1);    /* request exceeds malloc's ability */
  292|       |
  293|       |  /* See if space is available in any existing pool */
  294|  8.13k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  8.13k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 8.13k]
  |  Branch (294:22): [True: 0, False: 8.13k]
  ------------------
  295|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  296|  8.13k|  prev_hdr_ptr = NULL;
  297|  8.13k|  hdr_ptr = mem->small_list[pool_id];
  298|  8.42k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 7.30k, False: 1.11k]
  ------------------
  299|  7.30k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 7.02k, False: 285]
  ------------------
  300|  7.02k|      break;                    /* found pool with enough space */
  301|    285|    prev_hdr_ptr = hdr_ptr;
  302|    285|    hdr_ptr = hdr_ptr->next;
  303|    285|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|  8.13k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 1.11k, False: 7.02k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|  1.11k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  1.11k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|  1.11k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 831, False: 284]
  ------------------
  310|    831|      slop = first_pool_slop[pool_id];
  311|    284|    else
  312|    284|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|  1.11k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  1.11k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 1.11k]
  ------------------
  315|      0|      slop = (size_t)(MAX_ALLOC_CHUNK - min_request);
  ------------------
  |  |   62|      0|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  316|       |    /* Try to get space, if fail reduce slop and try again */
  317|  1.11k|    for (;;) {
  318|  1.11k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|  1.11k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 1.11k, False: 0]
  ------------------
  320|  1.11k|        break;
  321|      0|      slop /= 2;
  322|      0|      if (slop < MIN_SLOP)      /* give up when it gets real small */
  ------------------
  |  |  263|      0|#define MIN_SLOP  50            /* greater than 0 to avoid futile looping */
  ------------------
  |  Branch (322:11): [True: 0, False: 0]
  ------------------
  323|      0|        out_of_memory(cinfo, 2); /* jpeg_get_small failed */
  324|      0|    }
  325|  1.11k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|  1.11k|    hdr_ptr->next = NULL;
  328|  1.11k|    hdr_ptr->bytes_used = 0;
  329|  1.11k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|  1.11k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 831, False: 284]
  ------------------
  331|    831|      mem->small_list[pool_id] = hdr_ptr;
  332|    284|    else
  333|    284|      prev_hdr_ptr->next = hdr_ptr;
  334|  1.11k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|  8.13k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|  8.13k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|  8.13k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  8.13k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 8.13k, False: 0]
  ------------------
  340|  8.13k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  8.13k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  8.13k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|  8.13k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|  8.13k|  hdr_ptr->bytes_used += sizeofobject;
  343|  8.13k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|  8.13k|  return (void *)data_ptr;
  346|  8.13k|}
jmemmgr.c:round_up_pow2:
   45|  9.57k|{
   46|  9.57k|  return ((a + b - 1) & (~(b - 1)));
   47|  9.57k|}
jmemmgr.c:alloc_large:
  366|    862|{
  367|    862|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|    862|  large_pool_ptr hdr_ptr;
  369|    862|  char *data_ptr;
  370|       |
  371|       |  /*
  372|       |   * Round up the requested size to a multiple of ALIGN_SIZE so that
  373|       |   * algorithms can straddle outside the proper area up to the next
  374|       |   * alignment.
  375|       |   */
  376|    862|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|    862|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 862]
  ------------------
  377|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  378|       |       is close to SIZE_MAX. */
  379|      0|    out_of_memory(cinfo, 8);
  380|      0|  }
  381|    862|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  382|       |
  383|       |  /* Check for unsatisfiable request (do now to ensure no overflow below) */
  384|    862|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 862]
  ------------------
  385|    862|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|    862|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  386|      0|    out_of_memory(cinfo, 3);    /* request exceeds malloc's ability */
  387|       |
  388|       |  /* Always make a new pool */
  389|    862|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|    862|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 862]
  |  Branch (389:22): [True: 0, False: 862]
  ------------------
  390|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  391|       |
  392|    862|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|    862|                                           sizeof(large_pool_hdr) +
  394|    862|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|    862|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 862]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|    862|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|    862|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  399|       |
  400|       |  /* Success, initialize the new pool header and add to list */
  401|    862|  hdr_ptr->next = mem->large_list[pool_id];
  402|       |  /* We maintain space counts in each pool header for statistical purposes,
  403|       |   * even though they are not needed for allocation.
  404|       |   */
  405|    862|  hdr_ptr->bytes_used = sizeofobject;
  406|    862|  hdr_ptr->bytes_left = 0;
  407|    862|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|    862|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|    862|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|    862|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 862, False: 0]
  ------------------
  412|    862|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|    862|  return (void *)data_ptr;
  415|    862|}
jmemmgr.c:alloc_sarray:
  438|    579|{
  439|    579|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|    579|  JSAMPARRAY result;
  441|    579|  JSAMPROW workspace;
  442|    579|  JDIMENSION rowsperchunk, currow, i;
  443|    579|  long ltemp;
  444|    579|  J12SAMPARRAY result12;
  445|    579|  J12SAMPROW workspace12;
  446|    579|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|    579|  J16SAMPARRAY result16;
  448|    579|  J16SAMPROW workspace16;
  449|    579|#endif
  450|    579|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 579, False: 0]
  ------------------
  451|    579|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|    579|                        ((j_compress_ptr)cinfo)->data_precision;
  453|    579|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 4, False: 575]
  ------------------
  454|    575|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 10, False: 565]
  ------------------
  455|     10|                                            sizeof(J12SAMPLE) :
  456|    575|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|    579|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|    579|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 579]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|    579|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|    579|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 579]
  ------------------
  463|       |    /* This prevents overflow/wrap-around in round_up_pow2() if sizeofobject
  464|       |       is close to SIZE_MAX. */
  465|      0|    out_of_memory(cinfo, 9);
  466|      0|  }
  467|    579|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|    579|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|    579|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|    579|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|    579|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|    579|          ((long)samplesperrow * (long)sample_size);
  473|    579|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 579]
  ------------------
  474|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  475|    579|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 579]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|    579|  else
  478|    579|    rowsperchunk = numrows;
  479|    579|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|    579|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 565, False: 14]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|    565|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|    565|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|    565|    currow = 0;
  488|  1.13k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 565, False: 565]
  ------------------
  489|    565|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    565|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 565]
  |  |  ------------------
  ------------------
  490|    565|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|    565|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  5.32k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 4.76k, False: 565]
  ------------------
  493|  4.76k|        result[currow++] = workspace;
  494|  4.76k|        workspace += samplesperrow;
  495|  4.76k|      }
  496|    565|    }
  497|       |
  498|    565|    return result;
  499|    565|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 10, False: 4]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|     10|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|     10|                                         (size_t)(numrows *
  503|     10|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|     10|    currow = 0;
  507|     20|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 10, False: 10]
  ------------------
  508|     10|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|     10|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 10]
  |  |  ------------------
  ------------------
  509|     10|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|     10|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|     60|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 50, False: 10]
  ------------------
  512|     50|        result12[currow++] = workspace12;
  513|     50|        workspace12 += samplesperrow;
  514|     50|      }
  515|     10|    }
  516|       |
  517|     10|    return (JSAMPARRAY)result12;
  518|     10|  } else {
  519|      4|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|      4|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|      4|                                         (size_t)(numrows *
  523|      4|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|      4|    currow = 0;
  527|      8|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 4, False: 4]
  ------------------
  528|      4|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|      4|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  529|      4|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|      4|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|     11|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 7, False: 4]
  ------------------
  532|      7|        result16[currow++] = workspace16;
  533|      7|        workspace16 += samplesperrow;
  534|      7|      }
  535|      4|    }
  536|       |
  537|      4|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|      4|  }
  543|    579|}
jmemmgr.c:alloc_barray:
  555|      2|{
  556|      2|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|      2|  JBLOCKARRAY result;
  558|      2|  JBLOCKROW workspace;
  559|      2|  JDIMENSION rowsperchunk, currow, i;
  560|      2|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|      2|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|      2|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [Folded, False: 2]
  ------------------
  564|      0|    out_of_memory(cinfo, 6);    /* safety check */
  565|       |
  566|       |  /* Calculate max # of rows allowed in one allocation chunk */
  567|      2|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|      2|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|      2|          ((long)blocksperrow * sizeof(JBLOCK));
  569|      2|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 2]
  ------------------
  570|      0|    ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  571|      2|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 0, False: 2]
  ------------------
  572|      0|    rowsperchunk = (JDIMENSION)ltemp;
  573|      2|  else
  574|      2|    rowsperchunk = numrows;
  575|      2|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|      2|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|      2|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|      2|  currow = 0;
  583|      4|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 2, False: 2]
  ------------------
  584|      2|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|      2|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  585|      2|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|      2|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|      2|                  sizeof(JBLOCK)));
  588|     94|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 92, False: 2]
  ------------------
  589|     92|      result[currow++] = workspace;
  590|     92|      workspace += blocksperrow;
  591|     92|    }
  592|      2|  }
  593|       |
  594|      2|  return result;
  595|      2|}
jmemmgr.c:request_virt_barray:
  670|      2|{
  671|      2|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|      2|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|      2|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 2]
  ------------------
  676|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  677|       |
  678|       |  /* get control block */
  679|      2|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|      2|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|      2|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|      2|  result->rows_in_array = numrows;
  684|      2|  result->blocksperrow = blocksperrow;
  685|      2|  result->maxaccess = maxaccess;
  686|      2|  result->pre_zero = pre_zero;
  687|      2|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
  688|      2|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|      2|  mem->virt_barray_list = result;
  690|       |
  691|      2|  return result;
  692|      2|}
jmemmgr.c:realize_virt_arrays:
  698|    286|{
  699|    286|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|    286|  size_t space_per_minheight, maximum_space, avail_mem;
  701|    286|  size_t minheights, max_minheights;
  702|    286|  jvirt_sarray_ptr sptr;
  703|    286|  jvirt_barray_ptr bptr;
  704|    286|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 286, False: 0]
  ------------------
  705|    286|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|    286|                        ((j_compress_ptr)cinfo)->data_precision;
  707|    286|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 1, False: 285]
  ------------------
  708|    285|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 4, False: 281]
  ------------------
  709|      4|                                            sizeof(J12SAMPLE) :
  710|    285|                                            sizeof(JSAMPLE));
  711|       |
  712|       |  /* Compute the minimum space needed (maxaccess rows in each buffer)
  713|       |   * and the maximum space needed (full image height in each buffer).
  714|       |   * These may be of use to the system-dependent jpeg_mem_available routine.
  715|       |   */
  716|    286|  space_per_minheight = 0;
  717|    286|  maximum_space = 0;
  718|    286|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 0, False: 286]
  ------------------
  719|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 0, False: 0]
  ------------------
  720|      0|      size_t new_space = (size_t)sptr->rows_in_array *
  721|      0|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|      0|      space_per_minheight += (size_t)sptr->maxaccess *
  724|      0|                             (size_t)sptr->samplesperrow * sample_size;
  725|      0|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 0]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|      0|      maximum_space += new_space;
  728|      0|    }
  729|      0|  }
  730|    288|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 2, False: 286]
  ------------------
  731|      2|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 2, False: 0]
  ------------------
  732|      2|      size_t new_space = (size_t)bptr->rows_in_array *
  733|      2|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|      2|      space_per_minheight += (size_t)bptr->maxaccess *
  736|      2|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|      2|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 2]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|      2|      maximum_space += new_space;
  740|      2|    }
  741|      2|  }
  742|       |
  743|    286|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 284, False: 2]
  ------------------
  744|    284|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|      2|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|      2|                                 mem->total_space_allocated);
  749|       |
  750|       |  /* If the maximum space needed is available, make all the buffers full
  751|       |   * height; otherwise parcel it out with the same number of minheights
  752|       |   * in each buffer.
  753|       |   */
  754|      2|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 2, False: 0]
  ------------------
  755|      2|    max_minheights = 1000000000L;
  756|      0|  else {
  757|      0|    max_minheights = avail_mem / space_per_minheight;
  758|       |    /* If there doesn't seem to be enough space, try to get the minimum
  759|       |     * anyway.  This allows a "stub" implementation of jpeg_mem_available().
  760|       |     */
  761|      0|    if (max_minheights <= 0)
  ------------------
  |  Branch (761:9): [True: 0, False: 0]
  ------------------
  762|      0|      max_minheights = 1;
  763|      0|  }
  764|       |
  765|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  766|       |
  767|      2|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 0, False: 2]
  ------------------
  768|      0|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 0, False: 0]
  ------------------
  769|      0|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|      0|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 0, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|      0|        sptr->rows_in_mem = sptr->rows_in_array;
  773|      0|      } else {
  774|       |        /* It doesn't fit in memory, create backing store. */
  775|      0|        sptr->rows_in_mem = (JDIMENSION)(max_minheights * sptr->maxaccess);
  776|      0|        jpeg_open_backing_store(cinfo, &sptr->b_s_info,
  777|      0|                                (long)((size_t)sptr->rows_in_array *
  778|      0|                                       (size_t)sptr->samplesperrow *
  779|      0|                                       sample_size));
  780|      0|        sptr->b_s_open = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  781|      0|      }
  782|      0|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      0|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|      0|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|      0|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|      0|      sptr->cur_start_row = 0;
  786|      0|      sptr->first_undef_row = 0;
  787|      0|      sptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  788|      0|    }
  789|      0|  }
  790|       |
  791|      4|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 2, False: 2]
  ------------------
  792|      2|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 2, False: 0]
  ------------------
  793|      2|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|      2|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 2, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|      2|        bptr->rows_in_mem = bptr->rows_in_array;
  797|      2|      } else {
  798|       |        /* It doesn't fit in memory, create backing store. */
  799|      0|        bptr->rows_in_mem = (JDIMENSION)(max_minheights * bptr->maxaccess);
  800|      0|        jpeg_open_backing_store(cinfo, &bptr->b_s_info,
  801|      0|                                (long)((size_t)bptr->rows_in_array *
  802|      0|                                       (size_t)bptr->blocksperrow *
  803|      0|                                       sizeof(JBLOCK)));
  804|      0|        bptr->b_s_open = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  805|      0|      }
  806|      2|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|      2|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|      2|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|      2|      bptr->cur_start_row = 0;
  810|      2|      bptr->first_undef_row = 0;
  811|      2|      bptr->dirty = FALSE;
  ------------------
  |  |  207|      2|#define FALSE   0               /* values of boolean */
  ------------------
  812|      2|    }
  813|      2|  }
  814|      2|}
jmemmgr.c:free_pool:
 1099|  1.00k|{
 1100|  1.00k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|  1.00k|  small_pool_ptr shdr_ptr;
 1102|  1.00k|  large_pool_ptr lhdr_ptr;
 1103|  1.00k|  size_t space_freed;
 1104|       |
 1105|  1.00k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  1.00k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 1.00k]
  |  Branch (1105:22): [True: 0, False: 1.00k]
  ------------------
 1106|      0|    ERREXIT1(cinfo, JERR_BAD_POOL_ID, pool_id); /* safety check */
  ------------------
  |  |  243|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1107|       |
 1108|       |#ifdef MEM_STATS
 1109|       |  if (cinfo->err->trace_level > 1)
 1110|       |    print_mem_stats(cinfo, pool_id); /* print pool's memory usage statistics */
 1111|       |#endif
 1112|       |
 1113|       |  /* If freeing IMAGE pool, close any virtual arrays first */
 1114|  1.00k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|  1.00k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 505, False: 504]
  ------------------
 1115|    505|    jvirt_sarray_ptr sptr;
 1116|    505|    jvirt_barray_ptr bptr;
 1117|       |
 1118|    505|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 0, False: 505]
  ------------------
 1119|      0|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 0]
  ------------------
 1120|      0|        sptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1121|      0|        (*sptr->b_s_info.close_backing_store) (cinfo, &sptr->b_s_info);
 1122|      0|      }
 1123|      0|    }
 1124|    505|    mem->virt_sarray_list = NULL;
 1125|    507|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 2, False: 505]
  ------------------
 1126|      2|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 2]
  ------------------
 1127|      0|        bptr->b_s_open = FALSE; /* prevent recursive close if error */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1128|      0|        (*bptr->b_s_info.close_backing_store) (cinfo, &bptr->b_s_info);
 1129|      0|      }
 1130|      2|    }
 1131|    505|    mem->virt_barray_list = NULL;
 1132|    505|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|  1.00k|  lhdr_ptr = mem->large_list[pool_id];
 1136|  1.00k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|  1.87k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 862, False: 1.00k]
  ------------------
 1139|    862|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|    862|    space_freed = lhdr_ptr->bytes_used +
 1141|    862|                  lhdr_ptr->bytes_left +
 1142|    862|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|    862|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|    862|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|    862|    mem->total_space_allocated -= space_freed;
 1145|    862|    lhdr_ptr = next_lhdr_ptr;
 1146|    862|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|  1.00k|  shdr_ptr = mem->small_list[pool_id];
 1150|  1.00k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|  2.12k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 1.11k, False: 1.00k]
  ------------------
 1153|  1.11k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|  1.11k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|  1.11k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  1.11k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|  1.11k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|  1.11k|    mem->total_space_allocated -= space_freed;
 1158|  1.11k|    shdr_ptr = next_shdr_ptr;
 1159|  1.11k|  }
 1160|  1.00k|}
jmemmgr.c:self_destruct:
 1170|    504|{
 1171|    504|  int pool;
 1172|       |
 1173|       |  /* Close all backing store, release all memory.
 1174|       |   * Releasing pools in reverse order might help avoid fragmentation
 1175|       |   * with some (brain-damaged) malloc libraries.
 1176|       |   */
 1177|  1.51k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|    504|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  1.51k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 1.00k, False: 504]
  ------------------
 1178|  1.00k|    free_pool(cinfo, pool);
 1179|  1.00k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|    504|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|    504|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|    504|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|    504|}

jpeg_get_small:
   33|  1.61k|{
   34|  1.61k|  return (void *)MALLOC(sizeofobject);
  ------------------
  |  |  520|  1.61k|#define MALLOC(size)  malloc(size)
  ------------------
   35|  1.61k|}
jpeg_free_small:
   39|  1.61k|{
   40|  1.61k|  free(object);
   41|  1.61k|}
jpeg_get_large:
   50|    862|{
   51|    862|  return (void *)MALLOC(sizeofobject);
  ------------------
  |  |  520|    862|#define MALLOC(size)  malloc(size)
  ------------------
   52|    862|}
jpeg_free_large:
   56|    862|{
   57|    862|  free(object);
   58|    862|}
jpeg_mem_available:
   68|      2|{
   69|      2|  if (cinfo->mem->max_memory_to_use) {
  ------------------
  |  Branch (69:7): [True: 2, False: 0]
  ------------------
   70|      2|    if ((size_t)cinfo->mem->max_memory_to_use > already_allocated)
  ------------------
  |  Branch (70:9): [True: 2, False: 0]
  ------------------
   71|      2|      return cinfo->mem->max_memory_to_use - already_allocated;
   72|      0|    else
   73|      0|      return 0;
   74|      2|  } else {
   75|       |    /* Here we always say, "we got all you want bud!" */
   76|      0|    return max_bytes_needed;
   77|      0|  }
   78|      2|}
jpeg_mem_init:
  102|    504|{
  103|    504|  return 0;                     /* just set max_memory_to_use to 0 */
  104|    504|}
jpeg_mem_term:
  108|    504|{
  109|       |  /* no work */
  110|    504|}

jdhuff.c:std_huff_tables:
   57|    279|{
   58|    279|  JHUFF_TBL **dc_huff_tbl_ptrs, **ac_huff_tbl_ptrs;
   59|       |
   60|    279|  static const UINT8 bits_dc_luminance[17] = {
   61|    279|    /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0
   62|    279|  };
   63|    279|  static const UINT8 val_dc_luminance[] = {
   64|    279|    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
   65|    279|  };
   66|       |
   67|    279|  static const UINT8 bits_dc_chrominance[17] = {
   68|    279|    /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
   69|    279|  };
   70|    279|  static const UINT8 val_dc_chrominance[] = {
   71|    279|    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
   72|    279|  };
   73|       |
   74|    279|  static const UINT8 bits_ac_luminance[17] = {
   75|    279|    /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d
   76|    279|  };
   77|    279|  static const UINT8 val_ac_luminance[] = {
   78|    279|    0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
   79|    279|    0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
   80|    279|    0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
   81|    279|    0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
   82|    279|    0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
   83|    279|    0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
   84|    279|    0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
   85|    279|    0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
   86|    279|    0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
   87|    279|    0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
   88|    279|    0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
   89|    279|    0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
   90|    279|    0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
   91|    279|    0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
   92|    279|    0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
   93|    279|    0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
   94|    279|    0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
   95|    279|    0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
   96|    279|    0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
   97|    279|    0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
   98|    279|    0xf9, 0xfa
   99|    279|  };
  100|       |
  101|    279|  static const UINT8 bits_ac_chrominance[17] = {
  102|    279|    /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77
  103|    279|  };
  104|    279|  static const UINT8 val_ac_chrominance[] = {
  105|    279|    0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
  106|    279|    0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
  107|    279|    0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
  108|    279|    0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
  109|    279|    0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
  110|    279|    0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
  111|    279|    0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
  112|    279|    0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
  113|    279|    0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
  114|    279|    0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
  115|    279|    0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
  116|    279|    0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
  117|    279|    0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
  118|    279|    0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
  119|    279|    0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
  120|    279|    0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
  121|    279|    0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
  122|    279|    0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
  123|    279|    0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
  124|    279|    0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
  125|    279|    0xf9, 0xfa
  126|    279|  };
  127|       |
  128|    279|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (128:7): [True: 279, False: 0]
  ------------------
  129|    279|    dc_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->dc_huff_tbl_ptrs;
  130|    279|    ac_huff_tbl_ptrs = ((j_decompress_ptr)cinfo)->ac_huff_tbl_ptrs;
  131|    279|  } else {
  132|      0|    dc_huff_tbl_ptrs = ((j_compress_ptr)cinfo)->dc_huff_tbl_ptrs;
  133|      0|    ac_huff_tbl_ptrs = ((j_compress_ptr)cinfo)->ac_huff_tbl_ptrs;
  134|      0|  }
  135|       |
  136|    279|  add_huff_table(cinfo, &dc_huff_tbl_ptrs[0], bits_dc_luminance,
  137|    279|                 val_dc_luminance);
  138|    279|  add_huff_table(cinfo, &ac_huff_tbl_ptrs[0], bits_ac_luminance,
  139|    279|                 val_ac_luminance);
  140|    279|  add_huff_table(cinfo, &dc_huff_tbl_ptrs[1], bits_dc_chrominance,
  141|    279|                 val_dc_chrominance);
  142|    279|  add_huff_table(cinfo, &ac_huff_tbl_ptrs[1], bits_ac_chrominance,
  143|    279|                 val_ac_chrominance);
  144|    279|}
jdhuff.c:add_huff_table:
   23|  1.11k|{
   24|  1.11k|  int nsymbols, len;
   25|       |
   26|  1.11k|  if (*htblptr == NULL)
  ------------------
  |  Branch (26:7): [True: 568, False: 548]
  ------------------
   27|    568|    *htblptr = jpeg_alloc_huff_table(cinfo);
   28|    548|  else if (cinfo->is_decompressor)
  ------------------
  |  Branch (28:12): [True: 548, False: 0]
  ------------------
   29|    548|    return;
   30|       |
   31|       |  /* Copy the number-of-symbols-of-each-code-length counts */
   32|    568|  memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
   33|       |
   34|       |  /* Validate the counts.  We do this here mainly so we can copy the right
   35|       |   * number of symbols from the val[] array, without risking marching off
   36|       |   * the end of memory.  jchuff.c will do a more thorough test later.
   37|       |   */
   38|    568|  nsymbols = 0;
   39|  9.65k|  for (len = 1; len <= 16; len++)
  ------------------
  |  Branch (39:17): [True: 9.08k, False: 568]
  ------------------
   40|  9.08k|    nsymbols += bits[len];
   41|    568|  if (nsymbols < 1 || nsymbols > 256)
  ------------------
  |  Branch (41:7): [True: 0, False: 568]
  |  Branch (41:23): [True: 0, False: 568]
  ------------------
   42|      0|    ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   43|       |
   44|    568|  memcpy((*htblptr)->huffval, val, nsymbols * sizeof(UINT8));
   45|    568|  memset(&((*htblptr)->huffval[nsymbols]), 0,
   46|    568|         (256 - nsymbols) * sizeof(UINT8));
   47|       |
   48|       |  /* Initialize sent_table FALSE so table will be written to JPEG file. */
   49|    568|  (*htblptr)->sent_table = FALSE;
  ------------------
  |  |  207|    568|#define FALSE   0               /* values of boolean */
  ------------------
   50|    568|}

jdiv_round_up:
   81|  3.71k|{
   82|  3.71k|  return (a + b - 1L) / b;
   83|  3.71k|}
jround_up:
   90|     10|{
   91|     10|  a += b - 1L;
   92|     10|  return a - (a % b);
   93|     10|}
jcopy_sample_rows:
  110|  33.5k|{
  111|  33.5k|  register _JSAMPROW inptr, outptr;
  112|  33.5k|  register size_t count = (size_t)(num_cols * sizeof(_JSAMPLE));
  113|  33.5k|  register int row;
  114|       |
  115|  33.5k|  input_array += source_row;
  116|  33.5k|  output_array += dest_row;
  117|       |
  118|  67.1k|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (118:24): [True: 33.5k, False: 33.5k]
  ------------------
  119|  33.5k|    inptr = *input_array++;
  120|  33.5k|    outptr = *output_array++;
  121|  33.5k|    memcpy(outptr, inptr, count);
  122|  33.5k|  }
  123|  33.5k|}
jzero_far:
  144|   203k|{
  145|   203k|  memset(target, 0, bytestozero);
  146|   203k|}

LLVMFuzzerTestOneInput:
   99|  25.9k|{
  100|  25.9k|#ifndef _WIN32
  101|       |    // Used by jpeg library to work around false positives in memory sanitizer.
  102|  25.9k|    setenv("JSIMD_FORCENONE", "1", 1);
  103|  25.9k|#endif
  104|  25.9k|    FuzzHelper f(data, size);
  105|  25.9k|    f.run();
  106|  25.9k|    return 0;
  107|  25.9k|}
_ZN10FuzzHelperC2EPKhm:
   20|  25.9k|        input_buffer(const_cast<unsigned char*>(data), size)
   21|  25.9k|    {
   22|  25.9k|    }
_ZN10FuzzHelper3runEv:
   26|  25.9k|    {
   27|  25.9k|        qpdf::global::options::fuzz_mode(true);
   28|       |        // The goal here is that you should be able to throw anything at libqpdf and it will respond
   29|       |        // without any memory errors and never do anything worse than throwing a QPDFExc or
   30|       |        // std::runtime_error. Throwing any other kind of exception, segfaulting, or having a memory
   31|       |        // error (when built with appropriate sanitizers) will all cause abnormal exit.
   32|  25.9k|        try {
   33|  25.9k|            info("");
   34|       |            // Write in various ways to exercise QPDFWriter
   35|       |
   36|  25.9k|            auto is = std::make_shared<BufferInputSource>("fuzz input", &input_buffer);
   37|  25.9k|            QPDF qpdf;
   38|  25.9k|            qpdf.processInputSource(is);
   39|  25.9k|            info("processInputSource done");
   40|  25.9k|            QPDFPageDocumentHelper pdh(qpdf);
   41|  25.9k|            QPDFPageLabelDocumentHelper pldh(qpdf);
   42|  25.9k|            QPDFOutlineDocumentHelper odh(qpdf);
   43|  25.9k|            QPDFAcroFormDocumentHelper afdh(qpdf);
   44|  25.9k|            afdh.generateAppearancesIfNeeded();
   45|  25.9k|            info("generateAppearancesIfNeeded done");
   46|  25.9k|            pdh.flattenAnnotations();
   47|  25.9k|            info("flattenAnnotations done");
   48|  25.9k|            int pageno = 0;
   49|  25.9k|            for (auto& page: pdh.getAllPages()) {
  ------------------
  |  Branch (49:28): [True: 22.2k, False: 25.9k]
  ------------------
   50|  22.2k|                ++pageno;
   51|  22.2k|                try {
   52|  22.2k|                    info("start page", pageno);
   53|  22.2k|                    page.coalesceContentStreams();
   54|  22.2k|                    info("coalesceContentStreams done");
   55|  22.2k|                    page.parseContents(nullptr);
   56|  22.2k|                    info("parseContents done");
   57|  22.2k|                    page.getImages();
   58|  22.2k|                    info("getImages done");
   59|  22.2k|                    pldh.getLabelForPage(pageno);
   60|  22.2k|                    info("getLabelForPage done");
   61|  22.2k|                    QPDFObjectHandle page_obj(page.getObjectHandle());
   62|  22.2k|                    page_obj.getJSON(JSON::LATEST, true).unparse();
   63|  22.2k|                    info("getJSON done");
   64|  22.2k|                    odh.getOutlinesForPage(page_obj);
   65|  22.2k|                    info("getOutlinesForPage done");
   66|       |
   67|  22.2k|                    for (auto& aoh: afdh.getWidgetAnnotationsForPage(page)) {
  ------------------
  |  Branch (67:35): [True: 2.22k, False: 22.2k]
  ------------------
   68|  2.22k|                        afdh.getFieldForAnnotation(aoh);
   69|  2.22k|                    }
   70|  22.2k|                } catch (QPDFExc& e) {
   71|  3.24k|                    std::cerr << "page " << pageno << ": " << e.what() << '\n';
   72|  3.24k|                }
   73|  22.2k|            }
   74|  25.9k|        } catch (std::runtime_error const& e) {
   75|  16.8k|            std::cerr << "runtime_error: " << e.what() << '\n';
   76|  16.8k|        }
   77|  25.9k|    }
_ZNK10FuzzHelper4infoERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEi:
   82|   198k|    {
   83|   198k|        const std::chrono::duration<double> elapsed{std::chrono::steady_clock::now() - start};
   84|       |
   85|   198k|        std::cerr << elapsed.count() << " info - " << msg;
   86|   198k|        if (pageno > 0) {
  ------------------
  |  Branch (86:13): [True: 22.2k, False: 175k]
  ------------------
   87|  22.2k|            std::cerr << " page " << pageno;
   88|  22.2k|        }
   89|   198k|        std::cerr << '\n';
   90|   198k|    }

_ZN11InputSourceC2Ev:
   35|   159k|    InputSource() = default;
_ZN11InputSourceD2Ev:
   37|   159k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   43|  93.2k|        Finder() = default;
_ZN11InputSource6FinderD2Ev:
   45|  18.1k|        virtual ~Finder() = default;

_ZN4JSON10JSON_valueC2ENS_12value_type_eE:
  306|  1.45M|            type_code(type_code)
  307|  1.45M|        {
  308|  1.45M|        }
_ZN4JSON15JSON_dictionaryC2Ev:
  316|  80.4k|            JSON_value(vt_dictionary)
  317|  80.4k|        {
  318|  80.4k|        }
_ZN4JSON9JSON_nullC2Ev:
  350|  48.8k|            JSON_value(vt_null)
  351|  48.8k|        {
  352|  48.8k|        }
_ZN4JSON10JSON_arrayC2Ev:
  396|  53.6k|        JSON_value(vt_array)
  397|  53.6k|    {
  398|  53.6k|    }
_ZN4JSON10JSON_valueD2Ev:
  309|  1.45M|        virtual ~JSON_value() = default;
_ZN4JSONC2Ev:
   50|  3.88M|    JSON() = default;
_ZN4JSON15JSON_dictionaryD2Ev:
  319|  80.4k|        ~JSON_dictionary() override = default;
_ZN4JSON10JSON_arrayD2Ev:
  399|  53.6k|    ~JSON_array() override = default;
_ZN4JSON11JSON_stringD2Ev:
  327|  1.07M|        ~JSON_string() override = default;
_ZN4JSON11JSON_numberD2Ev:
  336|   198k|        ~JSON_number() override = default;
_ZN4JSON7MembersD2Ev:
  378|  1.45M|        ~Members() = default;

_ZN4qpdf10BaseHandleD2Ev:
  131|  67.0M|        ~BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  19.9M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  24.2M|        BaseHandle(BaseHandle const&) = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|  96.0k|        {
   68|  96.0k|            return obj == other.obj;
   69|  96.0k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  4.70k|        {
   83|  4.70k|            return size() == 0;
   84|  4.70k|        }
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  8.62M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  1.72M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|   593k|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  9.70M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   730k|        BaseHandle& operator=(BaseHandle const&) = default;

_ZNK8Pipeline4nextEv:
  103|   120M|    {
  104|   120M|        return next_;
  105|   120M|    }
_ZN8PipelineD2Ev:
   52|   787k|    virtual ~Pipeline() = default;

_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|   188k|    {
  275|   188k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 169k, False: 18.7k]
  ------------------
  276|   169k|            return;
  277|   169k|        }
  278|  18.7k|        QIntC::range_check_error<T>(cur, delta);
  279|  18.7k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  18.7k|    {
  258|  18.7k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 18.7k, False: 6]
  |  Branch (258:28): [True: 40, False: 18.7k]
  ------------------
  259|     40|            std::ostringstream msg;
  260|     40|            msg.imbue(std::locale::classic());
  261|     40|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     40|            throw std::range_error(msg.str());
  263|  18.7k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 18.7k]
  |  Branch (263:35): [True: 0, False: 0]
  ------------------
  264|      0|            std::ostringstream msg;
  265|      0|            msg.imbue(std::locale::classic());
  266|      0|            msg << "adding " << delta << " to " << cur << " would cause an integer underflow";
  267|      0|            throw std::range_error(msg.str());
  268|      0|        }
  269|  18.7k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  40.7M|    {
  216|  40.7M|        return IntConverter<T, size_t>::convert(i);
  217|  40.7M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  40.7M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  40.7M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  40.7M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 40.7M]
  |  Branch (124:28): [True: 0, False: 40.7M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  40.7M|            return static_cast<To>(i);
  128|  40.7M|        }
_ZN5QIntC9to_offsetImEExRKT_:
  222|  8.94M|    {
  223|  8.94M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  8.94M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  8.94M|        {
  148|       |            // From is unsigned, and to is signed. Convert To's max to the
  149|       |            // unsigned version of To and compare i against that.
  150|  8.94M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  8.94M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 8.94M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  8.94M|            return static_cast<To>(i);
  155|  8.94M|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|  2.29M|    {
  216|  2.29M|        return IntConverter<T, size_t>::convert(i);
  217|  2.29M|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|  2.29M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  2.29M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  2.29M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 2.29M]
  |  Branch (124:28): [True: 0, False: 2.29M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  2.29M|            return static_cast<To>(i);
  128|  2.29M|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|   373k|    {
  202|   373k|        return IntConverter<T, int>::convert(i);
  203|   373k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|   373k|        {
  148|       |            // From is unsigned, and to is signed. Convert To's max to the
  149|       |            // unsigned version of To and compare i against that.
  150|   373k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|   373k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 34, False: 373k]
  ------------------
  152|     34|                error(i);
  153|     34|            }
  154|   373k|            return static_cast<To>(i);
  155|   373k|        }
_ZN5QIntC12IntConverterImiLb0ELb1EE5errorEm:
  159|     34|        {
  160|     34|            std::ostringstream msg;
  161|     34|            msg.imbue(std::locale::classic());
  162|     34|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  163|     34|                << "-byte unsigned type to a " << sizeof(To) << "-byte signed type";
  164|     34|            throw std::range_error(msg.str());
  165|     34|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|   143k|    {
  216|   143k|        return IntConverter<T, size_t>::convert(i);
  217|   143k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   184M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|   184M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   184M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 184M]
  |  Branch (124:28): [True: 0, False: 184M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   184M|            return static_cast<To>(i);
  128|   184M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  5.19M|    {
  202|  5.19M|        return IntConverter<T, int>::convert(i);
  203|  5.19M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  5.19M|        {
   95|       |            // From and To are both signed.
   96|  5.19M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 678, False: 5.19M]
  |  Branch (96:57): [True: 701, False: 5.19M]
  ------------------
   97|  1.37k|                error(i);
   98|  1.37k|            }
   99|  5.19M|            return static_cast<To>(i);
  100|  5.19M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.37k|        {
  105|  1.37k|            std::ostringstream msg;
  106|  1.37k|            msg.imbue(std::locale::classic());
  107|  1.37k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.37k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.37k|            throw std::range_error(msg.str());
  110|  1.37k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|     59|    {
  216|     59|        return IntConverter<T, size_t>::convert(i);
  217|     59|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|  74.7k|        {
   70|       |            // From and To are both unsigned.
   71|  74.7k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 74.7k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  74.7k|            return static_cast<To>(i);
   75|  74.7k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  25.8k|    {
  209|  25.8k|        return IntConverter<T, unsigned int>::convert(i);
  210|  25.8k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  25.8k|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  25.8k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  25.8k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 25.8k]
  |  Branch (124:28): [True: 0, False: 25.8k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  25.8k|            return static_cast<To>(i);
  128|  25.8k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  8.32k|    {
  202|  8.32k|        return IntConverter<T, int>::convert(i);
  203|  8.32k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  8.32k|        {
   95|       |            // From and To are both signed.
   96|  8.32k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 8.32k]
  |  Branch (96:57): [True: 0, False: 8.32k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  8.32k|            return static_cast<To>(i);
  100|  8.32k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  18.1k|    {
  216|  18.1k|        return IntConverter<T, size_t>::convert(i);
  217|  18.1k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  18.1k|        {
   70|       |            // From and To are both unsigned.
   71|  18.1k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 18.1k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  18.1k|            return static_cast<To>(i);
   75|  18.1k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|   462k|    {
  237|   462k|        return IntConverter<T, unsigned long>::convert(i);
  238|   462k|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|   462k|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|   462k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   462k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 462k]
  |  Branch (124:28): [True: 0, False: 462k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   462k|            return static_cast<To>(i);
  128|   462k|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   496M|    {
  237|   496M|        return IntConverter<T, unsigned long>::convert(i);
  238|   496M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   496M|        {
   70|       |            // From and To are both unsigned.
   71|   496M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 496M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   496M|            return static_cast<To>(i);
   75|   496M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   184M|    {
  237|   184M|        return IntConverter<T, unsigned long>::convert(i);
  238|   184M|    }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  56.2M|    {
  195|  56.2M|        return IntConverter<T, unsigned short>::convert(i);
  196|  56.2M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  56.2M|        {
  120|       |            // From is signed, and To is unsigned. If i > 0, it's safe to
  121|       |            // convert it to the corresponding unsigned type and to
  122|       |            // compare with To's max.
  123|  56.2M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  56.2M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 56.2M]
  |  Branch (124:28): [True: 0, False: 56.2M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  56.2M|            return static_cast<To>(i);
  128|  56.2M|        }
_ZN5QIntC20range_check_subtractIxEEvRKT_S3_:
  302|  1.00k|    {
  303|  1.00k|        if ((delta >= 0) == (cur >= 0)) {
  ------------------
  |  Branch (303:13): [True: 804, False: 200]
  ------------------
  304|    804|            return;
  305|    804|        }
  306|    200|        QIntC::range_check_subtract_error<T>(cur, delta);
  307|    200|    }
_ZN5QIntC26range_check_subtract_errorIxEEvRKT_S3_:
  284|    200|    {
  285|    200|        if ((delta > 0) && ((std::numeric_limits<T>::min() + delta) > cur)) {
  ------------------
  |  Branch (285:13): [True: 0, False: 200]
  |  Branch (285:28): [True: 0, False: 0]
  ------------------
  286|      0|            std::ostringstream msg;
  287|      0|            msg.imbue(std::locale::classic());
  288|      0|            msg << "subtracting " << delta << " from " << cur
  289|      0|                << " would cause an integer underflow";
  290|      0|            throw std::range_error(msg.str());
  291|    200|        } else if ((delta < 0) && ((std::numeric_limits<T>::max() + delta) < cur)) {
  ------------------
  |  Branch (291:20): [True: 200, False: 0]
  |  Branch (291:35): [True: 1, False: 199]
  ------------------
  292|      1|            std::ostringstream msg;
  293|      1|            msg.imbue(std::locale::classic());
  294|      1|            msg << "subtracting " << delta << " from " << cur << " would cause an integer overflow";
  295|      1|            throw std::range_error(msg.str());
  296|      1|        }
  297|    200|    }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  22.9k|    {
  216|  22.9k|        return IntConverter<T, size_t>::convert(i);
  217|  22.9k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  22.9k|        {
   70|       |            // From and To are both unsigned.
   71|  22.9k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 22.9k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  22.9k|            return static_cast<To>(i);
   75|  22.9k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|   680k|    {
  209|   680k|        return IntConverter<T, unsigned int>::convert(i);
  210|   680k|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|   680k|        {
   70|       |            // From and To are both unsigned.
   71|   680k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 680k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   680k|            return static_cast<To>(i);
   75|   680k|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|  74.6k|    {
  237|  74.6k|        return IntConverter<T, unsigned long>::convert(i);
  238|  74.6k|    }

_ZN26QPDFAcroFormDocumentHelperD2Ev:
   89|  18.9k|    ~QPDFAcroFormDocumentHelper() override = default;

_ZN26QPDFAnnotationObjectHelperD2Ev:
   34|   176k|    ~QPDFAnnotationObjectHelper() override = default;

_ZN14QPDFCryptoImplC2Ev:
   38|   484k|    QPDFCryptoImpl() = default;
_ZN14QPDFCryptoImplD2Ev:
   40|   484k|    virtual ~QPDFCryptoImpl() = default;

_ZN18QPDFCryptoProviderD2Ev:
   78|      1|    ~QPDFCryptoProvider() = default;
_ZN18QPDFCryptoProvider7MembersC2Ev:
   93|      1|        Members() = default;
_ZN18QPDFCryptoProvider7MembersD2Ev:
   94|      1|        ~Members() = default;

_ZN18QPDFDocumentHelperC2ER4QPDF:
   37|  51.3k|        qpdf(qpdf)
   38|  51.3k|    {
   39|  51.3k|    }

_ZN7QPDFExcD2Ev:
   50|  3.56M|    ~QPDFExc() noexcept override = default;

_ZN25QPDFFormFieldObjectHelperD2Ev:
   40|  75.8k|    ~QPDFFormFieldObjectHelper() override = default;

_ZN24QPDFNameTreeObjectHelper8iteratorD2Ev:
   88|  1.80k|        virtual ~iterator() = default;

_ZN26QPDFNumberTreeObjectHelper8iteratorD2Ev:
  103|  3.65k|        virtual ~iterator() = default;

_ZN10QPDFObjGenC2Eii:
   40|  1.67M|        obj(obj),
   41|  1.67M|        gen(gen)
   42|  1.67M|    {
   43|  1.67M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  62.3M|    {
   47|  62.3M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 35.3M, False: 26.9M]
  |  Branch (47:36): [True: 7.14M, False: 19.8M]
  |  Branch (47:54): [True: 99.5k, False: 7.04M]
  ------------------
   48|  62.3M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   176k|    {
   52|   176k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 170k, False: 6.07k]
  |  Branch (52:34): [True: 170k, False: 161]
  ------------------
   53|   176k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   157k|    {
   57|   157k|        return !(*this == rhs);
   58|   157k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.88M|    {
   62|  1.88M|        return obj;
   63|  1.88M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  4.36k|    {
   67|  4.36k|        return gen;
   68|  4.36k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  6.43M|    {
   72|  6.43M|        return obj != 0;
   73|  6.43M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|  1.25M|    {
   77|  1.25M|        return std::to_string(obj) + separator + std::to_string(gen);
   78|  1.25M|    }
_ZN10QPDFObjGen3set3addES_:
  111|   269k|        {
  112|   269k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 187k, False: 82.3k]
  ------------------
  113|   187k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 19.0k, False: 168k]
  ------------------
  114|  19.0k|                    return false;
  115|  19.0k|                }
  116|   168k|                emplace(og);
  117|   168k|            }
  118|   250k|            return true;
  119|   269k|        }
_ZN10QPDFObjGenC2Ev:
   38|  28.2M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  19.0M|        qpdf::BaseHandle(obj)
 1316|  19.0M|    {
 1317|  19.0M|    }
_ZN16QPDFObjectHandleC2ERKS_:
  290|  23.9M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  176|  36.9k|            {
  177|  36.9k|                f->setPipeline(p);
  178|  36.9k|            }
_ZN16QPDFObjectHandle9RectangleC2Ev:
  236|  1.55k|            llx(0.0),
  237|  1.55k|            lly(0.0),
  238|  1.55k|            urx(0.0),
  239|  1.55k|            ury(0.0)
  240|  1.55k|        {
  241|  1.55k|        }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  46.7k|            llx(llx),
  244|  46.7k|            lly(lly),
  245|  46.7k|            urx(urx),
  246|  46.7k|            ury(ury)
  247|  46.7k|        {
  248|  46.7k|        }
_ZN16QPDFObjectHandle6MatrixC2Edddddd:
  272|    459|            a(a),
  273|    459|            b(b),
  274|    459|            c(c),
  275|    459|            d(d),
  276|    459|            e(e),
  277|    459|            f(f)
  278|    459|        {
  279|    459|        }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  8.02M|        qpdf::BaseHandle(std::move(obj))
 1320|  8.02M|    {
 1321|  8.02M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|   202k|    {
 1325|   202k|        return obj;
 1326|   202k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1518|   118k|        {
 1519|   118k|            return !operator==(other);
 1520|   118k|        }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  40.0M|    {
 1560|  40.0M|        return static_cast<bool>(obj);
 1561|  40.0M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   296k|    {
 1566|   296k|        return {obj};
 1567|   296k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  1.68M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|   504k|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  9.70M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1491|  10.3k|        virtual ~iterator() = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   696k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  64.9k|        TokenFilter() = default;
_ZN16QPDFObjectHandle11TokenFilterD2Ev:
  164|  18.5k|        virtual ~TokenFilter() = default;

_ZN16QPDFObjectHelper15getObjectHandleEv:
   45|  74.8k|    {
   46|  74.8k|        return {obj};
   47|  74.8k|    }
_ZN16QPDFObjectHelperC2E16QPDFObjectHandle:
   38|   202k|        qpdf::BaseHandle(oh.getObj())
   39|   202k|    {
   40|   202k|    }
_ZNK16QPDFObjectHelper15getObjectHandleEv:
   50|  26.3k|    {
   51|  26.3k|        return {obj};
   52|  26.3k|    }
_ZN16QPDFObjectHelper2ohEv:
   58|   348k|    {
   59|   348k|        return {obj};
   60|   348k|    }

_ZN25QPDFOutlineDocumentHelperD2Ev:
   59|  9.75k|    ~QPDFOutlineDocumentHelper() override = default;

_ZN23QPDFOutlineObjectHelperD2Ev:
   37|  41.7k|    {
   38|       |        // This must be cleared explicitly to avoid circular references that prevent cleanup of
   39|       |        // shared pointers.
   40|  41.7k|        m->parent = nullptr;
   41|  41.7k|    }
_ZN23QPDFOutlineObjectHelper8Accessor6createE16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   82|  1.62k|        {
   83|  1.62k|            return {oh, dh, depth};
   84|  1.62k|        }
_ZN23QPDFOutlineObjectHelper7MembersD2Ev:
   95|  4.93k|        ~Members() = default;

_ZN22QPDFPageDocumentHelperD2Ev:
   56|  12.8k|    ~QPDFPageDocumentHelper() override = default;

_ZN27QPDFPageLabelDocumentHelperD2Ev:
   62|  9.75k|    ~QPDFPageLabelDocumentHelper() override = default;

_ZN20QPDFPageObjectHelperD2Ev:
   42|   126k|    ~QPDFPageObjectHelper() override = default;

_ZN16QPDFStreamFilterC2Ev:
   30|  48.9k|    QPDFStreamFilter() = default;
_ZN16QPDFStreamFilterD2Ev:
   32|  48.9k|    virtual ~QPDFStreamFilter() = default;

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  5.92M|            type(tt_bad)
   72|  5.92M|        {
   73|  5.92M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  5.92M|            type(type),
   82|  5.92M|            value(value),
   83|  5.92M|            raw_value(raw_value),
   84|  5.92M|            error_message(error_message)
   85|  5.92M|        {
   86|  5.92M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  10.3M|        {
   90|  10.3M|            return this->type;
   91|  10.3M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  5.07M|        {
   95|  5.07M|            return this->value;
   96|  5.07M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   99|  1.98M|        {
  100|  1.98M|            return this->raw_value;
  101|  1.98M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  2.89M|        {
  117|  2.89M|            return this->type == tt_integer;
  118|  2.89M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  6.32M|        {
  127|  6.32M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 2.33M, False: 3.99M]
  |  Branch (127:45): [True: 622k, False: 1.71M]
  ------------------
  128|  6.32M|        }

_ZN13QPDFXRefEntryC2Ex:
   41|   286k|        type(1),
   42|   286k|        field1(offset)
   43|   286k|    {
   44|   286k|    }
_ZN13QPDFXRefEntryC2Eii:
   47|   207k|        type(2),
   48|   207k|        field1(stream_number),
   49|   207k|        field2(index)
   50|   207k|    {
   51|   207k|    }

_ZN3QTC2TCEPKcS1_i:
   36|  23.8M|    {
   37|       |#ifndef QPDF_DISABLE_QTC
   38|       |        TC_real(scope, ccase, n);
   39|       |#endif // QPDF_DISABLE_QTC
   40|  23.8M|    }

_ZN5QUtil10FileCloserC2EP8_IO_FILE:
  115|      1|            f(f)
  116|      1|        {
  117|      1|        }
_ZN5QUtil10FileCloserD2Ev:
  120|      1|        {
  121|      1|            if (f) {
  ------------------
  |  Branch (121:17): [True: 1, False: 0]
  ------------------
  122|      1|                fclose(f);
  123|      1|                f = nullptr;
  124|      1|            }
  125|      1|        }
_ZN5QUtil17make_shared_arrayIhEENSt3__110shared_ptrIT_EEm:
  183|  28.5k|    {
  184|  28.5k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  185|  28.5k|    }

_ZN4qpdf6global7options9fuzz_modeEb:
  132|  25.9k|        {
  133|  25.9k|            set_uint32(qpdf_p_fuzz_mode, value ? QPDF_TRUE : QPDF_FALSE);
  ------------------
  |  |  142|  25.9k|#define QPDF_TRUE 1
  ------------------
                          set_uint32(qpdf_p_fuzz_mode, value ? QPDF_TRUE : QPDF_FALSE);
  ------------------
  |  |  143|  25.9k|#define QPDF_FALSE 0
  ------------------
  |  Branch (133:42): [True: 25.9k, False: 0]
  ------------------
  134|  25.9k|        }
_ZN4qpdf6global10set_uint32E12qpdf_param_ej:
   53|  25.9k|    {
   54|  25.9k|        handle_result(qpdf_global_set_uint32(param, value));
   55|  25.9k|    }
_ZN4qpdf6global13handle_resultE13qpdf_result_e:
   35|  25.9k|    {
   36|  25.9k|        if (result != qpdf_r_ok) {
  ------------------
  |  Branch (36:13): [True: 0, False: 25.9k]
  ------------------
   37|      0|            QUtil::handle_result_code(result, "qpdf::global");
   38|      0|        }
   39|  25.9k|    }

_ZN14AES_PDF_nativeC2EbPKhmbPh:
   18|   187k|    encrypt(encrypt),
   19|   187k|    cbc_mode(cbc_mode),
   20|   187k|    cbc_block(cbc_block)
   21|   187k|{
   22|   187k|    size_t keybits = 8 * key_bytes;
   23|   187k|    key = std::make_unique<unsigned char[]>(key_bytes);
   24|   187k|    rk = std::make_unique<uint32_t[]>(RKLENGTH(keybits));
  ------------------
  |  |   22|   187k|#define RKLENGTH(keybits) ((keybits) / 8 + 28)
  ------------------
   25|   187k|    size_t rk_bytes = RKLENGTH(keybits) * sizeof(uint32_t);
  ------------------
  |  |   22|   187k|#define RKLENGTH(keybits) ((keybits) / 8 + 28)
  ------------------
   26|   187k|    std::memcpy(key.get(), a_key, key_bytes);
   27|   187k|    std::memset(rk.get(), 0, rk_bytes);
   28|   187k|    if (encrypt) {
  ------------------
  |  Branch (28:9): [True: 179k, False: 7.91k]
  ------------------
   29|   179k|        nrounds = rijndaelSetupEncrypt(rk.get(), key.get(), keybits);
   30|   179k|    } else {
   31|  7.91k|        nrounds = rijndaelSetupDecrypt(rk.get(), key.get(), keybits);
   32|  7.91k|    }
   33|   187k|}
_ZN14AES_PDF_native6updateEPhS0_:
   37|  51.9M|{
   38|  51.9M|    if (encrypt) {
  ------------------
  |  Branch (38:9): [True: 51.3M, False: 589k]
  ------------------
   39|  51.3M|        if (cbc_mode) {
  ------------------
  |  Branch (39:13): [True: 51.3M, False: 0]
  ------------------
   40|   873M|            for (size_t i = 0; i < QPDFCryptoImpl::rijndael_buf_size; ++i) {
  ------------------
  |  Branch (40:32): [True: 821M, False: 51.3M]
  ------------------
   41|   821M|                in_data[i] ^= cbc_block[i];
   42|   821M|            }
   43|  51.3M|        }
   44|  51.3M|        rijndaelEncrypt(rk.get(), nrounds, in_data, out_data);
   45|  51.3M|        if (cbc_mode) {
  ------------------
  |  Branch (45:13): [True: 51.3M, False: 0]
  ------------------
   46|  51.3M|            memcpy(cbc_block, out_data, QPDFCryptoImpl::rijndael_buf_size);
   47|  51.3M|        }
   48|  51.3M|    } else {
   49|   589k|        rijndaelDecrypt(rk.get(), nrounds, in_data, out_data);
   50|   589k|        if (cbc_mode) {
  ------------------
  |  Branch (50:13): [True: 589k, False: 0]
  ------------------
   51|  10.0M|            for (size_t i = 0; i < QPDFCryptoImpl::rijndael_buf_size; ++i) {
  ------------------
  |  Branch (51:32): [True: 9.43M, False: 589k]
  ------------------
   52|  9.43M|                out_data[i] ^= cbc_block[i];
   53|  9.43M|            }
   54|   589k|            memcpy(cbc_block, in_data, QPDFCryptoImpl::rijndael_buf_size);
   55|   589k|        }
   56|   589k|    }
   57|  51.9M|}

_ZN9BitStreamC2EPKhm:
   13|  1.46k|    start(p),
   14|  1.46k|    nbytes(nbytes)
   15|  1.46k|{
   16|  1.46k|    reset();
   17|  1.46k|}
_ZN9BitStream5resetEv:
   21|  1.46k|{
   22|  1.46k|    p = start;
   23|  1.46k|    bit_offset = 7;
   24|  1.46k|    if (QIntC::to_uint(nbytes) > static_cast<unsigned int>(-1) / 8) {
  ------------------
  |  Branch (24:9): [True: 0, False: 1.46k]
  ------------------
   25|      0|        throw std::runtime_error("array too large for bitstream");
   26|      0|    }
   27|  1.46k|    bits_available = 8 * nbytes;
   28|  1.46k|}
_ZN9BitStream13getBitsSignedEm:
   38|   678k|{
   39|   678k|    unsigned long long bits = read_bits(this->p, this->bit_offset, this->bits_available, nbits);
   40|   678k|    long long result = 0;
   41|   678k|    if (static_cast<long long>(bits) > 1LL << (nbits - 1)) {
  ------------------
  |  Branch (41:9): [True: 17.2k, False: 661k]
  ------------------
   42|  17.2k|        result = static_cast<long long>(bits - (1ULL << nbits));
   43|   661k|    } else {
   44|   661k|        result = static_cast<long long>(bits);
   45|   661k|    }
   46|   678k|    return result;
   47|   678k|}

_ZN9BitWriterC2EP8Pipeline:
    8|  1.46k|    pl(pl)
    9|  1.46k|{
   10|  1.46k|}
_ZN9BitWriter9writeBitsEym:
   14|   678k|{
   15|   678k|    write_bits(this->ch, this->bit_offset, val, bits, this->pl);
   16|   678k|}
_ZN9BitWriter15writeBitsSignedExm:
   20|   678k|{
   21|   678k|    unsigned long long uval = 0;
   22|   678k|    if (val < 0) {
  ------------------
  |  Branch (22:9): [True: 343k, False: 335k]
  ------------------
   23|   343k|        uval = (1ULL << bits) + static_cast<unsigned long long>(val);
   24|   343k|    } else {
   25|   335k|        uval = static_cast<unsigned long long>(val);
   26|   335k|    }
   27|   678k|    writeBits(uval, bits);
   28|   678k|}
_ZN9BitWriter5flushEv:
   38|  1.41k|{
   39|  1.41k|    if (bit_offset < 7) {
  ------------------
  |  Branch (39:9): [True: 991, False: 425]
  ------------------
   40|    991|        size_t bits_to_write = bit_offset + 1;
   41|    991|        write_bits(this->ch, this->bit_offset, 0, bits_to_write, this->pl);
   42|    991|    }
   43|  1.41k|}

_ZN6BufferC2Em:
   38|   510k|    m(std::make_unique<Members>(std::string(size, '\0')))
   39|   510k|{
   40|   510k|}
_ZN6BufferC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   43|  26.4k|    m(std::make_unique<Members>(std::move(content)))
   44|  26.4k|{
   45|  26.4k|}
_ZN6BufferC2EPhm:
   48|  25.9k|    m(std::make_unique<Members>(size, reinterpret_cast<char*>(buf)))
   49|  25.9k|{
   50|  25.9k|}
_ZN6BufferC2EOS_:
   58|  1.14M|    m(std::move(rhs.m))
   59|  1.14M|{
   60|  1.14M|}
_ZN6BufferD2Ev:
   69|  1.70M|Buffer::~Buffer() = default;
_ZNK6Buffer7getSizeEv:
   73|   112k|{
   74|   112k|    return m->size;
   75|   112k|}
_ZN6Buffer9getBufferEv:
   85|   565k|{
   86|   565k|    return reinterpret_cast<unsigned char*>(m->buf);
   87|   565k|}
_ZNK6Buffer4sizeEv:
  141|     12|{
  142|     12|    return m->size;
  143|     12|}
_ZN6Buffer7MembersD2Ev:
   24|   563k|    ~Members() = default;
_ZN6Buffer7MembersC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   18|   537k|        str(std::move(content)),
   19|   537k|        size(str.size()),
   20|   537k|        buf(str.data())
   21|   537k|    {
   22|   537k|    }
_ZN6Buffer7MembersC2EmPc:
   13|  25.9k|        size(size),
   14|  25.9k|        buf(buf)
   15|  25.9k|    {
   16|  25.9k|    }

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
  170|  25.9k|    m(std::make_unique<Members>(description, buf, own_memory))
  171|  25.9k|{
  172|  25.9k|}
_ZN17BufferInputSourceD2Ev:
  178|  25.9k|BufferInputSource::~BufferInputSource() = default;
_ZN17BufferInputSource18findAndSkipNextEOLEv:
  182|  2.03M|{
  183|  2.03M|    auto result = m->is.findAndSkipNextEOL();
  184|  2.03M|    last_offset = m->is.getLastOffset();
  185|  2.03M|    return result;
  186|  2.03M|}
_ZNK17BufferInputSource7getNameEv:
  189|  1.09M|{
  190|  1.09M|    return m->is.getName();
  191|  1.09M|}
_ZN17BufferInputSource4tellEv:
  194|  21.4M|{
  195|  21.4M|    return m->is.tell();
  196|  21.4M|}
_ZN17BufferInputSource4seekExi:
  199|  15.2M|{
  200|  15.2M|    m->is.seek(offset, whence);
  201|  15.2M|}
_ZN17BufferInputSource4readEPcm:
  209|  3.56M|{
  210|  3.56M|    auto result = m->is.read(buffer, length);
  211|  3.56M|    last_offset = m->is.getLastOffset();
  212|  3.56M|    return result;
  213|  3.56M|}
_ZN17BufferInputSource8unreadChEc:
  216|  20.0k|{
  217|  20.0k|    m->is.unreadCh(ch);
  218|  20.0k|}
_ZN4qpdf2is12OffsetBuffer18findAndSkipNextEOLEv:
  224|  2.03M|{
  225|  2.03M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  226|  2.03M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  227|  2.03M|    if (pos >= end_pos) {
  ------------------
  |  Branch (227:9): [True: 7.63k, False: 2.03M]
  ------------------
  228|  7.63k|        last_offset = end_pos + global_offset;
  229|  7.63k|        pos = end_pos;
  230|  7.63k|        return end_pos + global_offset;
  231|  7.63k|    }
  232|       |
  233|  2.03M|    qpdf_offset_t result = 0;
  234|  2.03M|    auto buffer = view_.begin();
  235|  2.03M|    auto end = view_.end();
  236|  2.03M|    auto p = buffer + static_cast<std::ptrdiff_t>(pos);
  237|       |
  238|   265M|    while (p < end && !(*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (238:12): [True: 265M, False: 16.7k]
  |  Branch (238:25): [True: 589k, False: 265M]
  |  Branch (238:39): [True: 1.42M, False: 263M]
  ------------------
  239|   263M|        ++p;
  240|   263M|    }
  241|  2.03M|    if (p < end) {
  ------------------
  |  Branch (241:9): [True: 2.01M, False: 16.7k]
  ------------------
  242|  2.01M|        result = p - buffer;
  243|  2.01M|        pos = result + 1;
  244|  2.01M|        ++p;
  245|  2.35M|        while (pos < end_pos && (*p == '\r' || *p == '\n')) {
  ------------------
  |  Branch (245:16): [True: 2.35M, False: 1.74k]
  |  Branch (245:34): [True: 12.3k, False: 2.33M]
  |  Branch (245:48): [True: 326k, False: 2.01M]
  ------------------
  246|   338k|            ++p;
  247|   338k|            ++pos;
  248|   338k|        }
  249|  2.01M|    } else {
  250|  16.7k|        pos = end_pos;
  251|  16.7k|        result = end_pos;
  252|  16.7k|    }
  253|  2.03M|    return result + global_offset;
  254|  2.03M|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  73.4M|{
  259|  73.4M|    switch (whence) {
  260|  73.2M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 73.2M, False: 187k]
  ------------------
  261|  73.2M|        pos = offset - global_offset;
  262|  73.2M|        break;
  263|       |
  264|  50.6k|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 50.6k, False: 73.3M]
  ------------------
  265|  50.6k|        QIntC::range_check(static_cast<qpdf_offset_t>(view_.size()), offset);
  266|  50.6k|        pos = static_cast<qpdf_offset_t>(view_.size()) + offset;
  267|  50.6k|        break;
  268|       |
  269|   136k|    default:
  ------------------
  |  Branch (269:5): [True: 136k, False: 73.3M]
  ------------------
  270|   136k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  271|   136k|        QIntC::range_check(pos, offset);
  272|   136k|        pos += offset;
  273|  73.4M|    }
  274|       |
  275|  73.4M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 403, False: 73.4M]
  ------------------
  276|    403|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|    403|    }
  278|  73.4M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|  6.99M|{
  283|  6.99M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|  6.99M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|  6.99M|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 144k, False: 6.85M]
  ------------------
  286|   144k|        last_offset = end_pos + global_offset;
  287|   144k|        return 0;
  288|   144k|    }
  289|       |
  290|  6.85M|    last_offset = pos + global_offset;
  291|  6.85M|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|  6.85M|    memcpy(buffer, view_.data() + pos, len);
  293|  6.85M|    pos += QIntC::to_offset(len);
  294|  6.85M|    return len;
  295|  6.99M|}
_ZN17BufferInputSource7MembersC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEP6Bufferb:
  148|  25.9k|        buf(own_memory ? buf : nullptr),
  ------------------
  |  Branch (148:13): [True: 0, False: 25.9k]
  ------------------
  149|  25.9k|        is(description,
  150|  25.9k|           buf && buf->getSize() > 0
  ------------------
  |  Branch (150:12): [True: 25.9k, False: 0]
  |  Branch (150:19): [True: 25.9k, False: 0]
  ------------------
  151|  25.9k|               ? std::string_view(reinterpret_cast<const char*>(buf->getBuffer()), buf->getSize())
  152|  25.9k|               : std::string_view())
  153|  25.9k|    {
  154|  25.9k|    }
_ZN17BufferInputSource7MembersD2Ev:
  162|  25.9k|    ~Members() = default;

_ZN24CryptoRandomDataProvider17provideRandomDataEPhm:
    7|    490|{
    8|    490|    auto crypto = QPDFCryptoProvider::getImpl();
    9|    490|    crypto->provideRandomData(data, len);
   10|    490|}
_ZN24CryptoRandomDataProvider11getInstanceEv:
   14|      1|{
   15|      1|    static CryptoRandomDataProvider instance;
   16|      1|    return &instance;
   17|      1|}

_ZN11InputSource13setLastOffsetEx:
   15|  49.9M|{
   16|  49.9M|    this->last_offset = offset;
   17|  49.9M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  30.5M|{
   22|  30.5M|    return this->last_offset;
   23|  30.5M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  13.7k|{
   28|       |    // Return at most max_line_length characters from the next line. Lines are terminated by one or
   29|       |    // more \r or \n characters. Consume the trailing newline characters but don't return them.
   30|       |    // After this is called, the file will be positioned after a line terminator or at the end of
   31|       |    // the file, and last_offset will point to position the file had when this method was called.
   32|       |
   33|  13.7k|    read(str, count, at);
   34|  13.7k|    auto eol = str.find_first_of("\n\r"sv);
   35|  13.7k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 10.8k, False: 2.90k]
  ------------------
   36|  10.8k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  10.8k|        str.resize(eol);
   38|  10.8k|        if (eol != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 10.8k, False: 0]
  ------------------
   39|  10.8k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  10.8k|            return eol;
   41|  10.8k|        }
   42|  10.8k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.90k|    seek(last_offset, SEEK_SET);
   45|  2.90k|    findAndSkipNextEOL();
   46|  2.90k|    return eol;
   47|  13.7k|}
_ZN11InputSource8readLineEm:
   51|  13.7k|{
   52|  13.7k|    return read_line(max_line_length);
   53|  13.7k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|  99.9k|{
   66|       |    // Basic approach: search for the first character of start_chars starting from offset but not
   67|       |    // going past len (if len != 0). Once the first character is found, see if it is the beginning
   68|       |    // of a sequence of characters matching start_chars. If so, call finder.check() to do
   69|       |    // caller-specific additional checks. If not, keep searching.
   70|       |
   71|       |    // This code is tricky and highly subject to off-by-one or other edge case logic errors. See
   72|       |    // comments throughout that explain how we're not missing any edge cases. There are also tests
   73|       |    // specifically constructed to make sure we caught the edge cases in testing.
   74|       |
   75|  99.9k|    char buf[1025]; // size known to input_source.cc in libtests
   76|       |    // To enable us to guarantee null-termination, save an extra byte so that buf[size] is valid
   77|       |    // memory.
   78|  99.9k|    size_t size = sizeof(buf) - 1;
   79|  99.9k|    util::assertion(
   80|  99.9k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 99.9k]
  |  Branch (80:38): [True: 0, False: 99.9k]
  ------------------
   81|  99.9k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|  99.9k|    );
   83|       |
   84|  99.9k|    char* p = nullptr;
   85|  99.9k|    qpdf_offset_t buf_offset = offset;
   86|  99.9k|    size_t bytes_read = 0;
   87|       |
   88|       |    // Guarantee that we return from this loop. Each time through, we either return, advance p, or
   89|       |    // restart the loop with a condition that will cause return on the next pass. Eventually we will
   90|       |    // either be out of range or hit EOF, either of which forces us to return.
   91|  2.34M|    while (true) {
  ------------------
  |  Branch (91:12): [True: 2.34M, Folded]
  ------------------
   92|       |        // Do we need to read more data? Pretend size = 5, buf starts at 0, and start_chars has 3
   93|       |        // characters. buf[5] is valid and null. If p == 2, start_chars could be buf[2] through
   94|       |        // buf[4], so p + strlen(start_chars) == buf + size is okay. If p points to buf[size], since
   95|       |        // strlen(start_chars) is always >= 1, this overflow test will be correct for that case
   96|       |        // regardless of start_chars.
   97|  2.34M|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 99.9k, False: 2.24M]
  |  Branch (97:31): [True: 310k, False: 1.93M]
  ------------------
   98|   410k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 310k, False: 99.9k]
  ------------------
   99|   310k|                QTC::TC(
  100|   310k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 304k, False: 5.74k]
  ------------------
  101|   310k|                buf_offset += (p - buf);
  102|   310k|            }
  103|   410k|            this->seek(buf_offset, SEEK_SET);
  104|       |            // Read into buffer and zero out the rest of the buffer including buf[size]. We
  105|       |            // allocated an extra byte so that we could guarantee null termination as an extra
  106|       |            // protection against overrun when using string functions.
  107|   410k|            bytes_read = this->read(buf, size);
  108|   410k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 49.0k, False: 360k]
  ------------------
  109|  49.0k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 41.2k, False: 7.84k]
  ------------------
  110|  49.0k|                return false;
  111|  49.0k|            }
  112|   360k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   360k|            p = buf;
  114|   360k|        }
  115|       |
  116|       |        // Search for the first character.
  117|  2.29M|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 1.99M, False: 304k]
  ------------------
  118|       |                 // line-break
  119|  2.29M|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|  1.99M|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 10.8k, False: 1.98M]
  ------------------
  121|  10.8k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  10.8k|            }
  123|       |            // Found first letter.
  124|  1.99M|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 62.0k, False: 1.93M]
  ------------------
  125|       |                // Make sure it's in range.
  126|  62.0k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  62.0k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 2.66k, False: 59.3k]
  ------------------
  128|       |                    // out of range
  129|  2.66k|                    QTC::TC("libtests", "InputSource out of range");
  130|  2.66k|                    return false;
  131|  2.66k|                }
  132|  62.0k|            }
  133|  1.98M|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 3.37k, False: 1.98M]
  ------------------
  134|       |                // If there are not enough bytes left in the file for start_chars, we will detect
  135|       |                // this on the next pass as EOF and return.
  136|  3.37k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  3.37k|                continue;
  138|  3.37k|            }
  139|       |
  140|       |            // See if p points to a sequence matching start_chars. We already checked above to make
  141|       |            // sure we are not going to overrun memory.
  142|  1.98M|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 88.5k, False: 1.89M]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  88.5k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  88.5k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 48.2k, False: 40.3k]
  ------------------
  146|  48.2k|                    return true;
  147|  48.2k|                } else {
  148|  40.3k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  40.3k|                }
  150|  1.89M|            } else {
  151|  1.89M|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|  1.89M|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|  1.93M|            ++p;
  156|  1.93M|        } else {
  157|       |            // Trigger reading the next block
  158|   304k|            p = buf + bytes_read;
  159|   304k|        }
  160|  2.29M|    }
  161|  99.9k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  25.9k|{
  166|  25.9k|    bool found = false;
  167|  25.9k|    qpdf_offset_t after_found_offset = 0;
  168|  25.9k|    qpdf_offset_t cur_offset = offset;
  169|  25.9k|    size_t cur_len = len;
  170|  32.6k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 6.73k, False: 25.9k]
  ------------------
  171|  6.73k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 397, False: 6.33k]
  ------------------
  172|    397|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  6.33k|        } else {
  174|  6.33k|            found = true;
  175|  6.33k|        }
  176|  6.73k|        after_found_offset = this->tell();
  177|  6.73k|        cur_offset = after_found_offset;
  178|  6.73k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  6.73k|    }
  180|  25.9k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 6.33k, False: 19.6k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  6.33k|    }
  183|  25.9k|    return found;
  184|  25.9k|}
_ZN11InputSource9read_lineEmx:
   57|  13.7k|{
   58|  13.7k|    std::string result(count, '\0');
   59|  13.7k|    read_line(result, count, at);
   60|  13.7k|    return result;
   61|  13.7k|}

_ZN4JSON7MembersC2ENSt3__110unique_ptrINS_10JSON_valueENS1_14default_deleteIS3_EEEE:
   19|  1.45M|    value(std::move(value))
   20|  1.45M|{
   21|  1.45M|}
_ZN4JSONC2ENSt3__110unique_ptrINS_10JSON_valueENS0_14default_deleteIS2_EEEE:
   24|  1.45M|    m(new Members(std::move(value)))
   25|  1.45M|{
   26|  1.45M|}
_ZN4JSON10writeCloseEP8PipelinebmPKc:
   30|   133k|{
   31|   133k|    if (first) {
  ------------------
  |  Branch (31:9): [True: 15.1k, False: 118k]
  ------------------
   32|  15.1k|        *p << delimiter;
   33|   118k|    } else {
   34|   118k|        std::string s{"\n"};
   35|   118k|        s.append(2 * depth, ' ');
   36|   118k|        *p << s + delimiter;
   37|   118k|    }
   38|   133k|}
_ZN4JSON9writeNextEP8PipelineRbm:
   42|  1.43M|{
   43|  1.43M|    if (first) {
  ------------------
  |  Branch (43:9): [True: 118k, False: 1.31M]
  ------------------
   44|   118k|        first = false;
   45|   118k|        std::string s{"\n"};
   46|   118k|        s.append(2 * depth, ' ');
   47|   118k|        *p << s;
   48|  1.31M|    } else {
   49|  1.31M|        std::string s{",\n"};
   50|  1.31M|        s.append(2 * depth, ' ');
   51|  1.31M|        *p << s;
   52|  1.31M|    }
   53|  1.43M|}
_ZN4JSON19writeDictionaryOpenEP8PipelineRbm:
   57|  80.3k|{
   58|  80.3k|    *p << "{";
   59|  80.3k|    first = true;
   60|  80.3k|}
_ZN4JSON14writeArrayOpenEP8PipelineRbm:
   64|  53.5k|{
   65|  53.5k|    *p << "[";
   66|  53.5k|    first = true;
   67|  53.5k|}
_ZN4JSON20writeDictionaryCloseEP8Pipelinebm:
   71|  80.3k|{
   72|  80.3k|    writeClose(p, first, depth, "}");
   73|  80.3k|}
_ZN4JSON15writeArrayCloseEP8Pipelinebm:
   77|  53.5k|{
   78|  53.5k|    writeClose(p, first, depth, "]");
   79|  53.5k|}
_ZN4JSON18writeDictionaryKeyEP8PipelineRbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
   83|   323k|{
   84|   323k|    writeNext(p, first, depth);
   85|   323k|    *p << std::string("\"") + key + "\": ";
   86|   323k|}
_ZN4JSON19writeDictionaryItemEP8PipelineRbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKS_m:
   91|   323k|{
   92|   323k|    writeDictionaryKey(p, first, key, depth);
   93|   323k|    value.write(p, depth);
   94|   323k|}
_ZN4JSON14writeArrayItemEP8PipelineRbRKS_m:
   98|  1.11M|{
   99|  1.11M|    writeNext(p, first, depth);
  100|  1.11M|    element.write(p, depth);
  101|  1.11M|}
_ZNK4JSON15JSON_dictionary5writeEP8Pipelinem:
  105|  80.3k|{
  106|  80.3k|    bool first = true;
  107|  80.3k|    writeDictionaryOpen(p, first, depth);
  108|   323k|    for (auto const& iter: members) {
  ------------------
  |  Branch (108:26): [True: 323k, False: 80.3k]
  ------------------
  109|   323k|        writeDictionaryItem(p, first, iter.first, iter.second, 1 + depth);
  110|   323k|    }
  111|  80.3k|    writeDictionaryClose(p, first, depth);
  112|  80.3k|}
_ZNK4JSON10JSON_array5writeEP8Pipelinem:
  116|  53.5k|{
  117|  53.5k|    bool first = true;
  118|  53.5k|    writeArrayOpen(p, first, depth);
  119|  1.11M|    for (auto const& element: elements) {
  ------------------
  |  Branch (119:29): [True: 1.11M, False: 53.5k]
  ------------------
  120|  1.11M|        writeArrayItem(p, first, element, 1 + depth);
  121|  1.11M|    }
  122|  53.5k|    writeArrayClose(p, first, depth);
  123|  53.5k|}
_ZN4JSON11JSON_stringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  1.07M|    JSON_value(vt_string),
  127|  1.07M|    utf8(utf8)
  128|  1.07M|{
  129|  1.07M|}
_ZNK4JSON11JSON_string5writeEP8Pipelinem:
  133|  1.07M|{
  134|  1.07M|    *p << std::string("\"") + Writer::encode_string(utf8) + "\"";
  135|  1.07M|}
_ZN4JSON11JSON_numberC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  150|   198k|    JSON_value(vt_number),
  151|   198k|    encoded(value)
  152|   198k|{
  153|   198k|}
_ZNK4JSON11JSON_number5writeEP8Pipelinem:
  157|   198k|{
  158|   198k|    *p << encoded;
  159|   198k|}
_ZN4JSON9JSON_boolC2Eb:
  162|  3.51k|    JSON_value(vt_bool),
  163|  3.51k|    value(val)
  164|  3.51k|{
  165|  3.51k|}
_ZNK4JSON9JSON_bool5writeEP8Pipelinem:
  169|  3.51k|{
  170|  3.51k|    *p << (value ? "true" : "false");
  ------------------
  |  Branch (170:12): [True: 3.00k, False: 508]
  ------------------
  171|  3.51k|}
_ZNK4JSON9JSON_null5writeEP8Pipelinem:
  175|  48.8k|{
  176|  48.8k|    *p << "null";
  177|  48.8k|}
_ZNK4JSON5writeEP8Pipelinem:
  198|  1.45M|{
  199|  1.45M|    if (!m) {
  ------------------
  |  Branch (199:9): [True: 0, False: 1.45M]
  ------------------
  200|      0|        *p << "null";
  201|  1.45M|    } else {
  202|  1.45M|        m->value->write(p, depth);
  203|  1.45M|    }
  204|  1.45M|}
_ZNK4JSON7unparseEv:
  208|  19.6k|{
  209|  19.6k|    if (!m) {
  ------------------
  |  Branch (209:9): [True: 0, False: 19.6k]
  ------------------
  210|      0|        return "null";
  211|      0|    }
  212|  19.6k|    std::string s;
  213|  19.6k|    Pl_String p("unparse", nullptr, s);
  214|  19.6k|    write(&p, 0);
  215|  19.6k|    return s;
  216|  19.6k|}
_ZN4JSON6Writer13encode_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  220|  1.48M|{
  221|  1.48M|    static auto constexpr hexchars = "0123456789abcdef";
  222|       |
  223|  1.48M|    auto begin = str.cbegin();
  224|  1.48M|    auto end = str.cend();
  225|  1.48M|    auto iter = begin;
  226|   238M|    while (iter != end) {
  ------------------
  |  Branch (226:12): [True: 236M, False: 1.44M]
  ------------------
  227|   236M|        auto c = static_cast<unsigned char>(*iter);
  228|   236M|        if ((c > 34 && c != '\\') || c == ' ' || c == 33) {
  ------------------
  |  Branch (228:14): [True: 235M, False: 1.59M]
  |  Branch (228:24): [True: 235M, False: 4.26k]
  |  Branch (228:38): [True: 1.54M, False: 48.0k]
  |  Branch (228:50): [True: 6.35k, False: 41.7k]
  ------------------
  229|       |            // Optimistically check that no char in str requires escaping. Hopefully we can just
  230|       |            // return the input str.
  231|   236M|            ++iter;
  232|   236M|        } else {
  233|       |            // We found a char that requires escaping. Initialize result to the chars scanned so
  234|       |            // far, append/replace the rest of str one char at a time, and return the result.
  235|  41.7k|            std::string result{begin, iter};
  236|       |
  237|   430M|            for (; iter != end; ++iter) {
  ------------------
  |  Branch (237:20): [True: 430M, False: 41.7k]
  ------------------
  238|   430M|                auto ch = static_cast<unsigned char>(*iter);
  239|   430M|                if ((ch > 34 && ch != '\\') || ch == ' ' || ch == 33) {
  ------------------
  |  Branch (239:22): [True: 364M, False: 65.7M]
  |  Branch (239:33): [True: 364M, False: 22.6k]
  |  Branch (239:48): [True: 490k, False: 65.2M]
  |  Branch (239:61): [True: 14.1k, False: 65.2M]
  ------------------
  240|       |                    // Check for most common case first.
  241|   365M|                    result += *iter;
  242|   365M|                } else {
  243|  65.2M|                    switch (ch) {
  244|  22.6k|                    case '\\':
  ------------------
  |  Branch (244:21): [True: 22.6k, False: 65.2M]
  ------------------
  245|  22.6k|                        result += "\\\\";
  246|  22.6k|                        break;
  247|  95.0k|                    case '\"':
  ------------------
  |  Branch (247:21): [True: 95.0k, False: 65.1M]
  ------------------
  248|  95.0k|                        result += "\\\"";
  249|  95.0k|                        break;
  250|  15.8M|                    case '\b':
  ------------------
  |  Branch (250:21): [True: 15.8M, False: 49.3M]
  ------------------
  251|  15.8M|                        result += "\\b";
  252|  15.8M|                        break;
  253|  81.3k|                    case '\f':
  ------------------
  |  Branch (253:21): [True: 81.3k, False: 65.1M]
  ------------------
  254|  81.3k|                        result += "\\f";
  255|  81.3k|                        break;
  256|   210k|                    case '\n':
  ------------------
  |  Branch (256:21): [True: 210k, False: 65.0M]
  ------------------
  257|   210k|                        result += "\\n";
  258|   210k|                        break;
  259|  1.98k|                    case '\r':
  ------------------
  |  Branch (259:21): [True: 1.98k, False: 65.2M]
  ------------------
  260|  1.98k|                        result += "\\r";
  261|  1.98k|                        break;
  262|   960k|                    case '\t':
  ------------------
  |  Branch (262:21): [True: 960k, False: 64.2M]
  ------------------
  263|   960k|                        result += "\\t";
  264|   960k|                        break;
  265|  47.9M|                    default:
  ------------------
  |  Branch (265:21): [True: 47.9M, False: 17.2M]
  ------------------
  266|  47.9M|                        result += ch < 16 ? "\\u000" : "\\u001";
  ------------------
  |  Branch (266:35): [True: 47.9M, False: 53.7k]
  ------------------
  267|  47.9M|                        result += hexchars[ch % 16];
  268|  65.2M|                    }
  269|  65.2M|                }
  270|   430M|            }
  271|  41.7k|            return result;
  272|  41.7k|        }
  273|   236M|    }
  274|  1.44M|    return str;
  275|  1.48M|}
_ZN4JSON14makeDictionaryEv:
  279|  80.4k|{
  280|  80.4k|    return {std::make_unique<JSON_dictionary>()};
  281|  80.4k|}
_ZN4JSON19addDictionaryMemberERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  285|   323k|{
  286|   323k|    if (auto* obj = m ? dynamic_cast<JSON_dictionary*>(m->value.get()) : nullptr) {
  ------------------
  |  Branch (286:15): [True: 323k, False: 0]
  ------------------
  287|   323k|        return obj->members[Writer::encode_string(key)] = val.m ? val : makeNull();
  ------------------
  |  Branch (287:59): [True: 323k, False: 0]
  ------------------
  288|   323k|    } else {
  289|      0|        throw std::runtime_error("JSON::addDictionaryMember called on non-dictionary");
  290|      0|    }
  291|   323k|}
_ZN4JSON9makeArrayEv:
  295|  53.6k|{
  296|  53.6k|    return {std::make_unique<JSON_array>()};
  297|  53.6k|}
_ZN4JSON15addArrayElementERKS_:
  301|  1.11M|{
  302|  1.11M|    if (auto* arr = m ? dynamic_cast<JSON_array*>(m->value.get()) : nullptr) {
  ------------------
  |  Branch (302:15): [True: 1.11M, False: 0]
  ------------------
  303|  1.11M|        if (val.m) {
  ------------------
  |  Branch (303:13): [True: 1.11M, False: 0]
  ------------------
  304|  1.11M|            arr->elements.push_back(val);
  305|  1.11M|        } else {
  306|      0|            arr->elements.push_back(makeNull());
  307|      0|        }
  308|  1.11M|        return arr->elements.back();
  309|  1.11M|    }
  310|      0|    throw std::runtime_error("JSON::addArrayElement called on non-array");
  311|      0|    return {}; // unreachable
  312|  1.11M|}
_ZN4JSON10makeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  316|  1.07M|{
  317|  1.07M|    return {std::make_unique<JSON_string>(utf8)};
  318|  1.07M|}
_ZN4JSON10makeNumberERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  334|   198k|{
  335|   198k|    return {std::make_unique<JSON_number>(encoded)};
  336|   198k|}
_ZN4JSON8makeBoolEb:
  340|  3.51k|{
  341|  3.51k|    return {std::make_unique<JSON_bool>(value)};
  342|  3.51k|}
_ZN4JSON8makeNullEv:
  346|  48.8k|{
  347|  48.8k|    return {std::make_unique<JSON_null>()};
  348|  48.8k|}
_ZNK4JSON7isArrayEv:
  358|  1.43M|{
  359|  1.43M|    return m ? m->value->type_code == vt_array : false;
  ------------------
  |  Branch (359:12): [True: 1.43M, False: 0]
  ------------------
  360|  1.43M|}
_ZNK4JSON12isDictionaryEv:
  364|  1.61M|{
  365|  1.61M|    return m && m->value->type_code == vt_dictionary;
  ------------------
  |  Branch (365:12): [True: 1.61M, False: 0]
  |  Branch (365:17): [True: 180k, False: 1.43M]
  ------------------
  366|  1.61M|}
_ZN4JSON5parseERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1342|  19.6k|{
 1343|  19.6k|    is::OffsetBuffer bis("json input", s);
 1344|  19.6k|    JSONParser jp(bis, nullptr);
 1345|  19.6k|    return jp.parse();
 1346|  19.6k|}
_ZN4JSON8setStartEx:
 1350|  1.45M|{
 1351|  1.45M|    if (m) {
  ------------------
  |  Branch (1351:9): [True: 1.45M, False: 0]
  ------------------
 1352|  1.45M|        m->start = start;
 1353|  1.45M|    }
 1354|  1.45M|}
_ZN4JSON6setEndEx:
 1358|  1.59M|{
 1359|  1.59M|    if (m) {
  ------------------
  |  Branch (1359:9): [True: 1.59M, False: 0]
  ------------------
 1360|  1.59M|        m->end = end;
 1361|  1.59M|    }
 1362|  1.59M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParserC2ER11InputSourcePN4JSON7ReactorE:
  577|  19.6k|            is(is),
  578|  19.6k|            reactor(reactor),
  579|  19.6k|            p(buf)
  580|  19.6k|        {
  581|  19.6k|        }
JSON.cc:_ZN12_GLOBAL__N_110JSONParser5parseEv:
 1317|  19.6k|{
 1318|  3.59M|    while (!done) {
  ------------------
  |  Branch (1318:12): [True: 3.57M, False: 19.6k]
  ------------------
 1319|  3.57M|        getToken();
 1320|  3.57M|        handleToken();
 1321|  3.57M|    }
 1322|  19.6k|    if (parser_state != ps_done) {
  ------------------
  |  Branch (1322:9): [True: 0, False: 19.6k]
  ------------------
 1323|      0|        QTC::TC("libtests", "JSON parse premature EOF");
 1324|      0|        throw std::runtime_error("JSON: premature end of input");
 1325|      0|    }
 1326|  19.6k|    auto const& tos = stack.back().item;
 1327|  19.6k|    if (reactor && !(tos.isArray() || tos.isDictionary())) {
  ------------------
  |  Branch (1327:9): [True: 0, False: 19.6k]
  |  Branch (1327:22): [True: 0, False: 0]
  |  Branch (1327:39): [True: 0, False: 0]
  ------------------
 1328|      0|        reactor->topLevelScalar();
 1329|      0|    }
 1330|  19.6k|    return tos;
 1331|  19.6k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser8getTokenEv:
  807|  3.57M|{
  808|  3.57M|    token.clear();
  809|       |
  810|       |    // Keep track of UTF-16 surrogate pairs.
  811|  3.57M|    unsigned long high_surrogate = 0;
  812|  3.57M|    qpdf_offset_t high_offset = 0;
  813|       |
  814|   496M|    while (true) {
  ------------------
  |  Branch (814:12): [True: 496M, Folded]
  ------------------
  815|   496M|        if (p == (buf + bytes)) {
  ------------------
  |  Branch (815:13): [True: 67.7k, False: 496M]
  ------------------
  816|  67.7k|            p = buf;
  817|  67.7k|            bytes = is.read(buf, sizeof(buf));
  818|  67.7k|            if (bytes == 0) {
  ------------------
  |  Branch (818:17): [True: 19.6k, False: 48.1k]
  ------------------
  819|  19.6k|                done = true;
  820|  19.6k|                break;
  821|  19.6k|            }
  822|  67.7k|        }
  823|       |
  824|   496M|        if ((*p < 32 && *p >= 0)) {
  ------------------
  |  Branch (824:14): [True: 10.3M, False: 486M]
  |  Branch (824:25): [True: 1.58M, False: 8.73M]
  ------------------
  825|  1.58M|            if (*p == '\t' || *p == '\n' || *p == '\r') {
  ------------------
  |  Branch (825:17): [True: 0, False: 1.58M]
  |  Branch (825:31): [True: 1.58M, False: 0]
  |  Branch (825:45): [True: 0, False: 0]
  ------------------
  826|       |                // Legal white space not permitted in strings. This will always end the current
  827|       |                // token (unless we are still before the start of the token).
  828|  1.58M|                if (lex_state == ls_top) {
  ------------------
  |  Branch (828:21): [True: 1.55M, False: 30.1k]
  ------------------
  829|  1.55M|                    ignore();
  830|  1.55M|                } else {
  831|  30.1k|                    break;
  832|  30.1k|                }
  833|       |
  834|  1.58M|            } else {
  835|      0|                QTC::TC("libtests", "JSON parse null character");
  836|      0|                throw std::runtime_error(
  837|      0|                    "JSON: control or null character at offset " + std::to_string(offset));
  838|      0|            }
  839|   494M|        } else if (*p == ',') {
  ------------------
  |  Branch (839:20): [True: 1.55M, False: 493M]
  ------------------
  840|  1.55M|            if (lex_state == ls_top) {
  ------------------
  |  Branch (840:17): [True: 1.31M, False: 239k]
  ------------------
  841|  1.31M|                ignore(ls_comma);
  842|  1.31M|                return;
  843|  1.31M|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (843:24): [True: 18.3k, False: 220k]
  ------------------
  844|  18.3k|                append();
  845|   220k|            } else {
  846|   220k|                break;
  847|   220k|            }
  848|   493M|        } else if (*p == ':') {
  ------------------
  |  Branch (848:20): [True: 460k, False: 492M]
  ------------------
  849|   460k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (849:17): [True: 323k, False: 137k]
  ------------------
  850|   323k|                ignore(ls_colon);
  851|   323k|                return;
  852|   323k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (852:24): [True: 137k, False: 0]
  ------------------
  853|   137k|                append();
  854|   137k|            } else {
  855|      0|                break;
  856|      0|            }
  857|   492M|        } else if (*p == ' ') {
  ------------------
  |  Branch (857:20): [True: 12.3M, False: 480M]
  ------------------
  858|  12.3M|            if (lex_state == ls_top) {
  ------------------
  |  Branch (858:17): [True: 10.5M, False: 1.78M]
  ------------------
  859|  10.5M|                ignore();
  860|  10.5M|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (860:24): [True: 1.78M, False: 0]
  ------------------
  861|  1.78M|                append();
  862|  1.78M|            } else {
  863|      0|                break;
  864|      0|            }
  865|   480M|        } else if (*p == '{') {
  ------------------
  |  Branch (865:20): [True: 82.0k, False: 480M]
  ------------------
  866|  82.0k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (866:17): [True: 80.4k, False: 1.66k]
  ------------------
  867|  80.4k|                token_start = offset;
  868|  80.4k|                ignore(ls_begin_dict);
  869|  80.4k|                return;
  870|  80.4k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (870:24): [True: 1.66k, False: 0]
  ------------------
  871|  1.66k|                append();
  872|  1.66k|            } else {
  873|      0|                break;
  874|      0|            }
  875|   480M|        } else if (*p == '}') {
  ------------------
  |  Branch (875:20): [True: 81.1k, False: 480M]
  ------------------
  876|  81.1k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (876:17): [True: 80.3k, False: 784]
  ------------------
  877|  80.3k|                ignore(ls_end_dict);
  878|  80.3k|                return;
  879|  80.3k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (879:24): [True: 784, False: 0]
  ------------------
  880|    784|                append();
  881|    784|            } else {
  882|      0|                break;
  883|      0|            }
  884|   480M|        } else if (*p == '[') {
  ------------------
  |  Branch (884:20): [True: 67.7k, False: 480M]
  ------------------
  885|  67.7k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (885:17): [True: 53.6k, False: 14.1k]
  ------------------
  886|  53.6k|                token_start = offset;
  887|  53.6k|                ignore(ls_begin_array);
  888|  53.6k|                return;
  889|  53.6k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (889:24): [True: 14.1k, False: 0]
  ------------------
  890|  14.1k|                append();
  891|  14.1k|            } else {
  892|      0|                break;
  893|      0|            }
  894|   480M|        } else if (*p == ']') {
  ------------------
  |  Branch (894:20): [True: 63.4k, False: 480M]
  ------------------
  895|  63.4k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (895:17): [True: 53.6k, False: 9.89k]
  ------------------
  896|  53.6k|                ignore(ls_end_array);
  897|  53.6k|                return;
  898|  53.6k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (898:24): [True: 9.89k, False: 0]
  ------------------
  899|  9.89k|                append();
  900|  9.89k|            } else {
  901|      0|                break;
  902|      0|            }
  903|   480M|        } else {
  904|   480M|            switch (lex_state) {
  905|  1.64M|            case ls_top:
  ------------------
  |  Branch (905:13): [True: 1.64M, False: 478M]
  ------------------
  906|  1.64M|                token_start = offset;
  907|  1.64M|                if (*p == '"') {
  ------------------
  |  Branch (907:21): [True: 1.39M, False: 250k]
  ------------------
  908|  1.39M|                    ignore(ls_string);
  909|  1.39M|                } else if ((*p >= 'a') && (*p <= 'z')) {
  ------------------
  |  Branch (909:28): [True: 52.3k, False: 198k]
  |  Branch (909:43): [True: 52.3k, False: 0]
  ------------------
  910|  52.3k|                    append(ls_alpha);
  911|   198k|                } else if (*p == '-') {
  ------------------
  |  Branch (911:28): [True: 1.59k, False: 196k]
  ------------------
  912|  1.59k|                    append(ls_number_minus);
  913|   196k|                } else if ((*p >= '1') && (*p <= '9')) {
  ------------------
  |  Branch (913:28): [True: 114k, False: 82.5k]
  |  Branch (913:43): [True: 114k, False: 0]
  ------------------
  914|   114k|                    append(ls_number_before_point);
  915|   114k|                } else if (*p == '0') {
  ------------------
  |  Branch (915:28): [True: 82.5k, False: 1]
  ------------------
  916|  82.5k|                    append(ls_number_leading_zero);
  917|  82.5k|                } else {
  918|      1|                    QTC::TC("libtests", "JSON parse bad character");
  919|      1|                    throw std::runtime_error(
  920|      1|                        "JSON: offset " + std::to_string(offset) + ": unexpected character " +
  921|      1|                        std::string(p, 1));
  922|      1|                }
  923|  1.64M|                break;
  924|       |
  925|  1.64M|            case ls_number_minus:
  ------------------
  |  Branch (925:13): [True: 1.59k, False: 480M]
  ------------------
  926|  1.59k|                if ((*p >= '1') && (*p <= '9')) {
  ------------------
  |  Branch (926:21): [True: 1.09k, False: 496]
  |  Branch (926:36): [True: 1.09k, False: 0]
  ------------------
  927|  1.09k|                    append(ls_number_before_point);
  928|  1.09k|                } else if (*p == '0') {
  ------------------
  |  Branch (928:28): [True: 496, False: 0]
  ------------------
  929|    496|                    append(ls_number_leading_zero);
  930|    496|                } else {
  931|      0|                    QTC::TC("libtests", "JSON parse number minus no digits");
  932|      0|                    throw std::runtime_error(
  933|      0|                        "JSON: offset " + std::to_string(offset) +
  934|      0|                        ": numeric literal: no digit after minus sign");
  935|      0|                }
  936|  1.59k|                break;
  937|       |
  938|  3.57k|            case ls_number_leading_zero:
  ------------------
  |  Branch (938:13): [True: 3.57k, False: 480M]
  ------------------
  939|  3.57k|                if (*p == '.') {
  ------------------
  |  Branch (939:21): [True: 3.54k, False: 32]
  ------------------
  940|  3.54k|                    append(ls_number_point);
  941|  3.54k|                } else if (*p == 'e' || *p == 'E') {
  ------------------
  |  Branch (941:28): [True: 0, False: 32]
  |  Branch (941:41): [True: 0, False: 32]
  ------------------
  942|      0|                    append(ls_number_e);
  943|     32|                } else {
  944|     32|                    QTC::TC("libtests", "JSON parse leading zero");
  945|     32|                    throw std::runtime_error(
  946|     32|                        "JSON: offset " + std::to_string(offset) + ": number with leading zero");
  947|     32|                }
  948|  3.54k|                break;
  949|       |
  950|   163k|            case ls_number_before_point:
  ------------------
  |  Branch (950:13): [True: 163k, False: 480M]
  ------------------
  951|   163k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (951:21): [True: 160k, False: 3.71k]
  |  Branch (951:36): [True: 160k, False: 0]
  ------------------
  952|   160k|                    append();
  953|   160k|                } else if (*p == '.') {
  ------------------
  |  Branch (953:28): [True: 3.71k, False: 0]
  ------------------
  954|  3.71k|                    append(ls_number_point);
  955|  3.71k|                } else if (*p == 'e' || *p == 'E') {
  ------------------
  |  Branch (955:28): [True: 0, False: 0]
  |  Branch (955:41): [True: 0, False: 0]
  ------------------
  956|      0|                    append(ls_number_e);
  957|      0|                } else {
  958|      0|                    tokenError();
  959|      0|                }
  960|   163k|                break;
  961|       |
  962|  7.26k|            case ls_number_point:
  ------------------
  |  Branch (962:13): [True: 7.26k, False: 480M]
  ------------------
  963|  7.26k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (963:21): [True: 7.26k, False: 0]
  |  Branch (963:36): [True: 7.26k, False: 0]
  ------------------
  964|  7.26k|                    append(ls_number_after_point);
  965|  7.26k|                } else {
  966|      0|                    tokenError();
  967|      0|                }
  968|  7.26k|                break;
  969|       |
  970|   121k|            case ls_number_after_point:
  ------------------
  |  Branch (970:13): [True: 121k, False: 480M]
  ------------------
  971|   121k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (971:21): [True: 121k, False: 0]
  |  Branch (971:36): [True: 121k, False: 0]
  ------------------
  972|   121k|                    append();
  973|   121k|                } else if (*p == 'e' || *p == 'E') {
  ------------------
  |  Branch (973:28): [True: 0, False: 0]
  |  Branch (973:41): [True: 0, False: 0]
  ------------------
  974|      0|                    append(ls_number_e);
  975|      0|                } else {
  976|      0|                    tokenError();
  977|      0|                }
  978|   121k|                break;
  979|       |
  980|      0|            case ls_number_e:
  ------------------
  |  Branch (980:13): [True: 0, False: 480M]
  ------------------
  981|      0|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (981:21): [True: 0, False: 0]
  |  Branch (981:36): [True: 0, False: 0]
  ------------------
  982|      0|                    append(ls_number);
  983|      0|                } else if ((*p == '+') || (*p == '-')) {
  ------------------
  |  Branch (983:28): [True: 0, False: 0]
  |  Branch (983:43): [True: 0, False: 0]
  ------------------
  984|      0|                    append(ls_number_e_sign);
  985|      0|                } else {
  986|      0|                    tokenError();
  987|      0|                }
  988|      0|                break;
  989|       |
  990|      0|            case ls_number_e_sign:
  ------------------
  |  Branch (990:13): [True: 0, False: 480M]
  ------------------
  991|      0|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (991:21): [True: 0, False: 0]
  |  Branch (991:36): [True: 0, False: 0]
  ------------------
  992|      0|                    append(ls_number);
  993|      0|                } else {
  994|      0|                    tokenError();
  995|      0|                }
  996|      0|                break;
  997|       |
  998|      0|            case ls_number:
  ------------------
  |  Branch (998:13): [True: 0, False: 480M]
  ------------------
  999|       |                // We only get here after we have seen an exponent.
 1000|      0|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (1000:21): [True: 0, False: 0]
  |  Branch (1000:36): [True: 0, False: 0]
  ------------------
 1001|      0|                    append();
 1002|      0|                } else {
 1003|      0|                    tokenError();
 1004|      0|                }
 1005|      0|                break;
 1006|       |
 1007|   157k|            case ls_alpha:
  ------------------
  |  Branch (1007:13): [True: 157k, False: 480M]
  ------------------
 1008|   157k|                if ((*p >= 'a') && (*p <= 'z')) {
  ------------------
  |  Branch (1008:21): [True: 157k, False: 0]
  |  Branch (1008:36): [True: 157k, False: 0]
  ------------------
 1009|   157k|                    append();
 1010|   157k|                } else {
 1011|      0|                    tokenError();
 1012|      0|                }
 1013|   157k|                break;
 1014|       |
 1015|   349M|            case ls_string:
  ------------------
  |  Branch (1015:13): [True: 349M, False: 130M]
  ------------------
 1016|   349M|                if (*p == '"') {
  ------------------
  |  Branch (1016:21): [True: 1.39M, False: 348M]
  ------------------
 1017|  1.39M|                    if (high_offset) {
  ------------------
  |  Branch (1017:25): [True: 0, False: 1.39M]
  ------------------
 1018|      0|                        QTC::TC("libtests", "JSON 16 dangling high");
 1019|      0|                        throw std::runtime_error(
 1020|      0|                            "JSON: offset " + std::to_string(high_offset) +
 1021|      0|                            ": UTF-16 high surrogate not followed by low surrogate");
 1022|      0|                    }
 1023|  1.39M|                    ignore(ls_after_string);
 1024|  1.39M|                    return;
 1025|   348M|                } else if (*p == '\\') {
  ------------------
  |  Branch (1025:28): [True: 32.6M, False: 315M]
  ------------------
 1026|  32.6M|                    ignore(ls_backslash);
 1027|   315M|                } else {
 1028|   315M|                    append();
 1029|   315M|                }
 1030|   348M|                break;
 1031|       |
 1032|   348M|            case ls_backslash:
  ------------------
  |  Branch (1032:13): [True: 32.6M, False: 447M]
  ------------------
 1033|  32.6M|                lex_state = ls_string;
 1034|  32.6M|                switch (*p) {
 1035|  11.2k|                case '\\':
  ------------------
  |  Branch (1035:17): [True: 11.2k, False: 32.6M]
  ------------------
 1036|  58.7k|                case '\"':
  ------------------
  |  Branch (1036:17): [True: 47.5k, False: 32.5M]
  ------------------
 1037|  58.7k|                case '/':
  ------------------
  |  Branch (1037:17): [True: 0, False: 32.6M]
  ------------------
 1038|       |                    // \/ is allowed in json input, but so is /, so we don't map / to \/ in output.
 1039|  58.7k|                    token += *p;
 1040|  58.7k|                    break;
 1041|  7.94M|                case 'b':
  ------------------
  |  Branch (1041:17): [True: 7.94M, False: 24.6M]
  ------------------
 1042|  7.94M|                    token += '\b';
 1043|  7.94M|                    break;
 1044|  40.6k|                case 'f':
  ------------------
  |  Branch (1044:17): [True: 40.6k, False: 32.5M]
  ------------------
 1045|  40.6k|                    token += '\f';
 1046|  40.6k|                    break;
 1047|   105k|                case 'n':
  ------------------
  |  Branch (1047:17): [True: 105k, False: 32.5M]
  ------------------
 1048|   105k|                    token += '\n';
 1049|   105k|                    break;
 1050|    990|                case 'r':
  ------------------
  |  Branch (1050:17): [True: 990, False: 32.6M]
  ------------------
 1051|    990|                    token += '\r';
 1052|    990|                    break;
 1053|   480k|                case 't':
  ------------------
  |  Branch (1053:17): [True: 480k, False: 32.1M]
  ------------------
 1054|   480k|                    token += '\t';
 1055|   480k|                    break;
 1056|  23.9M|                case 'u':
  ------------------
  |  Branch (1056:17): [True: 23.9M, False: 8.63M]
  ------------------
 1057|  23.9M|                    lex_state = ls_u4;
 1058|  23.9M|                    u_count = 0;
 1059|  23.9M|                    u_value = 0;
 1060|  23.9M|                    break;
 1061|      0|                default:
  ------------------
  |  Branch (1061:17): [True: 0, False: 32.6M]
  ------------------
 1062|      0|                    lex_state = ls_backslash;
 1063|      0|                    tokenError();
 1064|  32.6M|                }
 1065|  32.6M|                ignore();
 1066|  32.6M|                break;
 1067|       |
 1068|  95.9M|            case ls_u4:
  ------------------
  |  Branch (1068:13): [True: 95.9M, False: 384M]
  ------------------
 1069|  95.9M|                using ui = unsigned int;
 1070|  95.9M|                if (ui val = ui(util::hex_decode_char(*p)); val < 16) {
  ------------------
  |  Branch (1070:61): [True: 95.9M, False: 0]
  ------------------
 1071|  95.9M|                    u_value = 16 * u_value + val;
 1072|  95.9M|                } else {
 1073|      0|                    tokenError();
 1074|      0|                }
 1075|  95.9M|                if (++u_count == 4) {
  ------------------
  |  Branch (1075:21): [True: 23.9M, False: 71.9M]
  ------------------
 1076|  23.9M|                    handle_u_code(u_value, offset - 5, high_surrogate, high_offset, token);
 1077|  23.9M|                    lex_state = ls_string;
 1078|  23.9M|                }
 1079|  95.9M|                ignore();
 1080|  95.9M|                break;
 1081|       |
 1082|      0|            default:
  ------------------
  |  Branch (1082:13): [True: 0, False: 480M]
  ------------------
 1083|      0|                throw std::logic_error("JSONParser::getToken : trying to handle delimiter state");
 1084|   480M|            }
 1085|   480M|        }
 1086|   496M|    }
 1087|       |
 1088|       |    // We only get here if on end of input or if the last character was a control character or other
 1089|       |    // delimiter.
 1090|       |
 1091|   270k|    if (!token.empty()) {
  ------------------
  |  Branch (1091:9): [True: 250k, False: 19.6k]
  ------------------
 1092|   250k|        switch (lex_state) {
 1093|      0|        case ls_top:
  ------------------
  |  Branch (1093:9): [True: 0, False: 250k]
  ------------------
 1094|       |            // Can't happen
 1095|      0|            throw std::logic_error("tok_start set in ls_top while parsing");
 1096|      0|            break;
 1097|       |
 1098|  79.4k|        case ls_number_leading_zero:
  ------------------
  |  Branch (1098:9): [True: 79.4k, False: 171k]
  ------------------
 1099|   191k|        case ls_number_before_point:
  ------------------
  |  Branch (1099:9): [True: 111k, False: 139k]
  ------------------
 1100|   198k|        case ls_number_after_point:
  ------------------
  |  Branch (1100:9): [True: 7.26k, False: 243k]
  ------------------
 1101|   198k|            lex_state = ls_number;
 1102|   198k|            break;
 1103|       |
 1104|      0|        case ls_number:
  ------------------
  |  Branch (1104:9): [True: 0, False: 250k]
  ------------------
 1105|  52.3k|        case ls_alpha:
  ------------------
  |  Branch (1105:9): [True: 52.3k, False: 198k]
  ------------------
 1106|       |            // terminal state
 1107|  52.3k|            break;
 1108|       |
 1109|      0|        default:
  ------------------
  |  Branch (1109:9): [True: 0, False: 250k]
  ------------------
 1110|      0|            tokenError();
 1111|   250k|        }
 1112|   250k|    }
 1113|   270k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6ignoreEv:
  790|   140M|{
  791|   140M|    ++p;
  792|   140M|    ++offset;
  793|   140M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6ignoreENS0_11lex_state_eE:
  799|  37.3M|{
  800|  37.3M|    lex_state = next;
  801|  37.3M|    ++p;
  802|  37.3M|    ++offset;
  803|  37.3M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6appendEv:
  770|   317M|{
  771|   317M|    token += *p;
  772|   317M|    ++p;
  773|   317M|    ++offset;
  774|   317M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6appendENS0_11lex_state_eE:
  780|   266k|{
  781|   266k|    lex_state = next;
  782|   266k|    token += *p;
  783|   266k|    ++p;
  784|   266k|    ++offset;
  785|   266k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser13handle_u_codeEmxRmRxRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  674|  23.9M|{
  675|  23.9M|    if ((codepoint & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (675:9): [True: 0, False: 23.9M]
  ------------------
  676|       |        // high surrogate
  677|      0|        qpdf_offset_t new_high_offset = offset;
  678|      0|        if (high_offset) {
  ------------------
  |  Branch (678:13): [True: 0, False: 0]
  ------------------
  679|      0|            QTC::TC("libtests", "JSON 16 high high");
  680|      0|            throw std::runtime_error(
  681|      0|                "JSON: offset " + std::to_string(new_high_offset) +
  682|      0|                ": UTF-16 high surrogate found after previous high surrogate at offset " +
  683|      0|                std::to_string(high_offset));
  684|      0|        }
  685|      0|        high_offset = new_high_offset;
  686|      0|        high_surrogate = codepoint;
  687|  23.9M|    } else if ((codepoint & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (687:16): [True: 0, False: 23.9M]
  ------------------
  688|       |        // low surrogate
  689|      0|        if (offset != (high_offset + 6)) {
  ------------------
  |  Branch (689:13): [True: 0, False: 0]
  ------------------
  690|      0|            QTC::TC("libtests", "JSON 16 low not after high");
  691|      0|            throw std::runtime_error(
  692|      0|                "JSON: offset " + std::to_string(offset) +
  693|      0|                ": UTF-16 low surrogate found not immediately after high surrogate");
  694|      0|        }
  695|      0|        high_offset = 0;
  696|      0|        codepoint = 0x10000U + ((high_surrogate & 0x3FFU) << 10U) + (codepoint & 0x3FF);
  697|      0|        result += QUtil::toUTF8(codepoint);
  698|  23.9M|    } else {
  699|  23.9M|        result += QUtil::toUTF8(codepoint);
  700|  23.9M|    }
  701|  23.9M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser11handleTokenEv:
 1117|  3.57M|{
 1118|  3.57M|    if (lex_state == ls_top) {
  ------------------
  |  Branch (1118:9): [True: 19.6k, False: 3.55M]
  ------------------
 1119|  19.6k|        return;
 1120|  19.6k|    }
 1121|       |
 1122|  3.55M|    if (parser_state == ps_done) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 3.55M]
  ------------------
 1123|      0|        QTC::TC("libtests", "JSON parse junk after object");
 1124|      0|        throw std::runtime_error(
 1125|      0|            "JSON: offset " + std::to_string(offset) +
 1126|      0|            ": material follows end of object: " + token);
 1127|      0|    }
 1128|       |
 1129|  3.55M|    const static JSON null_item = JSON::makeNull();
 1130|  3.55M|    JSON item;
 1131|  3.55M|    auto tos = stack.empty() ? null_item : stack.back().item;
  ------------------
  |  Branch (1131:16): [True: 19.6k, False: 3.53M]
  ------------------
 1132|  3.55M|    auto ls = lex_state;
 1133|  3.55M|    lex_state = ls_top;
 1134|       |
 1135|  3.55M|    switch (ls) {
 1136|  80.4k|    case ls_begin_dict:
  ------------------
  |  Branch (1136:5): [True: 80.4k, False: 3.47M]
  ------------------
 1137|  80.4k|        item = JSON::makeDictionary();
 1138|  80.4k|        break;
 1139|       |
 1140|  53.6k|    case ls_begin_array:
  ------------------
  |  Branch (1140:5): [True: 53.6k, False: 3.50M]
  ------------------
 1141|  53.6k|        item = JSON::makeArray();
 1142|  53.6k|        break;
 1143|       |
 1144|   323k|    case ls_colon:
  ------------------
  |  Branch (1144:5): [True: 323k, False: 3.23M]
  ------------------
 1145|   323k|        if (parser_state != ps_dict_after_key) {
  ------------------
  |  Branch (1145:13): [True: 0, False: 323k]
  ------------------
 1146|      0|            QTC::TC("libtests", "JSON parse unexpected :");
 1147|      0|            throw std::runtime_error(
 1148|      0|                "JSON: offset " + std::to_string(offset) + ": unexpected colon");
 1149|      0|        }
 1150|   323k|        parser_state = ps_dict_after_colon;
 1151|   323k|        return;
 1152|       |
 1153|  1.31M|    case ls_comma:
  ------------------
  |  Branch (1153:5): [True: 1.31M, False: 2.23M]
  ------------------
 1154|  1.31M|        if (!((parser_state == ps_dict_after_item) || (parser_state == ps_array_after_item))) {
  ------------------
  |  Branch (1154:15): [True: 257k, False: 1.06M]
  |  Branch (1154:55): [True: 1.06M, False: 0]
  ------------------
 1155|      0|            QTC::TC("libtests", "JSON parse unexpected ,");
 1156|      0|            throw std::runtime_error(
 1157|      0|                "JSON: offset " + std::to_string(offset) + ": unexpected comma");
 1158|      0|        }
 1159|  1.31M|        if (parser_state == ps_dict_after_item) {
  ------------------
  |  Branch (1159:13): [True: 257k, False: 1.06M]
  ------------------
 1160|   257k|            parser_state = ps_dict_after_comma;
 1161|  1.06M|        } else if (parser_state == ps_array_after_item) {
  ------------------
  |  Branch (1161:20): [True: 1.06M, False: 0]
  ------------------
 1162|  1.06M|            parser_state = ps_array_after_comma;
 1163|  1.06M|        } else {
 1164|      0|            throw std::logic_error("JSONParser::handleToken: unexpected parser state for comma");
 1165|      0|        }
 1166|  1.31M|        return;
 1167|       |
 1168|  1.31M|    case ls_end_array:
  ------------------
  |  Branch (1168:5): [True: 53.6k, False: 3.50M]
  ------------------
 1169|  53.6k|        if (!(parser_state == ps_array_begin || parser_state == ps_array_after_item)) {
  ------------------
  |  Branch (1169:15): [True: 625, False: 52.9k]
  |  Branch (1169:49): [True: 52.9k, False: 0]
  ------------------
 1170|      0|            QTC::TC("libtests", "JSON parse unexpected ]");
 1171|      0|            throw std::runtime_error(
 1172|      0|                "JSON: offset " + std::to_string(offset) + ": unexpected array end delimiter");
 1173|      0|        }
 1174|  53.6k|        parser_state = stack.back().state;
 1175|  53.6k|        tos.setEnd(offset);
 1176|  53.6k|        if (reactor) {
  ------------------
  |  Branch (1176:13): [True: 0, False: 53.6k]
  ------------------
 1177|      0|            reactor->containerEnd(tos);
 1178|      0|        }
 1179|  53.6k|        if (parser_state != ps_done) {
  ------------------
  |  Branch (1179:13): [True: 53.6k, False: 0]
  ------------------
 1180|  53.6k|            stack.pop_back();
 1181|  53.6k|        }
 1182|  53.6k|        return;
 1183|       |
 1184|  80.3k|    case ls_end_dict:
  ------------------
  |  Branch (1184:5): [True: 80.3k, False: 3.47M]
  ------------------
 1185|  80.3k|        if (!((parser_state == ps_dict_begin) || (parser_state == ps_dict_after_item))) {
  ------------------
  |  Branch (1185:15): [True: 14.5k, False: 65.8k]
  |  Branch (1185:50): [True: 65.8k, False: 0]
  ------------------
 1186|      0|            QTC::TC("libtests", "JSON parse unexpected }");
 1187|      0|            throw std::runtime_error(
 1188|      0|                "JSON: offset " + std::to_string(offset) + ": unexpected dictionary end delimiter");
 1189|      0|        }
 1190|  80.3k|        parser_state = stack.back().state;
 1191|  80.3k|        tos.setEnd(offset);
 1192|  80.3k|        if (reactor) {
  ------------------
  |  Branch (1192:13): [True: 0, False: 80.3k]
  ------------------
 1193|      0|            reactor->containerEnd(tos);
 1194|      0|        }
 1195|  80.3k|        if (parser_state != ps_done) {
  ------------------
  |  Branch (1195:13): [True: 60.7k, False: 19.6k]
  ------------------
 1196|  60.7k|            stack.pop_back();
 1197|  60.7k|        }
 1198|  80.3k|        return;
 1199|       |
 1200|   198k|    case ls_number:
  ------------------
  |  Branch (1200:5): [True: 198k, False: 3.36M]
  ------------------
 1201|   198k|        item = JSON::makeNumber(token);
 1202|   198k|        break;
 1203|       |
 1204|  52.3k|    case ls_alpha:
  ------------------
  |  Branch (1204:5): [True: 52.3k, False: 3.50M]
  ------------------
 1205|  52.3k|        if (token == "true") {
  ------------------
  |  Branch (1205:13): [True: 3.00k, False: 49.3k]
  ------------------
 1206|  3.00k|            item = JSON::makeBool(true);
 1207|  49.3k|        } else if (token == "false") {
  ------------------
  |  Branch (1207:20): [True: 508, False: 48.8k]
  ------------------
 1208|    508|            item = JSON::makeBool(false);
 1209|  48.8k|        } else if (token == "null") {
  ------------------
  |  Branch (1209:20): [True: 48.8k, False: 0]
  ------------------
 1210|  48.8k|            item = JSON::makeNull();
 1211|  48.8k|        } else {
 1212|      0|            QTC::TC("libtests", "JSON parse invalid keyword");
 1213|      0|            throw std::runtime_error(
 1214|      0|                "JSON: offset " + std::to_string(offset) + ": invalid keyword " + token);
 1215|      0|        }
 1216|  52.3k|        break;
 1217|       |
 1218|  1.39M|    case ls_after_string:
  ------------------
  |  Branch (1218:5): [True: 1.39M, False: 2.16M]
  ------------------
 1219|  1.39M|        if (parser_state == ps_dict_begin || parser_state == ps_dict_after_comma) {
  ------------------
  |  Branch (1219:13): [True: 65.9k, False: 1.33M]
  |  Branch (1219:46): [True: 257k, False: 1.07M]
  ------------------
 1220|   323k|            dict_key = token;
 1221|   323k|            dict_key_offset = token_start;
 1222|   323k|            parser_state = ps_dict_after_key;
 1223|   323k|            return;
 1224|  1.07M|        } else {
 1225|  1.07M|            item = JSON::makeString(token);
 1226|  1.07M|        }
 1227|  1.07M|        break;
 1228|       |
 1229|  1.07M|    default:
  ------------------
  |  Branch (1229:5): [True: 0, False: 3.55M]
  ------------------
 1230|      0|        throw std::runtime_error(
 1231|      0|            "JSON: offset " + std::to_string(offset) + ": premature end of input");
 1232|      0|        break;
 1233|  3.55M|    }
 1234|       |
 1235|  1.45M|    item.setStart(token_start);
 1236|  1.45M|    item.setEnd(offset);
 1237|       |
 1238|  1.45M|    switch (parser_state) {
  ------------------
  |  Branch (1238:13): [True: 1.45M, False: 0]
  ------------------
 1239|      0|    case ps_dict_begin:
  ------------------
  |  Branch (1239:5): [True: 0, False: 1.45M]
  ------------------
 1240|      0|    case ps_dict_after_comma:
  ------------------
  |  Branch (1240:5): [True: 0, False: 1.45M]
  ------------------
 1241|      0|        QTC::TC("libtests", "JSON parse string as dict key");
 1242|      0|        throw std::runtime_error(
 1243|      0|            "JSON: offset " + std::to_string(offset) + ": expect string as dictionary key");
 1244|      0|        break;
 1245|       |
 1246|   323k|    case ps_dict_after_colon:
  ------------------
  |  Branch (1246:5): [True: 323k, False: 1.13M]
  ------------------
 1247|   323k|        if (!reactor || !reactor->dictionaryItem(dict_key, item)) {
  ------------------
  |  Branch (1247:13): [True: 323k, False: 0]
  |  Branch (1247:25): [True: 0, False: 0]
  ------------------
 1248|   323k|            tos.addDictionaryMember(dict_key, item);
 1249|   323k|        }
 1250|   323k|        parser_state = ps_dict_after_item;
 1251|   323k|        break;
 1252|       |
 1253|  52.9k|    case ps_array_begin:
  ------------------
  |  Branch (1253:5): [True: 52.9k, False: 1.40M]
  ------------------
 1254|  1.11M|    case ps_array_after_comma:
  ------------------
  |  Branch (1254:5): [True: 1.06M, False: 395k]
  ------------------
 1255|  1.11M|        if (!reactor || !reactor->arrayItem(item)) {
  ------------------
  |  Branch (1255:13): [True: 1.11M, False: 0]
  |  Branch (1255:25): [True: 0, False: 0]
  ------------------
 1256|  1.11M|            tos.addArrayElement(item);
 1257|  1.11M|        }
 1258|  1.11M|        parser_state = ps_array_after_item;
 1259|  1.11M|        break;
 1260|       |
 1261|  19.6k|    case ps_top:
  ------------------
  |  Branch (1261:5): [True: 19.6k, False: 1.43M]
  ------------------
 1262|  19.6k|        if (!(item.isDictionary() || item.isArray())) {
  ------------------
  |  Branch (1262:15): [True: 19.6k, False: 0]
  |  Branch (1262:38): [True: 0, False: 0]
  ------------------
 1263|      0|            stack.emplace_back(ps_done, item);
 1264|      0|            parser_state = ps_done;
 1265|      0|            return;
 1266|      0|        }
 1267|  19.6k|        parser_state = ps_done;
 1268|  19.6k|        break;
 1269|       |
 1270|      0|    case ps_dict_after_key:
  ------------------
  |  Branch (1270:5): [True: 0, False: 1.45M]
  ------------------
 1271|      0|        QTC::TC("libtests", "JSON parse expected colon");
 1272|      0|        throw std::runtime_error("JSON: offset " + std::to_string(offset) + ": expected ':'");
 1273|      0|        break;
 1274|       |
 1275|      0|    case ps_dict_after_item:
  ------------------
  |  Branch (1275:5): [True: 0, False: 1.45M]
  ------------------
 1276|      0|        QTC::TC("libtests", "JSON parse expected , or }");
 1277|      0|        throw std::runtime_error(
 1278|      0|            "JSON: offset " + std::to_string(offset) + ": expected ',' or '}'");
 1279|      0|        break;
 1280|       |
 1281|      0|    case ps_array_after_item:
  ------------------
  |  Branch (1281:5): [True: 0, False: 1.45M]
  ------------------
 1282|      0|        QTC::TC("libtests", "JSON parse expected, or ]");
 1283|      0|        throw std::runtime_error(
 1284|      0|            "JSON: offset " + std::to_string(offset) + ": expected ',' or ']'");
 1285|      0|        break;
 1286|       |
 1287|      0|    case ps_done:
  ------------------
  |  Branch (1287:5): [True: 0, False: 1.45M]
  ------------------
 1288|      0|        throw std::logic_error("JSONParser::handleToken: unexpected parser state");
 1289|  1.45M|    }
 1290|       |
 1291|  1.45M|    if (item.isDictionary() || item.isArray()) {
  ------------------
  |  Branch (1291:9): [True: 80.4k, False: 1.37M]
  |  Branch (1291:32): [True: 53.6k, False: 1.32M]
  ------------------
 1292|   134k|        stack.emplace_back(parser_state, item);
 1293|       |        // Calling container start method is postponed until after adding the containers to their
 1294|       |        // parent containers, if any. This makes it much easier to keep track of the current nesting
 1295|       |        // level.
 1296|   134k|        if (item.isDictionary()) {
  ------------------
  |  Branch (1296:13): [True: 80.4k, False: 53.6k]
  ------------------
 1297|  80.4k|            if (reactor) {
  ------------------
  |  Branch (1297:17): [True: 0, False: 80.4k]
  ------------------
 1298|      0|                reactor->dictionaryStart();
 1299|      0|            }
 1300|  80.4k|            parser_state = ps_dict_begin;
 1301|  80.4k|        } else if (item.isArray()) {
  ------------------
  |  Branch (1301:20): [True: 53.6k, False: 0]
  ------------------
 1302|  53.6k|            if (reactor) {
  ------------------
  |  Branch (1302:17): [True: 0, False: 53.6k]
  ------------------
 1303|      0|                reactor->arrayStart();
 1304|      0|            }
 1305|  53.6k|            parser_state = ps_array_begin;
 1306|  53.6k|        }
 1307|       |
 1308|   134k|        if (stack.size() > 500) {
  ------------------
  |  Branch (1308:13): [True: 0, False: 134k]
  ------------------
 1309|      0|            throw std::runtime_error(
 1310|      0|                "JSON: offset " + std::to_string(offset) + ": maximum object depth exceeded");
 1311|      0|        }
 1312|   134k|    }
 1313|  1.45M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser10StackFrameC2ENS0_14parser_state_eER4JSON:
  625|   134k|                state(state),
  626|   134k|                item(item)
  627|   134k|            {
  628|   134k|            }

_ZN3MD5C2Ev:
   12|  83.1k|{
   13|  83.1k|    init();
   14|  83.1k|}
_ZN3MD54initEv:
   18|  83.1k|{
   19|  83.1k|    crypto = QPDFCryptoProvider::getImpl();
   20|  83.1k|    crypto->MD5_init();
   21|  83.1k|}
_ZN3MD56digestEPh:
   88|  83.1k|{
   89|  83.1k|    crypto->MD5_finalize();
   90|  83.1k|    crypto->MD5_digest(result);
   91|  83.1k|}
_ZN3MD56digestEv:
   95|    816|{
   96|    816|    Digest digest_val;
   97|    816|    digest(digest_val);
   98|    816|    return {reinterpret_cast<char*>(digest_val), 16};
   99|    816|}
_ZN3MD56digestENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  103|  2.66k|{
  104|  2.66k|    MD5 m;
  105|  2.66k|    m.encodeDataIncrementally(data.data(), data.size());
  106|  2.66k|    Digest digest_val;
  107|  2.66k|    m.digest(digest_val);
  108|  2.66k|    return {reinterpret_cast<char*>(digest_val), 16};
  109|  2.66k|}

_ZN10MD5_nativeC2Ev:
   99|  83.1k|{
  100|  83.1k|    init();
  101|  83.1k|}
_ZN10MD5_native4initEv:
  105|  83.1k|{
  106|  83.1k|    count[0] = count[1] = 0;
  107|       |    // Load magic initialization constants.
  108|  83.1k|    state[0] = 0x67452301;
  109|  83.1k|    state[1] = 0xefcdab89;
  110|  83.1k|    state[2] = 0x98badcfe;
  111|  83.1k|    state[3] = 0x10325476;
  112|       |
  113|  83.1k|    finalized = false;
  114|  83.1k|    memset(digest_val, 0, sizeof(digest_val));
  115|  83.1k|}
_ZN10MD5_native6updateEPhm:
  123|   253k|{
  124|   253k|    unsigned int i, index, partLen;
  125|       |
  126|       |    // Compute number of bytes mod 64
  127|   253k|    index = static_cast<unsigned int>((count[0] >> 3) & 0x3f);
  128|       |
  129|       |    // Update number of bits
  130|   253k|    if ((count[0] += (static_cast<uint32_t>(inputLen) << 3)) <
  ------------------
  |  Branch (130:9): [True: 0, False: 253k]
  ------------------
  131|   253k|        (static_cast<uint32_t>(inputLen) << 3))
  132|      0|        count[1]++;
  133|   253k|    count[1] += (static_cast<uint32_t>(inputLen) >> 29);
  134|       |
  135|   253k|    partLen = 64 - index;
  136|       |
  137|       |    // Transform as many times as possible.
  138|       |
  139|   253k|    if (inputLen >= partLen) {
  ------------------
  |  Branch (139:9): [True: 84.7k, False: 169k]
  ------------------
  140|  84.7k|        memcpy(&buffer[index], input, partLen);
  141|  84.7k|        transform(state, buffer);
  142|       |
  143|   317k|        for (i = partLen; i + 63 < inputLen; i += 64)
  ------------------
  |  Branch (143:27): [True: 232k, False: 84.7k]
  ------------------
  144|   232k|            transform(state, &input[i]);
  145|       |
  146|  84.7k|        index = 0;
  147|  84.7k|    }
  148|   169k|    else
  149|   169k|        i = 0;
  150|       |
  151|       |    // Buffer remaining input
  152|   253k|    memcpy(&buffer[index], &input[i], inputLen-i);
  153|   253k|}
_ZN10MD5_native8finalizeEv:
  158|  83.1k|{
  159|  83.1k|    if (finalized)
  ------------------
  |  Branch (159:9): [True: 0, False: 83.1k]
  ------------------
  160|      0|    {
  161|      0|        return;
  162|      0|    }
  163|       |
  164|  83.1k|    unsigned char bits[8];
  165|  83.1k|    unsigned int index, padLen;
  166|       |
  167|       |    // Save number of bits
  168|  83.1k|    encode(bits, count, 8);
  169|       |
  170|       |    // Pad out to 56 mod 64.
  171|       |
  172|  83.1k|    index = static_cast<unsigned int>((count[0] >> 3) & 0x3f);
  173|  83.1k|    padLen = (index < 56) ? (56 - index) : (120 - index);
  ------------------
  |  Branch (173:14): [True: 83.0k, False: 87]
  ------------------
  174|  83.1k|    update(PADDING, padLen);
  175|       |
  176|       |    // Append length (before padding)
  177|  83.1k|    update(bits, 8);
  178|       |    // Store state in digest_val
  179|  83.1k|    encode(digest_val, state, 16);
  180|       |
  181|       |    // Zeroize sensitive information.
  182|  83.1k|    memset(state, 0, sizeof(state));
  183|  83.1k|    memset(count, 0, sizeof(count));
  184|  83.1k|    memset(buffer, 0, sizeof(buffer));
  185|       |
  186|  83.1k|    finalized = true;
  187|  83.1k|}
_ZN10MD5_native6digestEPh:
  191|  83.1k|{
  192|  83.1k|    memcpy(result, digest_val, sizeof(digest_val));
  193|  83.1k|}
_ZN10MD5_native9transformEPjPh:
  202|   317k|{
  203|   317k|    uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
  204|       |
  205|   317k|    decode(x, block, 64);
  206|       |
  207|       |    // Round 1
  208|   317k|    FF (a, b, c, d, x[ 0], S11, 0xd76aa478); // 1
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  209|   317k|    FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); // 2
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  210|   317k|    FF (c, d, a, b, x[ 2], S13, 0x242070db); // 3
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  211|   317k|    FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); // 4
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  212|   317k|    FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); // 5
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  213|   317k|    FF (d, a, b, c, x[ 5], S12, 0x4787c62a); // 6
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  214|   317k|    FF (c, d, a, b, x[ 6], S13, 0xa8304613); // 7
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  215|   317k|    FF (b, c, d, a, x[ 7], S14, 0xfd469501); // 8
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  216|   317k|    FF (a, b, c, d, x[ 8], S11, 0x698098d8); // 9
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  217|   317k|    FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); // 10
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  218|   317k|    FF (c, d, a, b, x[10], S13, 0xffff5bb1); // 11
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  219|   317k|    FF (b, c, d, a, x[11], S14, 0x895cd7be); // 12
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  220|   317k|    FF (a, b, c, d, x[12], S11, 0x6b901122); // 13
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  221|   317k|    FF (d, a, b, c, x[13], S12, 0xfd987193); // 14
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  222|   317k|    FF (c, d, a, b, x[14], S13, 0xa679438e); // 15
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  223|   317k|    FF (b, c, d, a, x[15], S14, 0x49b40821); // 16
  ------------------
  |  |   77|   317k|#define FF(a, b, c, d, x, s, ac) { \
  |  |   78|   317k| (a) += F ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   67|   317k|#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
  |  |  ------------------
  |  |   79|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   80|   317k| (a) += (b); \
  |  |   81|   317k|  }
  ------------------
  224|       |
  225|       |    // Round 2
  226|   317k|    GG (a, b, c, d, x[ 1], S21, 0xf61e2562); // 17
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  227|   317k|    GG (d, a, b, c, x[ 6], S22, 0xc040b340); // 18
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  228|   317k|    GG (c, d, a, b, x[11], S23, 0x265e5a51); // 19
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  229|   317k|    GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); // 20
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  230|   317k|    GG (a, b, c, d, x[ 5], S21, 0xd62f105d); // 21
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  231|   317k|    GG (d, a, b, c, x[10], S22,  0x2441453); // 22
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  232|   317k|    GG (c, d, a, b, x[15], S23, 0xd8a1e681); // 23
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  233|   317k|    GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); // 24
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  234|   317k|    GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); // 25
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  235|   317k|    GG (d, a, b, c, x[14], S22, 0xc33707d6); // 26
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  236|   317k|    GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); // 27
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  237|   317k|    GG (b, c, d, a, x[ 8], S24, 0x455a14ed); // 28
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  238|   317k|    GG (a, b, c, d, x[13], S21, 0xa9e3e905); // 29
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  239|   317k|    GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); // 30
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  240|   317k|    GG (c, d, a, b, x[ 7], S23, 0x676f02d9); // 31
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  241|   317k|    GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); // 32
  ------------------
  |  |   82|   317k|#define GG(a, b, c, d, x, s, ac) { \
  |  |   83|   317k| (a) += G ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   68|   317k|#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
  |  |  ------------------
  |  |   84|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   85|   317k| (a) += (b); \
  |  |   86|   317k|  }
  ------------------
  242|       |
  243|       |    // Round 3
  244|   317k|    HH (a, b, c, d, x[ 5], S31, 0xfffa3942); // 33
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  245|   317k|    HH (d, a, b, c, x[ 8], S32, 0x8771f681); // 34
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  246|   317k|    HH (c, d, a, b, x[11], S33, 0x6d9d6122); // 35
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  247|   317k|    HH (b, c, d, a, x[14], S34, 0xfde5380c); // 36
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  248|   317k|    HH (a, b, c, d, x[ 1], S31, 0xa4beea44); // 37
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  249|   317k|    HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); // 38
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  250|   317k|    HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); // 39
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  251|   317k|    HH (b, c, d, a, x[10], S34, 0xbebfbc70); // 40
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  252|   317k|    HH (a, b, c, d, x[13], S31, 0x289b7ec6); // 41
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  253|   317k|    HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); // 42
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  254|   317k|    HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); // 43
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  255|   317k|    HH (b, c, d, a, x[ 6], S34,  0x4881d05); // 44
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  256|   317k|    HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); // 45
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  257|   317k|    HH (d, a, b, c, x[12], S32, 0xe6db99e5); // 46
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  258|   317k|    HH (c, d, a, b, x[15], S33, 0x1fa27cf8); // 47
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  259|   317k|    HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); // 48
  ------------------
  |  |   87|   317k|#define HH(a, b, c, d, x, s, ac) { \
  |  |   88|   317k| (a) += H ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   69|   317k|#define H(x, y, z) ((x) ^ (y) ^ (z))
  |  |  ------------------
  |  |   89|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   90|   317k| (a) += (b); \
  |  |   91|   317k|  }
  ------------------
  260|       |
  261|       |    // Round 4
  262|   317k|    II (a, b, c, d, x[ 0], S41, 0xf4292244); // 49
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  263|   317k|    II (d, a, b, c, x[ 7], S42, 0x432aff97); // 50
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  264|   317k|    II (c, d, a, b, x[14], S43, 0xab9423a7); // 51
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  265|   317k|    II (b, c, d, a, x[ 5], S44, 0xfc93a039); // 52
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  266|   317k|    II (a, b, c, d, x[12], S41, 0x655b59c3); // 53
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  267|   317k|    II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); // 54
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  268|   317k|    II (c, d, a, b, x[10], S43, 0xffeff47d); // 55
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  269|   317k|    II (b, c, d, a, x[ 1], S44, 0x85845dd1); // 56
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  270|   317k|    II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); // 57
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  271|   317k|    II (d, a, b, c, x[15], S42, 0xfe2ce6e0); // 58
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  272|   317k|    II (c, d, a, b, x[ 6], S43, 0xa3014314); // 59
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  273|   317k|    II (b, c, d, a, x[13], S44, 0x4e0811a1); // 60
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  274|   317k|    II (a, b, c, d, x[ 4], S41, 0xf7537e82); // 61
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  275|   317k|    II (d, a, b, c, x[11], S42, 0xbd3af235); // 62
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  276|   317k|    II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); // 63
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  277|   317k|    II (b, c, d, a, x[ 9], S44, 0xeb86d391); // 64
  ------------------
  |  |   92|   317k|#define II(a, b, c, d, x, s, ac) { \
  |  |   93|   317k| (a) += I ((b), (c), (d)) + (x) + static_cast<uint32_t>(ac); \
  |  |  ------------------
  |  |  |  |   70|   317k|#define I(x, y, z) ((y) ^ ((x) | (~z)))
  |  |  ------------------
  |  |   94|   317k| (a) = ROTATE_LEFT ((a), (s)); \
  |  |  ------------------
  |  |  |  |   73|   317k|#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
  |  |  ------------------
  |  |   95|   317k| (a) += (b); \
  |  |   96|   317k|  }
  ------------------
  278|       |
  279|   317k|    state[0] += a;
  280|   317k|    state[1] += b;
  281|   317k|    state[2] += c;
  282|   317k|    state[3] += d;
  283|       |
  284|       |    // Zeroize sensitive information.
  285|       |
  286|   317k|    memset (x, 0, sizeof (x));
  287|   317k|}
_ZN10MD5_native6encodeEPhPjm:
  292|   166k|{
  293|   166k|    unsigned int i, j;
  294|       |
  295|   665k|    for (i = 0, j = 0; j < len; i++, j += 4) {
  ------------------
  |  Branch (295:24): [True: 498k, False: 166k]
  ------------------
  296|   498k|        output[j] = static_cast<unsigned char>(input[i] & 0xff);
  297|   498k|        output[j+1] = static_cast<unsigned char>((input[i] >> 8) & 0xff);
  298|   498k|        output[j+2] = static_cast<unsigned char>((input[i] >> 16) & 0xff);
  299|   498k|        output[j+3] = static_cast<unsigned char>((input[i] >> 24) & 0xff);
  300|   498k|    }
  301|   166k|}
_ZN10MD5_native6decodeEPjPhm:
  306|   317k|{
  307|   317k|    unsigned int i, j;
  308|       |
  309|  5.39M|    for (i = 0, j = 0; j < len; i++, j += 4)
  ------------------
  |  Branch (309:24): [True: 5.07M, False: 317k]
  ------------------
  310|  5.07M|        output[i] =
  311|  5.07M|            static_cast<uint32_t>(input[j]) |
  312|  5.07M|            (static_cast<uint32_t>(input[j+1]) << 8) |
  313|  5.07M|            (static_cast<uint32_t>(input[j+2]) << 16) |
  314|  5.07M|            (static_cast<uint32_t>(input[j+3]) << 24);
  315|   317k|}

_ZN10NNTreeImpl4warnERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   32|  7.90k|{
   33|  7.90k|    qpdf.warn(qpdf_e_damaged_pdf, get_description(node), 0, msg);
   34|  7.90k|    if (++error_count > 5 && qpdf.doc().reconstructed_xref()) {
  ------------------
  |  Branch (34:9): [True: 3.61k, False: 4.29k]
  |  Branch (34:30): [True: 2.26k, False: 1.35k]
  ------------------
   35|  2.26k|        error(node, "too many errors - giving up");
   36|  2.26k|    }
   37|  7.90k|}
_ZNK10NNTreeImpl5errorERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   41|  3.99k|{
   42|  3.99k|    throw QPDFExc(qpdf_e_damaged_pdf, qpdf.getFilename(), get_description(node), 0, msg);
   43|  3.99k|}
_ZN14NNTreeIterator12updateIValueEb:
   47|  84.1k|{
   48|       |    // ivalue should never be used inside the class since we return a pointer/reference to it. Every
   49|       |    // bit of code that ever changes what object the iterator points to should take care to call
   50|       |    // updateIValue. Failure to do this means that any old references to *iter will point to
   51|       |    // incorrect objects, though the next dereference of the iterator will fix it. This isn't
   52|       |    // necessarily catastrophic, but it would be confusing. The test suite attempts to exercise
   53|       |    // various cases to ensure we don't introduce that bug in the future, but sadly it's tricky to
   54|       |    // verify by reasoning about the code that this constraint is always satisfied. Whenever we
   55|       |    // update what the iterator points to, we should call setItemNumber, which calls this. If we
   56|       |    // change what the iterator points to in some other way, such as replacing a value or removing
   57|       |    // an item and making the iterator point at a different item in potentially the same position,
   58|       |    // we must call updateIValue as well. These cases are handled, and for good measure, we also
   59|       |    // call updateIValue in operator* and operator->.
   60|       |
   61|  84.1k|    Array items = node[impl.itemsKey()];
   62|  84.1k|    ivalue.first = items[item_number];
   63|  84.1k|    ivalue.second = items[item_number + 1];
   64|  84.1k|    if (ivalue.second) {
  ------------------
  |  Branch (64:9): [True: 81.5k, False: 2.56k]
  ------------------
   65|  81.5k|        return;
   66|  81.5k|    }
   67|       |
   68|  2.56k|    if (item_number < 0 || !node) {
  ------------------
  |  Branch (68:9): [True: 2.50k, False: 56]
  |  Branch (68:28): [True: 0, False: 56]
  ------------------
   69|  2.50k|        util::assertion(
   70|  2.50k|            allow_invalid, "attempt made to dereference an invalid name/number tree iterator");
   71|  2.50k|        return;
   72|  2.50k|    }
   73|     56|    impl.error(node, "update ivalue: items array is too short");
   74|     56|}
_ZN14NNTreeIterator10getNextKidERNS_11PathElementEb:
   78|  1.28k|{
   79|  2.41k|    while (true) {
  ------------------
  |  Branch (79:12): [True: 2.30k, Folded]
  ------------------
   80|  2.30k|        pe.kid_number += backward ? -1 : 1;
  ------------------
  |  Branch (80:26): [True: 0, False: 2.30k]
  ------------------
   81|  2.30k|        Dictionary result = pe.node["/Kids"][pe.kid_number];
   82|  2.30k|        if (result.contains("/Kids") || result.contains(impl.itemsKey())) {
  ------------------
  |  Branch (82:13): [True: 261, False: 2.04k]
  |  Branch (82:13): [True: 599, False: 1.70k]
  |  Branch (82:41): [True: 338, False: 1.70k]
  ------------------
   83|    599|            return result;
   84|    599|        }
   85|  1.70k|        if (pe.kid_number < 0 || std::cmp_greater_equal(pe.kid_number, pe.node["/Kids"].size())) {
  ------------------
  |  Branch (85:13): [True: 0, False: 1.70k]
  |  Branch (85:13): [True: 571, False: 1.13k]
  |  Branch (85:34): [True: 571, False: 1.13k]
  ------------------
   86|    571|            return {};
   87|    571|        }
   88|  1.13k|        impl.warn(pe.node, "skipping over invalid kid at index " + std::to_string(pe.kid_number));
   89|  1.13k|    }
   90|  1.28k|}
_ZN14NNTreeIterator9incrementEb:
   93|  30.3k|{
   94|  30.3k|    if (item_number < 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 30.3k]
  ------------------
   95|      0|        deepen(impl.tree_root, !backward, true);
   96|      0|        return;
   97|      0|    }
   98|       |
   99|  33.9k|    while (valid()) {
  ------------------
  |  Branch (99:12): [True: 32.8k, False: 1.13k]
  ------------------
  100|  32.8k|        item_number += backward ? -2 : 2;
  ------------------
  |  Branch (100:24): [True: 0, False: 32.8k]
  ------------------
  101|  32.8k|        Array items = node[impl.itemsKey()];
  102|  32.8k|        if (item_number < 0 || std::cmp_greater_equal(item_number, items.size())) {
  ------------------
  |  Branch (102:13): [True: 0, False: 32.8k]
  |  Branch (102:32): [True: 1.47k, False: 31.3k]
  ------------------
  103|  1.47k|            setItemNumber(QPDFObjectHandle(), -1);
  104|  2.28k|            while (!path.empty()) {
  ------------------
  |  Branch (104:20): [True: 1.28k, False: 993]
  ------------------
  105|  1.28k|                auto& element = path.back();
  106|  1.28k|                if (auto pe_node = getNextKid(element, backward)) {
  ------------------
  |  Branch (106:26): [True: 599, False: 689]
  ------------------
  107|    599|                    if (deepen(pe_node, !backward, false)) {
  ------------------
  |  Branch (107:25): [True: 479, False: 120]
  ------------------
  108|    479|                        break;
  109|    479|                    }
  110|    689|                } else {
  111|    689|                    path.pop_back();
  112|    689|                }
  113|  1.28k|            }
  114|  1.47k|        }
  115|  32.8k|        if (item_number >= 0) {
  ------------------
  |  Branch (115:13): [True: 31.8k, False: 993]
  ------------------
  116|  31.8k|            items = node[impl.itemsKey()];
  117|  31.8k|            if (std::cmp_greater_equal(item_number + 1, items.size())) {
  ------------------
  |  Branch (117:17): [True: 465, False: 31.3k]
  ------------------
  118|    465|                impl.warn(node, "items array doesn't have enough elements");
  119|  31.3k|            } else if (!impl.keyValid(items[item_number])) {
  ------------------
  |  Branch (119:24): [True: 1.20k, False: 30.1k]
  ------------------
  120|  1.20k|                impl.warn(node, ("item " + std::to_string(item_number) + " has the wrong type"));
  121|  30.1k|            } else if (!impl.value_valid(items[item_number + 1])) {
  ------------------
  |  Branch (121:24): [True: 955, False: 29.2k]
  ------------------
  122|    955|                impl.warn(node, "item " + std::to_string(item_number + 1) + " is invalid");
  123|  29.2k|            } else {
  124|  29.2k|                return;
  125|  29.2k|            }
  126|  31.8k|        }
  127|  32.8k|    }
  128|  30.3k|}
_ZN14NNTreeIterator11resetLimitsEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  132|  6.93k|{
  133|  6.93k|    while (true) {
  ------------------
  |  Branch (133:12): [True: 6.93k, Folded]
  ------------------
  134|  6.93k|        if (parent == path.end()) {
  ------------------
  |  Branch (134:13): [True: 3.60k, False: 3.32k]
  ------------------
  135|  3.60k|            a_node.erase("/Limits");
  136|  3.60k|            return;
  137|  3.60k|        }
  138|       |
  139|  3.32k|        QPDFObjectHandle first;
  140|  3.32k|        QPDFObjectHandle last;
  141|  3.32k|        Array items = a_node[impl.itemsKey()];
  142|  3.32k|        size_t nitems = items.size();
  143|  3.32k|        if (nitems >= 2) {
  ------------------
  |  Branch (143:13): [True: 3.17k, False: 153]
  ------------------
  144|  3.17k|            first = items[0];
  145|  3.17k|            last = items[(nitems - 1u) & ~1u];
  146|  3.17k|        } else {
  147|    153|            Array kids = a_node["/Kids"];
  148|    153|            size_t nkids = kids.size();
  149|    153|            if (nkids > 0) {
  ------------------
  |  Branch (149:17): [True: 153, False: 0]
  ------------------
  150|    153|                Array first_limits = kids[0]["/Limits"];
  151|    153|                if (first_limits.size() >= 2) {
  ------------------
  |  Branch (151:21): [True: 153, False: 0]
  ------------------
  152|    153|                    first = first_limits[0];
  153|    153|                    last = kids[nkids - 1u]["/Limits"][1];
  154|    153|                }
  155|    153|            }
  156|    153|        }
  157|  3.32k|        if (!(first && last)) {
  ------------------
  |  Branch (157:15): [True: 3.32k, False: 0]
  |  Branch (157:24): [True: 3.32k, False: 0]
  ------------------
  158|      0|            impl.warn(a_node, "unable to determine limits");
  159|  3.32k|        } else {
  160|  3.32k|            Array olimits = a_node["/Limits"];
  161|  3.32k|            if (olimits.size() == 2) {
  ------------------
  |  Branch (161:17): [True: 2.90k, False: 420]
  ------------------
  162|  2.90k|                auto ofirst = olimits[0];
  163|  2.90k|                auto olast = olimits[1];
  164|  2.90k|                if (impl.keyValid(ofirst) && impl.keyValid(olast) &&
  ------------------
  |  Branch (164:21): [True: 2.90k, False: 0]
  |  Branch (164:21): [True: 0, False: 2.90k]
  |  Branch (164:46): [True: 2.90k, False: 0]
  ------------------
  165|  2.90k|                    impl.compareKeys(first, ofirst) == 0 && impl.compareKeys(last, olast) == 0) {
  ------------------
  |  Branch (165:21): [True: 2.90k, False: 0]
  |  Branch (165:61): [True: 0, False: 2.90k]
  ------------------
  166|      0|                    return;
  167|      0|                }
  168|  2.90k|            }
  169|  3.32k|            if (a_node != path.begin()->node) {
  ------------------
  |  Branch (169:17): [True: 3.17k, False: 153]
  ------------------
  170|  3.17k|                a_node.replace("/Limits", Array({first, last}));
  171|  3.17k|            }
  172|  3.32k|        }
  173|       |
  174|  3.32k|        if (parent == path.begin()) {
  ------------------
  |  Branch (174:13): [True: 3.32k, False: 0]
  ------------------
  175|  3.32k|            return;
  176|  3.32k|        }
  177|      0|        a_node = parent->node;
  178|      0|        --parent;
  179|      0|    }
  180|  6.93k|}
_ZN14NNTreeIterator5splitEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  184|  6.51k|{
  185|       |    // Split some node along the path to the item pointed to by this iterator, and adjust the
  186|       |    // iterator so it points to the same item.
  187|       |
  188|       |    // In examples, for simplicity, /Nums is shown to just contain numbers instead of pairs. Imagine
  189|       |    // this tree:
  190|       |    //
  191|       |    // root: << /Kids [ A B C D ] >>
  192|       |    // A: << /Nums [ 1 2 3 4 ] >>
  193|       |    // B: << /Nums [ 5 6 7 8 ] >>
  194|       |    // C: << /Nums [ 9 10 11 12 ] >>
  195|       |    // D: << /Kids [ E F ]
  196|       |    // E: << /Nums [ 13 14 15 16 ] >>
  197|       |    // F: << /Nums [ 17 18 19 20 ] >>
  198|       |
  199|       |    // iter1 (points to 19)
  200|       |    //   path:
  201|       |    //   - { node: root: kid_number: 3 }
  202|       |    //   - { node: D, kid_number: 1 }
  203|       |    //   node: F
  204|       |    //   item_number: 2
  205|       |
  206|       |    // iter2 (points to 1)
  207|       |    //   path:
  208|       |    //   - { node: root, kid_number: 0}
  209|       |    //   node: A
  210|       |    //   item_number: 0
  211|       |
  212|  6.51k|    util::assertion(valid(), "NNTreeIterator::split called an invalid iterator");
  213|       |
  214|       |    // Find the array we actually need to split, which is either this node's kids or items.
  215|  6.51k|    Array kids = to_split["/Kids"];
  216|  6.51k|    size_t nkids = kids.size();
  217|  6.51k|    Array items = to_split[impl.itemsKey()];
  218|  6.51k|    size_t nitems = items.size();
  219|       |
  220|  6.51k|    Array first_half;
  221|  6.51k|    size_t n = 0;
  222|  6.51k|    std::string key;
  223|  6.51k|    size_t threshold = static_cast<size_t>(impl.split_threshold);
  224|  6.51k|    if (nkids > 0) {
  ------------------
  |  Branch (224:9): [True: 153, False: 6.35k]
  ------------------
  225|    153|        first_half = kids;
  226|    153|        n = nkids;
  227|    153|        key = "/Kids";
  228|  6.35k|    } else {
  229|  6.35k|        util::assertion(nitems > 0, "NNTreeIterator::split called on invalid node");
  230|  6.35k|        first_half = items;
  231|  6.35k|        n = nitems;
  232|  6.35k|        threshold *= 2;
  233|  6.35k|        key = impl.itemsKey();
  234|  6.35k|    }
  235|       |
  236|  6.51k|    if (n <= threshold) {
  ------------------
  |  Branch (236:9): [True: 6.30k, False: 210]
  ------------------
  237|  6.30k|        return;
  238|  6.30k|    }
  239|       |
  240|    210|    bool is_root = parent == path.end();
  241|    210|    bool is_leaf = nitems > 0;
  242|       |
  243|       |    // CURRENT STATE: tree is in original state; iterator is valid and unchanged.
  244|       |
  245|    210|    if (is_root) {
  ------------------
  |  Branch (245:9): [True: 57, False: 153]
  ------------------
  246|       |        // What we want to do is to create a new node for the second half of the items and put it in
  247|       |        // the parent's /Kids array right after the element that points to the current to_split
  248|       |        // node, but if we're splitting root, there is no parent, so handle that first.
  249|       |
  250|       |        // In the non-root case, parent points to the path element whose /Kids contains the first
  251|       |        // half node, and the first half node is to_split. If we are splitting the root, we need to
  252|       |        // push everything down a level, but we want to keep the actual root object the same so that
  253|       |        // indirect references to it remain intact (and also in case it might be a direct object,
  254|       |        // which it shouldn't be but that case probably exists in the wild). To achieve this, we
  255|       |        // create a new node for the first half and then replace /Kids in the root to contain it.
  256|       |        // Then we adjust the path so that the first element is root and the second element, if any,
  257|       |        // is the new first half. In this way, we make the root case identical to the non-root case
  258|       |        // so remaining logic can handle them in the same way.
  259|       |
  260|     57|        Dictionary first_node = impl.qpdf.makeIndirectObject(Dictionary({{key, first_half}}));
  261|     57|        auto new_kids = Array::empty();
  262|     57|        new_kids.push_back(first_node);
  263|     57|        to_split.erase("/Limits"); // already shouldn't be there for root
  264|     57|        to_split.erase(impl.itemsKey());
  265|     57|        to_split.replace("/Kids", new_kids);
  266|     57|        if (is_leaf) {
  ------------------
  |  Branch (266:13): [True: 57, False: 0]
  ------------------
  267|     57|            node = first_node;
  268|     57|        } else {
  269|      0|            auto next = path.begin();
  270|      0|            next->node = first_node;
  271|      0|        }
  272|     57|        this->path.emplace_front(to_split, 0);
  273|     57|        parent = path.begin();
  274|     57|        to_split = first_node;
  275|     57|    }
  276|       |
  277|       |    // CURRENT STATE: parent is guaranteed to be defined, and we have the invariants that
  278|       |    // parent[/Kids][kid_number] == to_split and (++parent).node == to_split.
  279|       |
  280|       |    // Create a second half array, and transfer the second half of the items into the second half
  281|       |    // array.
  282|    210|    auto second_half = Array::empty();
  283|    210|    auto start_idx = static_cast<int>((n / 2) & ~1u);
  284|  7.35k|    while (std::cmp_greater(first_half.size(), start_idx)) {
  ------------------
  |  Branch (284:12): [True: 7.14k, False: 210]
  ------------------
  285|  7.14k|        second_half.push_back(first_half[start_idx]);
  286|  7.14k|        first_half.erase(start_idx);
  287|  7.14k|    }
  288|    210|    resetLimits(to_split, parent);
  289|       |
  290|       |    // Create a new node to contain the second half
  291|    210|    Dictionary second_node = impl.qpdf.makeIndirectObject(Dictionary({{key, second_half}}));
  292|    210|    resetLimits(second_node, parent);
  293|       |
  294|       |    // CURRENT STATE: half the items from the kids or items array in the node being split have been
  295|       |    // moved into a new node. The new node is not yet attached to the tree. The iterator may have a
  296|       |    // path element or leaf node that is out of bounds.
  297|       |
  298|       |    // We need to adjust the parent to add the second node to /Kids and, if needed, update
  299|       |    // kid_number to traverse through it. We need to update to_split's path element, or the node if
  300|       |    // this is a leaf, so that the kid/item number points to the right place.
  301|       |
  302|    210|    Array parent_kids = parent->node["/Kids"];
  303|    210|    if (!parent_kids) {
  ------------------
  |  Branch (303:9): [True: 0, False: 210]
  ------------------
  304|      0|        impl.error(parent->node, "parent node has no /Kids array");
  305|      0|    }
  306|    210|    parent_kids.insert(parent->kid_number + 1, second_node);
  307|    210|    auto cur_elem = parent;
  308|    210|    ++cur_elem; // points to end() for leaf nodes
  309|    210|    int old_idx = (is_leaf ? item_number : cur_elem->kid_number);
  ------------------
  |  Branch (309:20): [True: 210, False: 0]
  ------------------
  310|    210|    if (old_idx >= start_idx) {
  ------------------
  |  Branch (310:9): [True: 210, False: 0]
  ------------------
  311|    210|        ++parent->kid_number;
  312|    210|        if (is_leaf) {
  ------------------
  |  Branch (312:13): [True: 210, False: 0]
  ------------------
  313|    210|            setItemNumber(second_node, item_number - start_idx);
  314|    210|        } else {
  315|      0|            cur_elem->node = second_node;
  316|      0|            cur_elem->kid_number -= start_idx;
  317|      0|        }
  318|    210|    }
  319|    210|    if (!is_root) {
  ------------------
  |  Branch (319:9): [True: 153, False: 57]
  ------------------
  320|    153|        auto next = parent->node;
  321|    153|        resetLimits(next, parent);
  322|    153|        --parent;
  323|    153|        split(next, parent);
  324|    153|    }
  325|    210|}
_ZN14NNTreeIterator15lastPathElementEv:
  329|  12.7k|{
  330|  12.7k|    return path.empty() ? path.end() : std::prev(path.end());
  ------------------
  |  Branch (330:12): [True: 7.21k, False: 5.50k]
  ------------------
  331|  12.7k|}
_ZN14NNTreeIterator11insertAfterERK16QPDFObjectHandleS2_:
  335|  5.92k|{
  336|  5.92k|    if (!valid()) {
  ------------------
  |  Branch (336:9): [True: 0, False: 5.92k]
  ------------------
  337|      0|        impl.insertFirst(key, value);
  338|      0|        deepen(impl.tree_root, true, false);
  339|      0|        return;
  340|      0|    }
  341|       |
  342|  5.92k|    Array items = node[impl.itemsKey()];
  343|  5.92k|    if (!items) {
  ------------------
  |  Branch (343:9): [True: 0, False: 5.92k]
  ------------------
  344|      0|        impl.error(node, "node contains no items array");
  345|      0|    }
  346|       |
  347|  5.92k|    if (std::cmp_less(items.size(), item_number + 2)) {
  ------------------
  |  Branch (347:9): [True: 0, False: 5.92k]
  ------------------
  348|      0|        impl.error(node, "insert: items array is too short");
  349|      0|    }
  350|  5.92k|    if (!(key && value)) {
  ------------------
  |  Branch (350:11): [True: 5.92k, False: 0]
  |  Branch (350:18): [True: 5.92k, False: 0]
  ------------------
  351|      0|        impl.error(node, "insert: key or value is null");
  352|      0|    }
  353|  5.92k|    if (!impl.value_valid(value)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 5.92k]
  ------------------
  354|      0|        impl.error(node, "insert: value is invalid");
  355|      0|    }
  356|  5.92k|    items.insert(item_number + 2, key);
  357|  5.92k|    items.insert(item_number + 3, value);
  358|  5.92k|    resetLimits(node, lastPathElement());
  359|  5.92k|    split(node, lastPathElement());
  360|  5.92k|    increment(false);
  361|  5.92k|}
_ZNK14NNTreeIteratoreqERKS_:
  455|  28.9k|{
  456|  28.9k|    if (item_number == -1 && other.item_number == -1) {
  ------------------
  |  Branch (456:9): [True: 2.84k, False: 26.1k]
  |  Branch (456:30): [True: 2.84k, False: 0]
  ------------------
  457|  2.84k|        return true;
  458|  2.84k|    }
  459|  26.1k|    if (path.size() != other.path.size()) {
  ------------------
  |  Branch (459:9): [True: 3.07k, False: 23.0k]
  ------------------
  460|  3.07k|        return false;
  461|  3.07k|    }
  462|  23.0k|    auto tpi = path.begin();
  463|  23.0k|    auto opi = other.path.begin();
  464|  23.0k|    while (tpi != path.end()) {
  ------------------
  |  Branch (464:12): [True: 0, False: 23.0k]
  ------------------
  465|      0|        if (tpi->kid_number != opi->kid_number) {
  ------------------
  |  Branch (465:13): [True: 0, False: 0]
  ------------------
  466|      0|            return false;
  467|      0|        }
  468|      0|        ++tpi;
  469|      0|        ++opi;
  470|      0|    }
  471|  23.0k|    return item_number == other.item_number;
  472|  23.0k|}
_ZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbb:
  476|  13.8k|{
  477|       |    // Starting at this node, descend through the first or last kid until we reach a node with
  478|       |    // items. If we succeed, return true; otherwise return false and leave path alone.
  479|       |
  480|  13.8k|    auto opath = path;
  481|       |
  482|  13.8k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  13.8k|        impl.warn(failed_node, msg);
  484|  13.8k|        path = opath;
  485|  13.8k|        return false;
  486|  13.8k|    };
  487|       |
  488|  13.8k|    QPDFObjGen::set seen;
  489|  13.8k|    for (auto const& i: path) {
  ------------------
  |  Branch (489:23): [True: 1.22k, False: 13.8k]
  ------------------
  490|  1.22k|        seen.add(i.node);
  491|  1.22k|    }
  492|  20.8k|    while (true) {
  ------------------
  |  Branch (492:12): [True: 20.8k, Folded]
  ------------------
  493|  20.8k|        if (!seen.add(a_node)) {
  ------------------
  |  Branch (493:13): [True: 239, False: 20.6k]
  ------------------
  494|    239|            return fail(a_node, "loop detected while traversing name/number tree");
  495|    239|        }
  496|       |
  497|  20.6k|        if (!a_node) {
  ------------------
  |  Branch (497:13): [True: 0, False: 20.6k]
  ------------------
  498|      0|            return fail(a_node, "non-dictionary node while traversing name/number tree");
  499|      0|        }
  500|       |
  501|  20.6k|        Array items = a_node[impl.itemsKey()];
  502|  20.6k|        int nitems = static_cast<int>(items.size());
  503|  20.6k|        if (nitems > 1) {
  ------------------
  |  Branch (503:13): [True: 10.9k, False: 9.67k]
  ------------------
  504|  10.9k|            setItemNumber(a_node, first ? 0 : nitems - 2);
  ------------------
  |  Branch (504:35): [True: 10.9k, False: 0]
  ------------------
  505|  10.9k|            return true;
  506|  10.9k|        }
  507|       |
  508|  9.67k|        Array kids = a_node["/Kids"];
  509|  9.67k|        int nkids = static_cast<int>(kids.size());
  510|  9.67k|        if (nkids == 0) {
  ------------------
  |  Branch (510:13): [True: 2.14k, False: 7.52k]
  ------------------
  511|  2.14k|            if (allow_empty && items) {
  ------------------
  |  Branch (511:17): [True: 2.10k, False: 47]
  |  Branch (511:32): [True: 1.05k, False: 1.04k]
  ------------------
  512|  1.05k|                setItemNumber(a_node, -1);
  513|  1.05k|                return true;
  514|  1.05k|            }
  515|  1.09k|            return fail(
  516|  1.09k|                a_node,
  517|  1.09k|                "name/number tree node has neither non-empty " + impl.itemsKey() + " nor /Kids");
  518|  2.14k|        }
  519|       |
  520|  7.52k|        int kid_number = first ? 0 : nkids - 1;
  ------------------
  |  Branch (520:26): [True: 7.52k, False: 0]
  ------------------
  521|  7.52k|        addPathElement(a_node, kid_number);
  522|  7.52k|        Dictionary next = kids[kid_number];
  523|  7.52k|        if (!next) {
  ------------------
  |  Branch (523:13): [True: 509, False: 7.01k]
  ------------------
  524|    509|            return fail(a_node, "kid number " + std::to_string(kid_number) + " is invalid");
  525|    509|        }
  526|  7.01k|        if (!next.indirect()) {
  ------------------
  |  Branch (526:13): [True: 76, False: 6.93k]
  ------------------
  527|     76|            if (impl.auto_repair) {
  ------------------
  |  Branch (527:17): [True: 76, False: 0]
  ------------------
  528|     76|                impl.warn(
  529|     76|                    a_node,
  530|     76|                    "converting kid number " + std::to_string(kid_number) +
  531|     76|                        " to an indirect object");
  532|     76|                next = impl.qpdf.makeIndirectObject(next);
  533|     76|                kids.set(kid_number, next);
  534|     76|            } else {
  535|      0|                impl.warn(
  536|      0|                    a_node,
  537|      0|                    "kid number " + std::to_string(kid_number) + " is not an indirect object");
  538|      0|            }
  539|     76|        }
  540|       |
  541|  7.01k|        a_node = next;
  542|  7.01k|    }
  543|  13.8k|}
_ZN10NNTreeImpl5beginEv:
  547|  13.2k|{
  548|  13.2k|    iterator result(*this);
  549|  13.2k|    result.deepen(tree_root, true, true);
  550|  13.2k|    return result;
  551|  13.2k|}
_ZNK10NNTreeImpl11compareKeysE16QPDFObjectHandleS0_:
  563|  55.7k|{
  564|       |    // We don't call this without calling keyValid first
  565|  55.7k|    qpdf_assert_debug(keyValid(a));
  ------------------
  |  |   11|  55.7k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (565:5): [True: 55.7k, False: 0]
  ------------------
  566|  55.7k|    qpdf_assert_debug(keyValid(b));
  ------------------
  |  |   11|  55.7k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (566:5): [True: 55.7k, False: 0]
  ------------------
  567|  55.7k|    if (key_type == ::ot_string) {
  ------------------
  |  Branch (567:9): [True: 46.7k, False: 9.05k]
  ------------------
  568|  46.7k|        auto as = a.getUTF8Value();
  569|  46.7k|        auto bs = b.getUTF8Value();
  570|  46.7k|        return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (570:16): [True: 1.32k, False: 45.3k]
  |  Branch (570:32): [True: 42.3k, False: 3.06k]
  ------------------
  571|  46.7k|    }
  572|  9.05k|    auto as = a.getIntValue();
  573|  9.05k|    auto bs = b.getIntValue();
  574|  9.05k|    return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (574:12): [True: 2.56k, False: 6.49k]
  |  Branch (574:28): [True: 6.26k, False: 233]
  ------------------
  575|  55.7k|}
_ZNK10NNTreeImpl12binarySearchERK16QPDFObjectHandleRKN4qpdf5ArrayEmbb:
  584|  11.7k|{
  585|  11.7k|    size_t max_idx = std::bit_ceil(num_items);
  586|       |
  587|  11.7k|    int step = static_cast<int>(max_idx / 2);
  588|  11.7k|    int checks = static_cast<int>(std::bit_width(max_idx)); // AppImage gcc version returns size_t
  589|  11.7k|    int idx = step;
  590|  11.7k|    int found_idx = -1;
  591|       |
  592|  56.7k|    for (int i = 0; i < checks; ++i) {
  ------------------
  |  Branch (592:21): [True: 45.8k, False: 10.9k]
  ------------------
  593|  45.8k|        int status = -1;
  594|  45.8k|        if (std::cmp_less(idx, num_items)) {
  ------------------
  |  Branch (594:13): [True: 29.1k, False: 16.7k]
  ------------------
  595|  29.1k|            status = search_kids ? compareKeyKid(key, items, idx) : compareKeyItem(key, items, idx);
  ------------------
  |  Branch (595:22): [True: 7.28k, False: 21.8k]
  ------------------
  596|  29.1k|            if (status == 0) {
  ------------------
  |  Branch (596:17): [True: 848, False: 28.2k]
  ------------------
  597|    848|                return idx;
  598|    848|            }
  599|  28.2k|            if (status > 0) {
  ------------------
  |  Branch (599:17): [True: 25.3k, False: 2.97k]
  ------------------
  600|  25.3k|                found_idx = idx;
  601|  25.3k|            }
  602|  28.2k|        }
  603|  45.0k|        step = std::max(step / 2, 1);
  604|  45.0k|        idx += status * step;
  605|  45.0k|    }
  606|  10.9k|    return return_prev_if_not_found ? found_idx : -1;
  ------------------
  |  Branch (606:12): [True: 9.99k, False: 918]
  ------------------
  607|  11.7k|}
_ZNK10NNTreeImpl14compareKeyItemERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  611|  21.8k|{
  612|  21.8k|    if (!keyValid(items[2 * idx])) {
  ------------------
  |  Branch (612:9): [True: 183, False: 21.6k]
  ------------------
  613|    183|        error(tree_root, ("item at index " + std::to_string(2 * idx) + " is not the right type"));
  614|    183|    }
  615|  21.8k|    return compareKeys(key, items[2 * idx]);
  616|  21.8k|}
_ZNK10NNTreeImpl13compareKeyKidERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  620|  7.28k|{
  621|  7.28k|    Dictionary kid = kids[idx];
  622|  7.28k|    if (!kid) {
  ------------------
  |  Branch (622:9): [True: 121, False: 7.16k]
  ------------------
  623|    121|        error(tree_root, "invalid kid at index " + std::to_string(idx));
  624|    121|    }
  625|  7.28k|    Array limits = kid["/Limits"];
  626|  7.28k|    if (!(keyValid(limits[0]) && keyValid(limits[1]))) {
  ------------------
  |  Branch (626:9): [True: 191, False: 7.09k]
  |  Branch (626:11): [True: 7.05k, False: 229]
  |  Branch (626:34): [True: 6.97k, False: 83]
  ------------------
  627|    191|        error(kids[idx], "node is missing /Limits");
  628|    191|    }
  629|  7.28k|    if (compareKeys(key, limits[0]) < 0) {
  ------------------
  |  Branch (629:9): [True: 713, False: 6.56k]
  ------------------
  630|    713|        return -1;
  631|    713|    }
  632|  6.56k|    if (compareKeys(key, limits[1]) > 0) {
  ------------------
  |  Branch (632:9): [True: 5.67k, False: 890]
  ------------------
  633|  5.67k|        return 1;
  634|  5.67k|    }
  635|    890|    return 0;
  636|  6.56k|}
_ZN10NNTreeImpl6repairEv:
  657|    744|{
  658|    744|    auto new_node = Dictionary({{itemsKey(), Array::empty()}});
  659|    744|    NNTreeImpl repl(qpdf, new_node, key_type, value_valid, false);
  660|    744|    std::map<QPDFObjectHandle, QPDFObjectHandle, Cmp> items;
  661|  23.2k|    for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (661:34): [True: 23.2k, False: 744]
  ------------------
  662|  23.2k|        if (key && value && repl.keyValid(key) && repl.value_valid(value)) {
  ------------------
  |  Branch (662:13): [True: 23.1k, False: 11]
  |  Branch (662:13): [True: 22.8k, False: 340]
  |  Branch (662:20): [True: 23.1k, False: 0]
  |  Branch (662:29): [True: 23.0k, False: 179]
  |  Branch (662:51): [True: 22.8k, False: 150]
  ------------------
  663|  22.8k|            items.insert_or_assign(key, value);
  664|  22.8k|        }
  665|  23.2k|    }
  666|  6.35k|    for (auto const& [key, value]: items) {
  ------------------
  |  Branch (666:34): [True: 6.35k, False: 744]
  ------------------
  667|  6.35k|        repl.insert(key, value);
  668|  6.35k|    }
  669|    744|    tree_root.replace("/Kids", new_node["/Kids"]);
  670|    744|    tree_root.replace(itemsKey(), new_node[itemsKey()]);
  671|    744|}
_ZN10NNTreeImpl4findERK16QPDFObjectHandleb:
  675|  10.6k|{
  676|  10.6k|    try {
  677|  10.6k|        return findInternal(key, return_prev_if_not_found);
  678|  10.6k|    } catch (QPDFExc& e) {
  679|  1.59k|        if (auto_repair) {
  ------------------
  |  Branch (679:13): [True: 1.59k, False: 0]
  ------------------
  680|  1.59k|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  681|  1.59k|            repair();
  682|  1.59k|            return findInternal(key, return_prev_if_not_found);
  683|  1.59k|        } else {
  684|      0|            throw;
  685|      0|        }
  686|  1.59k|    }
  687|  10.6k|}
_ZN10NNTreeImpl12findInternalERK16QPDFObjectHandleb:
  691|  10.6k|{
  692|  10.6k|    auto first_item = begin();
  693|  10.6k|    if (!first_item.valid()) {
  ------------------
  |  Branch (693:9): [True: 1.46k, False: 9.21k]
  ------------------
  694|  1.46k|        return end();
  695|  1.46k|    }
  696|  9.21k|    if (!keyValid(first_item->first)) {
  ------------------
  |  Branch (696:9): [True: 99, False: 9.11k]
  ------------------
  697|     99|        error(tree_root, "encountered invalid key in find");
  698|     99|    }
  699|  9.21k|    if (!value_valid(first_item->second)) {
  ------------------
  |  Branch (699:9): [True: 300, False: 8.91k]
  ------------------
  700|    300|        error(tree_root, "encountered invalid value in find");
  701|    300|    }
  702|  9.21k|    if (compareKeys(key, first_item->first) < 0) {
  ------------------
  |  Branch (702:9): [True: 131, False: 9.08k]
  ------------------
  703|       |        // Before the first key
  704|    131|        return end();
  705|    131|    }
  706|       |
  707|  9.08k|    QPDFObjGen::set seen;
  708|  9.08k|    auto node = tree_root;
  709|  9.08k|    iterator result(*this);
  710|       |
  711|  13.1k|    while (true) {
  ------------------
  |  Branch (711:12): [True: 11.8k, Folded]
  ------------------
  712|  11.8k|        if (!seen.add(node)) {
  ------------------
  |  Branch (712:13): [True: 35, False: 11.8k]
  ------------------
  713|     35|            error(node, "loop detected in find");
  714|     35|        }
  715|       |
  716|  11.8k|        Array items = node[itemsKey()];
  717|  11.8k|        size_t nitems = items.size();
  718|  11.8k|        if (nitems > 1) {
  ------------------
  |  Branch (718:13): [True: 7.74k, False: 4.10k]
  ------------------
  719|  7.74k|            int idx = binarySearch(key, items, nitems / 2, return_prev_if_not_found, false);
  720|  7.74k|            if (idx >= 0) {
  ------------------
  |  Branch (720:17): [True: 7.11k, False: 631]
  ------------------
  721|  7.11k|                result.setItemNumber(node, 2 * idx);
  722|  7.11k|                if (!result.impl.keyValid(result.ivalue.first)) {
  ------------------
  |  Branch (722:21): [True: 0, False: 7.11k]
  ------------------
  723|      0|                    error(node, "encountered invalid key in find");
  724|      0|                }
  725|  7.11k|                if (!result.impl.value_valid(result.ivalue.second)) {
  ------------------
  |  Branch (725:21): [True: 71, False: 7.04k]
  ------------------
  726|     71|                    error(tree_root, "encountered invalid value in find");
  727|     71|                }
  728|  7.11k|            }
  729|  7.74k|            return result;
  730|  7.74k|        }
  731|       |
  732|  4.10k|        Array kids = node["/Kids"];
  733|  4.10k|        size_t nkids = kids.size();
  734|  4.10k|        if (nkids == 0) {
  ------------------
  |  Branch (734:13): [True: 52, False: 4.05k]
  ------------------
  735|     52|            error(node, "bad node during find");
  736|     52|        }
  737|  4.10k|        int idx = binarySearch(key, kids, nkids, true, true);
  738|  4.10k|        if (idx == -1) {
  ------------------
  |  Branch (738:13): [True: 38, False: 4.06k]
  ------------------
  739|     38|            error(node, "unexpected -1 from binary search of kids; limits may by wrong");
  740|     38|        }
  741|  4.10k|        result.addPathElement(node, idx);
  742|  4.10k|        node = kids[idx];
  743|  4.10k|    }
  744|  9.08k|}
_ZN10NNTreeImpl11insertFirstERK16QPDFObjectHandleS2_:
  748|    437|{
  749|    437|    auto iter = begin();
  750|    437|    Array items = iter.node[items_key];
  751|    437|    if (!items) {
  ------------------
  |  Branch (751:9): [True: 0, False: 437]
  ------------------
  752|      0|        error(tree_root, "unable to find a valid items node");
  753|      0|    }
  754|    437|    if (!(key && value)) {
  ------------------
  |  Branch (754:11): [True: 437, False: 0]
  |  Branch (754:18): [True: 437, False: 0]
  ------------------
  755|      0|        error(tree_root, "unable to insert null key or value");
  756|      0|    }
  757|    437|    if (!value_valid(value)) {
  ------------------
  |  Branch (757:9): [True: 0, False: 437]
  ------------------
  758|      0|        error(tree_root, "attempting to insert an invalid value");
  759|      0|    }
  760|    437|    items.insert(0, key);
  761|    437|    items.insert(1, value);
  762|    437|    iter.setItemNumber(iter.node, 0);
  763|    437|    iter.resetLimits(iter.node, iter.lastPathElement());
  764|    437|    iter.split(iter.node, iter.lastPathElement());
  765|    437|    return iter;
  766|    437|}
_ZN10NNTreeImpl6insertERK16QPDFObjectHandleS2_:
  770|  6.35k|{
  771|  6.35k|    auto iter = find(key, true);
  772|  6.35k|    if (!iter.valid()) {
  ------------------
  |  Branch (772:9): [True: 437, False: 5.92k]
  ------------------
  773|    437|        return insertFirst(key, value);
  774|  5.92k|    } else if (compareKeys(key, iter->first) == 0) {
  ------------------
  |  Branch (774:16): [True: 0, False: 5.92k]
  ------------------
  775|      0|        Array items = iter.node[itemsKey()];
  776|      0|        items.set(iter.item_number + 1, value);
  777|      0|        iter.updateIValue();
  778|  5.92k|    } else {
  779|  5.92k|        iter.insertAfter(key, value);
  780|  5.92k|    }
  781|  5.92k|    return iter;
  782|  6.35k|}
_ZN10NNTreeImpl8validateEb:
  800|  1.41k|{
  801|  1.41k|    bool first = true;
  802|  1.41k|    QPDFObjectHandle last_key;
  803|  1.41k|    try {
  804|  1.82k|        for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (804:38): [True: 1.82k, False: 1.41k]
  ------------------
  805|  1.82k|            if (!keyValid(key)) {
  ------------------
  |  Branch (805:17): [True: 185, False: 1.63k]
  ------------------
  806|    185|                error(tree_root, "invalid key in validate");
  807|    185|            }
  808|  1.82k|            if (!value_valid(value)) {
  ------------------
  |  Branch (808:17): [True: 149, False: 1.67k]
  ------------------
  809|    149|                error(tree_root, "invalid value in validate");
  810|    149|            }
  811|  1.82k|            if (first) {
  ------------------
  |  Branch (811:17): [True: 671, False: 1.15k]
  ------------------
  812|    671|                first = false;
  813|  1.15k|            } else if (last_key && compareKeys(last_key, key) != -1) {
  ------------------
  |  Branch (813:24): [True: 818, False: 334]
  |  Branch (813:24): [True: 256, False: 896]
  |  Branch (813:36): [True: 256, False: 562]
  ------------------
  814|    256|                error(tree_root, "keys are not sorted in validate");
  815|    256|            }
  816|  1.82k|            last_key = key;
  817|  1.82k|        }
  818|  1.41k|    } catch (QPDFExc& e) {
  819|    634|        if (a_repair) {
  ------------------
  |  Branch (819:13): [True: 634, False: 0]
  ------------------
  820|    634|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  821|    634|            repair();
  822|    634|        }
  823|    634|        return false;
  824|    634|    }
  825|    777|    return true;
  826|  1.41k|}
_ZN24QPDFNameTreeObjectHelperD2Ev:
  847|    624|QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() = default;
_ZN24QPDFNameTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
  860|    624|    QPDFObjectHelper(oh),
  861|    624|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
  862|    624|{
  863|    624|}
_ZN24QPDFNameTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
  872|  1.80k|    impl(i)
  873|  1.80k|{
  874|  1.80k|}
_ZN24QPDFNameTreeObjectHelper8iterator12updateIValueEv:
  900|    117|{
  901|    117|    if (impl->valid()) {
  ------------------
  |  Branch (901:9): [True: 117, False: 0]
  ------------------
  902|    117|        auto p = *impl;
  903|    117|        ivalue.first = p->first.getUTF8Value();
  904|    117|        ivalue.second = p->second;
  905|    117|    } else {
  906|      0|        ivalue.first = "";
  907|      0|        ivalue.second = QPDFObjectHandle();
  908|      0|    }
  909|    117|}
_ZN24QPDFNameTreeObjectHelper8iteratorptEv:
  920|    117|{
  921|    117|    updateIValue();
  922|    117|    return &ivalue;
  923|    117|}
_ZNK24QPDFNameTreeObjectHelper8iteratoreqERKS0_:
  927|    900|{
  928|    900|    return *(impl) == *(other.impl);
  929|    900|}
_ZNK24QPDFNameTreeObjectHelper3endEv:
  953|    900|{
  954|    900|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
  955|    900|}
_ZN24QPDFNameTreeObjectHelper4findERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  965|  1.38k|{
  966|  1.38k|    auto i = m->impl.find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found);
  967|  1.38k|    return {std::make_shared<NNTreeIterator>(i)};
  968|  1.38k|}
_ZN24QPDFNameTreeObjectHelper10findObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER16QPDFObjectHandle:
  992|  1.38k|{
  993|  1.38k|    auto i = find(name);
  994|  1.38k|    if (i == end()) {
  ------------------
  |  Branch (994:9): [True: 783, False: 600]
  ------------------
  995|    783|        return false;
  996|    783|    }
  997|    600|    oh = i->second;
  998|    600|    return true;
  999|  1.38k|}
_ZN24QPDFNameTreeObjectHelper8validateEb:
 1017|    624|{
 1018|    624|    return m->impl.validate(repair);
 1019|    624|}
_ZN26QPDFNumberTreeObjectHelperD2Ev:
 1042|    788|QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() = default;
_ZN26QPDFNumberTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
 1056|    788|    QPDFObjectHelper(oh),
 1057|    788|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
 1058|    788|{
 1059|    788|}
_ZN26QPDFNumberTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
 1068|  3.65k|    impl(i)
 1069|  3.65k|{
 1070|  3.65k|}
_ZN26QPDFNumberTreeObjectHelper8iterator12updateIValueEv:
 1096|  3.01k|{
 1097|  3.01k|    if (impl->valid()) {
  ------------------
  |  Branch (1097:9): [True: 3.01k, False: 0]
  ------------------
 1098|  3.01k|        auto p = *impl;
 1099|  3.01k|        this->ivalue.first = p->first.getIntValue();
 1100|  3.01k|        this->ivalue.second = p->second;
 1101|  3.01k|    } else {
 1102|      0|        this->ivalue.first = 0;
 1103|      0|        this->ivalue.second = QPDFObjectHandle();
 1104|      0|    }
 1105|  3.01k|}
_ZN26QPDFNumberTreeObjectHelper8iteratorptEv:
 1116|  3.01k|{
 1117|  3.01k|    updateIValue();
 1118|  3.01k|    return &this->ivalue;
 1119|  3.01k|}
_ZNK26QPDFNumberTreeObjectHelper8iteratoreqERKS0_:
 1123|  1.82k|{
 1124|  1.82k|    return *(impl) == *(other.impl);
 1125|  1.82k|}
_ZNK26QPDFNumberTreeObjectHelper3endEv:
 1149|  1.82k|{
 1150|  1.82k|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
 1151|  1.82k|}
_ZN26QPDFNumberTreeObjectHelper4findExb:
 1161|  2.86k|{
 1162|  2.86k|    auto i = m->impl.find(QPDFObjectHandle::newInteger(key), return_prev_if_not_found);
 1163|  2.86k|    return {std::make_shared<NNTreeIterator>(i)};
 1164|  2.86k|}
_ZN26QPDFNumberTreeObjectHelper19findObjectAtOrBelowExR16QPDFObjectHandleRx:
 1220|  2.86k|{
 1221|  2.86k|    auto i = find(idx, true);
 1222|  2.86k|    if (i == end()) {
  ------------------
  |  Branch (1222:9): [True: 823, False: 2.04k]
  ------------------
 1223|    823|        return false;
 1224|    823|    }
 1225|  2.04k|    oh = i->second;
 1226|  2.04k|    QIntC::range_check_subtract(idx, i->first);
 1227|  2.04k|    offset = idx - i->first;
 1228|  2.04k|    return true;
 1229|  2.86k|}
_ZN26QPDFNumberTreeObjectHelper8validateEb:
 1247|    788|{
 1248|    788|    return m->impl.validate(repair);
 1249|    788|}
NNTree.cc:_ZL15get_descriptionRK16QPDFObjectHandle:
   22|  11.9k|{
   23|  11.9k|    std::string result("Name/Number tree node");
   24|  11.9k|    if (node.indirect()) {
  ------------------
  |  Branch (24:9): [True: 9.89k, False: 2.01k]
  ------------------
   25|  9.89k|        result += " (object " + std::to_string(node.getObjectID()) + ")";
   26|  9.89k|    }
   27|  11.9k|    return result;
   28|  11.9k|}
NNTree.cc:_ZZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbbENK3$_0clERKS1_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  482|  1.84k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  1.84k|        impl.warn(failed_node, msg);
  484|  1.84k|        path = opath;
  485|  1.84k|        return false;
  486|  1.84k|    };
NNTree.cc:_ZNK12_GLOBAL__N_13CmpclERK16QPDFObjectHandleS3_:
  644|   162k|        {
  645|   162k|            Integer l = lhs;
  646|   162k|            Integer r = rhs;
  647|   162k|            if (l && r) {
  ------------------
  |  Branch (647:17): [True: 6.64k, False: 155k]
  |  Branch (647:22): [True: 6.64k, False: 0]
  ------------------
  648|  6.64k|                return l.value() < r.value();
  649|  6.64k|            }
  650|   155k|            return lhs.getUTF8Value() < rhs.getUTF8Value();
  651|   162k|        }
_ZN24QPDFNameTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
  836|    624|        impl(q, oh, ::ot_string, value_validator, auto_repair)
  837|    624|    {
  838|    624|    }
_ZN24QPDFNameTreeObjectHelper7MembersD2Ev:
  840|    624|    ~Members() = default;
_ZN26QPDFNumberTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
 1031|    788|        impl(q, oh, ::ot_integer, value_validator, auto_repair)
 1032|    788|    {
 1033|    788|    }
_ZN26QPDFNumberTreeObjectHelper7MembersD2Ev:
 1035|    788|    ~Members() = default;

_ZN17OffsetInputSourceC2ENSt3__110shared_ptrI11InputSourceEEx:
   13|  1.12k|    proxied(proxied),
   14|  1.12k|    global_offset(global_offset)
   15|  1.12k|{
   16|  1.12k|    util::assertion(global_offset >= 0, "OffsetInputSource constructed with negative offset");
   17|  1.12k|    max_safe_offset = std::numeric_limits<qpdf_offset_t>::max() - global_offset;
   18|  1.12k|}
_ZN17OffsetInputSource18findAndSkipNextEOLEv:
   22|   253k|{
   23|   253k|    return proxied->findAndSkipNextEOL() - global_offset;
   24|   253k|}
_ZNK17OffsetInputSource7getNameEv:
   28|  99.8k|{
   29|  99.8k|    return proxied->getName();
   30|  99.8k|}
_ZN17OffsetInputSource4tellEv:
   34|  3.96M|{
   35|  3.96M|    return proxied->tell() - global_offset;
   36|  3.96M|}
_ZN17OffsetInputSource4seekExi:
   40|  1.68M|{
   41|  1.68M|    if (whence == SEEK_SET) {
  ------------------
  |  Branch (41:9): [True: 1.65M, False: 27.0k]
  ------------------
   42|  1.65M|        if (offset > max_safe_offset) {
  ------------------
  |  Branch (42:13): [True: 5, False: 1.65M]
  ------------------
   43|      5|            std::ostringstream msg;
   44|      5|            msg.imbue(std::locale::classic());
   45|      5|            msg << "seeking to " << offset << " offset by " << global_offset
   46|      5|                << " would cause an overflow of the offset type";
   47|      5|            throw std::range_error(msg.str());
   48|      5|        }
   49|  1.65M|        proxied->seek(offset + global_offset, whence);
   50|  1.65M|    } else {
   51|  27.0k|        proxied->seek(offset, whence);
   52|  27.0k|    }
   53|  1.68M|    util::no_ci_rt_error_if(tell() < 0, "offset input source: seek before beginning of file");
   54|  1.68M|}
_ZN17OffsetInputSource4readEPcm:
   64|   423k|{
   65|   423k|    size_t result = proxied->read(buffer, length);
   66|   423k|    setLastOffset(proxied->getLastOffset() - global_offset);
   67|   423k|    return result;
   68|   423k|}
_ZN17OffsetInputSource8unreadChEc:
   72|    402|{
   73|    402|    proxied->unreadCh(ch);
   74|    402|}

_ZN8PipelineC2EPKcPS_:
   11|   787k|    identifier(identifier),
   12|   787k|    next_(next)
   13|   787k|{
   14|   787k|}
_ZN8Pipeline9writeCStrEPKc:
   32|  3.31M|{
   33|  3.31M|    write(cstr, strlen(cstr));
   34|  3.31M|}
_ZN8Pipeline11writeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   38|  14.8M|{
   39|  14.8M|    write(str.c_str(), str.length());
   40|  14.8M|}
_ZN8PipelinelsEPKc:
   44|  3.30M|{
   45|  3.30M|    writeCStr(cstr);
   46|  3.30M|    return *this;
   47|  3.30M|}
_ZN8PipelinelsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   51|  3.17M|{
   52|  3.17M|    writeString(str);
   53|  3.17M|    return *this;
   54|  3.17M|}
_ZN8Pipeline5writeEPKcm:
  114|  18.4M|{
  115|  18.4M|    write(reinterpret_cast<unsigned char const*>(data), len);
  116|  18.4M|}

_ZN10Pl_AES_PDFC2EPKcP8PipelinebNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   16|   187k|    Pipeline(identifier, next),
   17|   187k|    key(key),
   18|   187k|    crypto(QPDFCryptoProvider::getImpl()),
   19|   187k|    encrypt(encrypt)
   20|   187k|{
   21|   187k|    util::assertion(next, "Attempt to create Pl_AES_PDF with nullptr as next");
   22|   187k|    util::no_ci_rt_error_if(!(key.size() == 32 || key.size() == 16), "unsupported key length");
  ------------------
  |  Branch (22:31): [True: 5.72k, False: 181k]
  |  Branch (22:51): [True: 181k, False: 2]
  ------------------
   23|   187k|    std::memset(this->inbuf, 0, this->buf_size);
   24|   187k|    std::memset(this->outbuf, 0, this->buf_size);
   25|   187k|    std::memset(this->cbc_block, 0, this->buf_size);
   26|   187k|}
_ZN10Pl_AES_PDF9useZeroIVEv:
   30|    980|{
   31|    980|    use_zero_iv = true;
   32|    980|}
_ZN10Pl_AES_PDF14disablePaddingEv:
   36|   180k|{
   37|   180k|    disable_padding = true;
   38|   180k|}
_ZN10Pl_AES_PDF5setIVEPKhm:
   42|   179k|{
   43|   179k|    util::assertion(
   44|   179k|        bytes == buf_size,
   45|   179k|        "Pl_AES_PDF: specified initialization vector size in bytes must be " +
   46|   179k|            std::to_string(bytes));
   47|   179k|    use_specified_iv = true;
   48|   179k|    memcpy(specified_iv, iv, bytes);
   49|   179k|}
_ZN10Pl_AES_PDF5writeEPKhm:
   65|  11.4M|{
   66|  11.4M|    size_t bytes_left = len;
   67|  11.4M|    unsigned char const* p = data;
   68|       |
   69|  63.4M|    while (bytes_left > 0) {
  ------------------
  |  Branch (69:12): [True: 51.9M, False: 11.4M]
  ------------------
   70|  51.9M|        if (offset == buf_size) {
  ------------------
  |  Branch (70:13): [True: 51.7M, False: 186k]
  ------------------
   71|  51.7M|            flush(false);
   72|  51.7M|        }
   73|       |
   74|  51.9M|        size_t available = buf_size - offset;
   75|  51.9M|        size_t bytes = (bytes_left < available ? bytes_left : available);
  ------------------
  |  Branch (75:25): [True: 6.12k, False: 51.9M]
  ------------------
   76|  51.9M|        bytes_left -= bytes;
   77|  51.9M|        std::memcpy(inbuf + offset, p, bytes);
   78|  51.9M|        offset += bytes;
   79|  51.9M|        p += bytes;
   80|  51.9M|    }
   81|  11.4M|}
_ZN10Pl_AES_PDF6finishEv:
   85|   187k|{
   86|   187k|    if (encrypt) {
  ------------------
  |  Branch (86:9): [True: 179k, False: 7.91k]
  ------------------
   87|   179k|        if (offset == buf_size) {
  ------------------
  |  Branch (87:13): [True: 179k, False: 0]
  ------------------
   88|   179k|            flush(false);
   89|   179k|        }
   90|   179k|        if (!disable_padding) {
  ------------------
  |  Branch (90:13): [True: 0, False: 179k]
  ------------------
   91|       |            // Pad as described in section 3.5.1 of version 1.7 of the PDF specification, including
   92|       |            // providing an entire block of padding if the input was a multiple of 16 bytes.
   93|      0|            unsigned char pad = QIntC::to_uchar(buf_size - offset);
   94|      0|            memset(inbuf + offset, pad, pad);
   95|      0|            offset = buf_size;
   96|      0|            flush(false);
   97|      0|        }
   98|   179k|    } else {
   99|  7.91k|        if (offset != buf_size) {
  ------------------
  |  Branch (99:13): [True: 6.90k, False: 1.01k]
  ------------------
  100|       |            // This is never supposed to happen as the output is always supposed to be padded.
  101|       |            // However, we have encountered files for which the output is not a multiple of the
  102|       |            // block size.  In this case, pad with zeroes and hope for the best.
  103|  6.90k|            util::assertion(offset < buf_size, "buffer overflow in AES encryption pipeline");
  104|  6.90k|            std::memset(inbuf + offset, 0, buf_size - offset);
  105|  6.90k|            offset = buf_size;
  106|  6.90k|        }
  107|  7.91k|        flush(!disable_padding);
  108|  7.91k|    }
  109|   187k|    crypto->rijndael_finalize();
  110|   187k|    next()->finish();
  111|   187k|}
_ZN10Pl_AES_PDF16initializeVectorEv:
  115|   180k|{
  116|   180k|    if (use_zero_iv) {
  ------------------
  |  Branch (116:9): [True: 980, False: 179k]
  ------------------
  117|  16.6k|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (117:34): [True: 15.6k, False: 980]
  ------------------
  118|  15.6k|            cbc_block[i] = 0;
  119|  15.6k|        }
  120|   179k|    } else if (use_specified_iv) {
  ------------------
  |  Branch (120:16): [True: 179k, False: 0]
  ------------------
  121|   179k|        std::memcpy(cbc_block, specified_iv, buf_size);
  122|   179k|    } else if (use_static_iv) {
  ------------------
  |  Branch (122:16): [True: 0, False: 0]
  ------------------
  123|      0|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (123:34): [True: 0, False: 0]
  ------------------
  124|      0|            cbc_block[i] = static_cast<unsigned char>(14U * (1U + i));
  125|      0|        }
  126|      0|    } else {
  127|      0|        QUtil::initializeWithRandomBytes(cbc_block, buf_size);
  128|      0|    }
  129|   180k|}
_ZN10Pl_AES_PDF5flushEb:
  133|  51.9M|{
  134|  51.9M|    util::assertion(offset == buf_size, "AES pipeline: flush called when buffer was not full");
  135|       |
  136|  51.9M|    if (first) {
  ------------------
  |  Branch (136:9): [True: 187k, False: 51.7M]
  ------------------
  137|   187k|        first = false;
  138|   187k|        bool return_after_init = false;
  139|   187k|        if (cbc_mode) {
  ------------------
  |  Branch (139:13): [True: 187k, False: 0]
  ------------------
  140|   187k|            if (encrypt) {
  ------------------
  |  Branch (140:17): [True: 179k, False: 7.91k]
  ------------------
  141|       |                // Set cbc_block to the initialization vector, and if not zero, write it to the
  142|       |                // output stream.
  143|   179k|                initializeVector();
  144|   179k|                if (!(use_zero_iv || use_specified_iv)) {
  ------------------
  |  Branch (144:23): [True: 0, False: 179k]
  |  Branch (144:38): [True: 179k, False: 0]
  ------------------
  145|      0|                    next()->write(cbc_block, buf_size);
  146|      0|                }
  147|   179k|            } else if (use_zero_iv || use_specified_iv) {
  ------------------
  |  Branch (147:24): [True: 980, False: 6.93k]
  |  Branch (147:39): [True: 0, False: 6.93k]
  ------------------
  148|       |                // Initialize vector with zeroes; zero vector was not written to the beginning of
  149|       |                // the input file.
  150|    980|                initializeVector();
  151|  6.93k|            } else {
  152|       |                // Take the first block of input as the initialization vector.  There's nothing to
  153|       |                // write at this time.
  154|  6.93k|                memcpy(cbc_block, inbuf, buf_size);
  155|  6.93k|                offset = 0;
  156|  6.93k|                return_after_init = true;
  157|  6.93k|            }
  158|   187k|        }
  159|   187k|        crypto->rijndael_init(
  160|   187k|            encrypt,
  161|   187k|            reinterpret_cast<const unsigned char*>(key.data()),
  162|   187k|            key.size(),
  163|   187k|            cbc_mode,
  164|   187k|            cbc_block);
  165|   187k|        if (return_after_init) {
  ------------------
  |  Branch (165:13): [True: 6.93k, False: 180k]
  ------------------
  166|  6.93k|            return;
  167|  6.93k|        }
  168|   187k|    }
  169|       |
  170|  51.9M|    crypto->rijndael_process(inbuf, outbuf);
  171|  51.9M|    unsigned int bytes = buf_size;
  172|  51.9M|    if (strip_padding) {
  ------------------
  |  Branch (172:9): [True: 3.90k, False: 51.9M]
  ------------------
  173|  3.90k|        unsigned char last = outbuf[buf_size - 1];
  174|  3.90k|        if (last <= buf_size) {
  ------------------
  |  Branch (174:13): [True: 826, False: 3.07k]
  ------------------
  175|    826|            bool strip = true;
  176|  1.57k|            for (unsigned int i = 1; i <= last; ++i) {
  ------------------
  |  Branch (176:38): [True: 1.23k, False: 343]
  ------------------
  177|  1.23k|                if (outbuf[buf_size - i] != last) {
  ------------------
  |  Branch (177:21): [True: 483, False: 752]
  ------------------
  178|    483|                    strip = false;
  179|    483|                    break;
  180|    483|                }
  181|  1.23k|            }
  182|    826|            if (strip) {
  ------------------
  |  Branch (182:17): [True: 343, False: 483]
  ------------------
  183|    343|                bytes -= last;
  184|    343|            }
  185|    826|        }
  186|  3.90k|    }
  187|  51.9M|    offset = 0;
  188|  51.9M|    next()->write(outbuf, bytes);
  189|  51.9M|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|  3.72k|    Pipeline(identifier, next)
   13|  3.72k|{
   14|  3.72k|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|  3.72k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|  3.59k|{
   20|  3.59k|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 196, False: 3.39k]
  ------------------
   21|    196|        return;
   22|    196|    }
   23|   225k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 222k, False: 2.76k]
  ------------------
   24|   222k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 8.66k, False: 213k]
  ------------------
   25|  3.63k|        case ' ':
  ------------------
  |  Branch (25:9): [True: 3.63k, False: 218k]
  ------------------
   26|  3.85k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 223, False: 222k]
  ------------------
   27|  4.07k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 219, False: 222k]
  ------------------
   28|  4.40k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 331, False: 221k]
  ------------------
   29|  5.83k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 1.42k, False: 220k]
  ------------------
   30|  8.66k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 2.83k, False: 219k]
  ------------------
   31|  8.66k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  8.66k|            continue;
   34|   222k|        }
   35|   213k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 198, False: 213k]
  ------------------
   36|    198|            break;
   37|   213k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 248, False: 213k]
  ------------------
   38|    248|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|    248|            flush();
   40|    248|            eod = 2;
   41|   213k|        } else {
   42|   213k|            switch (buf[i]) {
   43|    245|            case '~':
  ------------------
  |  Branch (43:13): [True: 245, False: 212k]
  ------------------
   44|    245|                eod = 1;
   45|    245|                break;
   46|       |
   47|  1.21k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 1.21k, False: 211k]
  ------------------
   48|  1.21k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 39, False: 1.17k]
  ------------------
   49|     39|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     39|                }
   51|  1.17k|                unsigned char zeroes[4];
   52|  1.17k|                memset(zeroes, '\0', 4);
   53|  1.17k|                next()->write(zeroes, 4);
   54|  1.17k|                break;
   55|       |
   56|   211k|            default:
  ------------------
  |  Branch (56:13): [True: 211k, False: 1.45k]
  ------------------
   57|   211k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 163, False: 211k]
  |  Branch (57:36): [True: 112, False: 211k]
  ------------------
   58|    275|                    error = true;
   59|    275|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   211k|                } else {
   61|   211k|                    this->inbuf[this->pos++] = buf[i];
   62|   211k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 41.8k, False: 169k]
  ------------------
   63|  41.8k|                        flush();
   64|  41.8k|                    }
   65|   211k|                }
   66|   211k|                break;
   67|   213k|            }
   68|   213k|        }
   69|   213k|    }
   70|  3.39k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  45.4k|{
   75|  45.4k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 2.54k, False: 42.9k]
  ------------------
   76|  2.54k|        return;
   77|  2.54k|    }
   78|  42.9k|    unsigned long lval = 0;
   79|   257k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 214k, False: 42.9k]
  ------------------
   80|   214k|        lval *= 85;
   81|   214k|        lval += (this->inbuf[i] - 33U);
   82|   214k|    }
   83|       |
   84|  42.9k|    unsigned char outbuf[4];
   85|  42.9k|    memset(outbuf, 0, 4);
   86|   214k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 171k, False: 42.9k]
  ------------------
   87|   171k|        outbuf[i] = lval & 0xff;
   88|   171k|        lval >>= 8;
   89|   171k|    }
   90|       |
   91|  42.9k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 41.8k, False: 1.09k]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  42.9k|    auto t = this->pos - 1;
   94|  42.9k|    this->pos = 0;
   95|  42.9k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  42.9k|    next()->write(outbuf, t);
   98|  42.9k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|  3.67k|{
  103|  3.67k|    if (error) {
  ------------------
  |  Branch (103:9): [True: 233, False: 3.43k]
  ------------------
  104|    233|        return;
  105|    233|    }
  106|  3.43k|    flush();
  107|  3.43k|    next()->finish();
  108|  3.43k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    505|    Pipeline(identifier, next)
   14|    505|{
   15|    505|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    505|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|    984|{
   21|    984|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 381, False: 603]
  ------------------
   22|    381|        return;
   23|    381|    }
   24|  6.66k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 6.31k, False: 344]
  ------------------
   25|  6.31k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  6.31k|        switch (ch) {
   27|    287|        case ' ':
  ------------------
  |  Branch (27:9): [True: 287, False: 6.02k]
  ------------------
   28|    595|        case '\f':
  ------------------
  |  Branch (28:9): [True: 308, False: 6.00k]
  ------------------
   29|    981|        case '\v':
  ------------------
  |  Branch (29:9): [True: 386, False: 5.93k]
  ------------------
   30|  1.25k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 276, False: 6.04k]
  ------------------
   31|  1.56k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 307, False: 6.00k]
  ------------------
   32|  1.92k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 358, False: 5.95k]
  ------------------
   33|  1.92k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.92k|            break;
   36|       |
   37|     49|        case '>':
  ------------------
  |  Branch (37:9): [True: 49, False: 6.26k]
  ------------------
   38|     49|            eod = true;
   39|     49|            flush();
   40|     49|            break;
   41|       |
   42|  4.34k|        default:
  ------------------
  |  Branch (42:9): [True: 4.34k, False: 1.97k]
  ------------------
   43|  4.34k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 4.22k, False: 122]
  |  Branch (43:31): [True: 2.78k, False: 1.43k]
  |  Branch (43:46): [True: 1.42k, False: 137]
  |  Branch (43:59): [True: 1.35k, False: 64]
  ------------------
   44|  4.14k|                inbuf[pos++] = ch;
   45|  4.14k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 2.00k, False: 2.13k]
  ------------------
   46|  2.00k|                    flush();
   47|  2.00k|                }
   48|  4.14k|            } else {
   49|    201|                char t[2];
   50|    201|                t[0] = ch;
   51|    201|                t[1] = 0;
   52|    201|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    201|            }
   54|  4.14k|            break;
   55|  6.31k|        }
   56|  6.10k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 49, False: 6.05k]
  ------------------
   57|     49|            break;
   58|     49|        }
   59|  6.10k|    }
   60|    603|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  2.42k|{
   65|  2.42k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 301, False: 2.12k]
  ------------------
   66|    301|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    301|        return;
   68|    301|    }
   69|  2.12k|    int b[2];
   70|  6.36k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 4.24k, False: 2.12k]
  ------------------
   71|  4.24k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 1.35k, False: 2.88k]
  ------------------
   72|  1.35k|            b[i] = inbuf[i] - 'A' + 10;
   73|  2.88k|        } else {
   74|  2.88k|            b[i] = inbuf[i] - '0';
   75|  2.88k|        }
   76|  4.24k|    }
   77|  2.12k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  2.12k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 2.00k, False: 114]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  2.12k|    pos = 0;
   82|  2.12k|    inbuf[0] = '0';
   83|  2.12k|    inbuf[1] = '0';
   84|  2.12k|    inbuf[2] = '\0';
   85|       |
   86|  2.12k|    next()->write(&ch, 1);
   87|  2.12k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    366|{
   92|    366|    flush();
   93|    366|    next()->finish();
   94|    366|}

_ZN9Pl_BufferC2EPKcP8Pipeline:
   23|   204k|    Pipeline(identifier, next),
   24|   204k|    m(std::make_unique<Members>())
   25|   204k|{
   26|   204k|}
_ZN9Pl_BufferD2Ev:
   29|   204k|Pl_Buffer::~Pl_Buffer() = default;
_ZN9Pl_Buffer5writeEPKhm:
   33|  57.6M|{
   34|  57.6M|    if (!len) {
  ------------------
  |  Branch (34:9): [True: 7.80k, False: 57.6M]
  ------------------
   35|  7.80k|        return;
   36|  7.80k|    }
   37|  57.6M|    m->data.append(reinterpret_cast<char const*>(buf), len);
   38|  57.6M|    m->ready = false;
   39|       |
   40|  57.6M|    if (next()) {
  ------------------
  |  Branch (40:9): [True: 0, False: 57.6M]
  ------------------
   41|      0|        next()->write(buf, len);
   42|      0|    }
   43|  57.6M|}
_ZN9Pl_Buffer6finishEv:
   47|   204k|{
   48|   204k|    m->ready = true;
   49|   204k|    if (next()) {
  ------------------
  |  Branch (49:9): [True: 0, False: 204k]
  ------------------
   50|      0|        next()->finish();
   51|      0|    }
   52|   204k|}
_ZN9Pl_Buffer9getStringEv:
   65|   204k|{
   66|   204k|    util::assertion(m->ready, "Pl_Buffer::getString() called when not ready");
   67|   204k|    auto s = std::move(m->data);
   68|   204k|    m->data.clear();
   69|   204k|    return s;
   70|   204k|}
_ZN9Pl_Buffer7MembersC2Ev:
   15|   204k|    Members() = default;

_ZN8Pl_CountC2EPKcP8Pipeline:
   21|  4.63k|    Pipeline(identifier, next),
   22|  4.63k|    m(std::make_unique<Members>())
   23|  4.63k|{
   24|  4.63k|    util::assertion(next, "Attempt to create Pl_Count with nullptr as next");
   25|  4.63k|}
_ZN8Pl_CountD2Ev:
   27|  4.63k|Pl_Count::~Pl_Count() = default;
_ZN8Pl_Count5writeEPKhm:
   32|  20.2k|{
   33|  20.2k|    if (len) {
  ------------------
  |  Branch (33:9): [True: 17.4k, False: 2.71k]
  ------------------
   34|  17.4k|        m->count += QIntC::to_offset(len);
   35|  17.4k|        m->last_char = buf[len - 1];
   36|  17.4k|        next()->write(buf, len);
   37|  17.4k|    }
   38|  20.2k|}
_ZN8Pl_Count6finishEv:
   42|  3.90k|{
   43|  3.90k|    next()->finish();
   44|  3.90k|}
_ZNK8Pl_Count8getCountEv:
   48|  3.90k|{
   49|  3.90k|    return m->count;
   50|  3.90k|}
_ZN8Pl_Count7MembersC2Ev:
   11|  4.63k|    Members() = default;

_ZN6Pl_DCTC2EPKcP8Pipeline:
  122|    551|    Pipeline(identifier, next),
  123|    551|    m(std::make_unique<Members>())
  124|    551|{
  125|    551|    util::assertion(next, "Attempt to create Pl_DCT with nullptr as next");
  126|    551|}
_ZN6Pl_DCTD2Ev:
  161|    551|Pl_DCT::~Pl_DCT() = default;
_ZN6Pl_DCT5writeEPKhm:
  165|   441k|{
  166|   441k|    if (len > 0) {
  ------------------
  |  Branch (166:9): [True: 441k, False: 10]
  ------------------
  167|   441k|        m->buf.append(reinterpret_cast<char const*>(data), len);
  168|   441k|    }
  169|   441k|}
_ZN6Pl_DCT6finishEv:
  173|    544|{
  174|    544|    if (m->buf.empty()) {
  ------------------
  |  Branch (174:9): [True: 40, False: 504]
  ------------------
  175|       |        // Special case: empty data will never succeed and probably means we're calling finish a
  176|       |        // second time from an exception handler.
  177|     40|        next()->finish();
  178|     40|        return;
  179|     40|    }
  180|       |
  181|    504|    struct jpeg_compress_struct cinfo_compress;
  182|    504|    struct jpeg_decompress_struct cinfo_decompress;
  183|    504|    struct qpdf_jpeg_error_mgr jerr;
  184|       |
  185|    504|    cinfo_compress.err = jpeg_std_error(&(jerr.pub));
  186|    504|    cinfo_decompress.err = jpeg_std_error(&(jerr.pub));
  187|    504|    jerr.pub.error_exit = error_handler;
  188|    504|    if (m->action == a_decompress && throw_on_corrupt_data) {
  ------------------
  |  Branch (188:9): [True: 504, False: 0]
  |  Branch (188:38): [True: 504, False: 0]
  ------------------
  189|    504|        jerr.pub.emit_message = emit_message;
  190|    504|    }
  191|       |
  192|    504|    bool error = false;
  193|       |    // The jpeg library is a "C" library, so we use setjmp and longjmp for exception handling.
  194|    504|    if (setjmp(jerr.jmpbuf) == 0) {
  ------------------
  |  Branch (194:9): [True: 504, False: 0]
  ------------------
  195|    504|        try {
  196|    504|            if (m->action == a_compress) {
  ------------------
  |  Branch (196:17): [True: 0, False: 504]
  ------------------
  197|      0|                compress(reinterpret_cast<void*>(&cinfo_compress));
  198|    504|            } else {
  199|    504|                decompress(reinterpret_cast<void*>(&cinfo_decompress));
  200|    504|            }
  201|    504|        } catch (std::exception& e) {
  202|       |            // Convert an exception back to a longjmp so we can ensure that the right cleanup
  203|       |            // happens. This will get converted back to an exception.
  204|    149|            jerr.msg = e.what();
  205|    149|            longjmp(jerr.jmpbuf, 1);
  206|    149|        }
  207|    504|    } else {
  208|      0|        error = true;
  209|      0|    }
  210|       |
  211|      1|    if (m->action == a_compress) {
  ------------------
  |  Branch (211:9): [True: 0, False: 1]
  ------------------
  212|      0|        jpeg_destroy_compress(&cinfo_compress);
  213|      0|    }
  214|    504|    if (m->action == a_decompress) {
  ------------------
  |  Branch (214:9): [True: 504, False: 18.4E]
  ------------------
  215|    504|        jpeg_destroy_decompress(&cinfo_decompress);
  216|    504|    }
  217|    503|    if (error) {
  ------------------
  |  Branch (217:9): [True: 503, False: 18.4E]
  ------------------
  218|    503|        throw std::runtime_error(jerr.msg);
  219|    503|    }
  220|      1|}
_ZN6Pl_DCT10decompressEPv:
  374|    504|{
  375|    504|    auto* cinfo = reinterpret_cast<jpeg_decompress_struct*>(cinfo_p);
  376|       |
  377|    504|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  378|    504|# pragma GCC diagnostic push
  379|    504|# pragma GCC diagnostic ignored "-Wold-style-cast"
  380|    504|#endif
  381|    504|    jpeg_create_decompress(cinfo);
  382|    504|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  383|    504|# pragma GCC diagnostic pop
  384|    504|#endif
  385|       |
  386|    504|    if (memory_limit > 0) {
  ------------------
  |  Branch (386:9): [True: 504, False: 0]
  ------------------
  387|    504|        cinfo->mem->max_memory_to_use = memory_limit;
  388|    504|    }
  389|       |
  390|    504|    jpeg_buffer_src(cinfo, m->buf);
  391|       |
  392|    504|    (void)jpeg_read_header(cinfo, TRUE);
  393|    504|    jpeg_calc_output_dimensions(cinfo);
  394|    504|    unsigned int width = cinfo->output_width * QIntC::to_uint(cinfo->output_components);
  395|    504|    if (memory_limit > 0 &&
  ------------------
  |  Branch (395:9): [True: 289, False: 215]
  ------------------
  396|    289|        width > (static_cast<unsigned long>(memory_limit / 20) / cinfo->output_height)) {
  ------------------
  |  Branch (396:9): [True: 2, False: 287]
  ------------------
  397|       |        // Even if jpeglib does not run out of memory, qpdf will while buffering the data before
  398|       |        // writing it. Furthermore, for very large images runtime can be significant before the
  399|       |        // first warning is encountered causing a timeout in oss-fuzz.
  400|      2|        throw std::runtime_error("Pl_DCT::decompress: JPEG data large - may be too slow");
  401|      2|    }
  402|    502|    jpeg_progress_mgr progress_mgr;
  403|    502|    if (scan_limit > 0) {
  ------------------
  |  Branch (403:9): [True: 287, False: 215]
  ------------------
  404|    287|        progress_mgr.progress_monitor = &progress_monitor;
  405|    287|        cinfo->progress = &progress_mgr;
  406|    287|    }
  407|    502|    JSAMPARRAY buffer =
  408|    502|        (*cinfo->mem->alloc_sarray)(reinterpret_cast<j_common_ptr>(cinfo), JPOOL_IMAGE, width, 1);
  409|       |
  410|    502|    (void)jpeg_start_decompress(cinfo);
  411|  34.3k|    while (cinfo->output_scanline < cinfo->output_height) {
  ------------------
  |  Branch (411:12): [True: 33.8k, False: 502]
  ------------------
  412|  33.8k|        (void)jpeg_read_scanlines(cinfo, buffer, 1);
  413|  33.8k|        next()->write(buffer[0], width * sizeof(buffer[0][0]));
  414|  33.8k|    }
  415|    502|    (void)jpeg_finish_decompress(cinfo);
  416|    502|    next()->finish();
  417|    502|}
Pl_DCT.cc:_ZL13error_handlerP18jpeg_common_struct:
   51|    133|{
   52|    133|    auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   53|    133|    char buf[JMSG_LENGTH_MAX];
   54|    133|    (*cinfo->err->format_message)(cinfo, buf);
   55|    133|    jerr->msg = buf;
   56|    133|    longjmp(jerr->jmpbuf, 1);
   57|    133|}
Pl_DCT.cc:_ZL12emit_messageP18jpeg_common_structi:
   61|  5.46k|{
   62|  5.46k|    if (msg_level == -1) {
  ------------------
  |  Branch (62:9): [True: 221, False: 5.24k]
  ------------------
   63|    221|        auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   64|    221|        jerr->msg = "Pl_DCT::decompress: JPEG data is corrupt";
   65|    221|        longjmp(jerr->jmpbuf, 1);
   66|    221|    }
   67|  5.46k|}
Pl_DCT.cc:_ZL15jpeg_buffer_srcP22jpeg_decompress_structRNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  309|    504|{
  310|    504|    cinfo->src = reinterpret_cast<jpeg_source_mgr*>(
  311|       |        // line-break
  312|    504|        (*cinfo->mem->alloc_small)(
  313|    504|            reinterpret_cast<j_common_ptr>(cinfo), JPOOL_PERMANENT, sizeof(jpeg_source_mgr)));
  314|       |
  315|    504|    jpeg_source_mgr* src = cinfo->src;
  316|    504|    src->init_source = init_buffer_source;
  317|    504|    src->fill_input_buffer = fill_buffer_input_buffer;
  318|    504|    src->skip_input_data = skip_buffer_input_data;
  319|    504|    src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
  320|    504|    src->term_source = term_buffer_source;
  321|    504|    src->bytes_in_buffer = buffer.size();
  322|    504|    src->next_input_byte = reinterpret_cast<unsigned char*>(buffer.data());
  323|    504|}
Pl_DCT.cc:_ZL18init_buffer_sourceP22jpeg_decompress_struct:
  275|    504|{
  276|    504|}
Pl_DCT.cc:_ZL24fill_buffer_input_bufferP22jpeg_decompress_struct:
  280|    147|{
  281|       |    // The whole JPEG data is expected to reside in the supplied memory buffer, so any request for
  282|       |    // more data beyond the given buffer size is treated as an error.
  283|    147|    throw std::runtime_error("invalid jpeg data reading from buffer");
  284|      0|    return TRUE;
  285|    147|}
Pl_DCT.cc:_ZL22skip_buffer_input_dataP22jpeg_decompress_structl:
  289|     76|{
  290|     76|    util::no_ci_rt_error_if(
  291|     76|        num_bytes < 0, "reading jpeg: jpeg library requested skipping a negative number of bytes");
  292|     76|    size_t to_skip = QIntC::to_size(num_bytes);
  293|     76|    if (to_skip > 0 && to_skip <= cinfo->src->bytes_in_buffer) {
  ------------------
  |  Branch (293:9): [True: 76, False: 0]
  |  Branch (293:24): [True: 41, False: 35]
  ------------------
  294|     41|        cinfo->src->next_input_byte += to_skip;
  295|     41|        cinfo->src->bytes_in_buffer -= to_skip;
  296|     41|    } else if (to_skip != 0) {
  ------------------
  |  Branch (296:16): [True: 35, False: 0]
  ------------------
  297|     35|        cinfo->src->next_input_byte += cinfo->src->bytes_in_buffer;
  298|     35|        cinfo->src->bytes_in_buffer = 0;
  299|     35|    }
  300|     76|}
Pl_DCT.cc:_ZL18term_buffer_sourceP22jpeg_decompress_struct:
  304|      1|{
  305|      1|}
Pl_DCT.cc:_ZL16progress_monitorP18jpeg_common_struct:
   71|  33.8k|{
   72|  33.8k|    if (cinfo->is_decompressor &&
  ------------------
  |  Branch (72:9): [True: 33.8k, False: 0]
  ------------------
   73|  33.8k|        reinterpret_cast<jpeg_decompress_struct*>(cinfo)->input_scan_number > scan_limit) {
  ------------------
  |  Branch (73:9): [True: 0, False: 33.8k]
  ------------------
   74|      0|        auto* jerr = reinterpret_cast<qpdf_jpeg_error_mgr*>(cinfo->err);
   75|      0|        jerr->msg = "Pl_DCT::decompress: JPEG data has too many scans";
   76|      0|        longjmp(jerr->jmpbuf, 1);
   77|      0|    }
   78|  33.8k|}
_ZN6Pl_DCT7MembersC2Ev:
  101|    551|        action(a_decompress)
  102|    551|    {
  103|    551|    }
_ZN6Pl_DCT7MembersD2Ev:
  107|    551|    ~Members() = default;

_ZN10Pl_DiscardC2Ev:
    9|  25.9k|    Pipeline("discard", nullptr)
   10|  25.9k|{
   11|  25.9k|}
_ZN10Pl_DiscardD2Ev:
   14|  25.9k|Pl_Discard::~Pl_Discard() = default;

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   27|  22.9k|    out_bufsize(out_bufsize),
   28|  22.9k|    action(action),
   29|  22.9k|    initialized(false),
   30|  22.9k|    zdata(nullptr)
   31|  22.9k|{
   32|  22.9k|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   33|       |    // Indirect through zdata to reach the z_stream so we don't have to include zlib.h in
   34|       |    // Pl_Flate.hh.  This means people using shared library versions of qpdf don't have to have zlib
   35|       |    // development files available, which particularly helps in a Windows environment.
   36|  22.9k|    zdata = new z_stream;
   37|       |
   38|  22.9k|    util::no_ci_rt_error_if(
   39|  22.9k|        out_bufsize > UINT_MAX,
   40|  22.9k|        "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   41|       |
   42|  22.9k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   43|  22.9k|    zstream.zalloc = nullptr;
   44|  22.9k|    zstream.zfree = nullptr;
   45|  22.9k|    zstream.opaque = nullptr;
   46|  22.9k|    zstream.next_in = nullptr;
   47|  22.9k|    zstream.avail_in = 0;
   48|  22.9k|    zstream.next_out = this->outbuf.get();
   49|  22.9k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   50|       |
   51|  22.9k|    if (action == a_deflate && Pl_Flate::zopfli_enabled()) {
  ------------------
  |  Branch (51:9): [True: 0, False: 22.9k]
  |  Branch (51:32): [True: 0, False: 0]
  ------------------
   52|      0|        zopfli_buf = std::make_unique<std::string>();
   53|      0|    }
   54|  22.9k|}
_ZN8Pl_Flate7MembersD2Ev:
   57|  22.9k|{
   58|  22.9k|    if (initialized) {
  ------------------
  |  Branch (58:9): [True: 1.37k, False: 21.5k]
  ------------------
   59|  1.37k|        z_stream& zstream = *(static_cast<z_stream*>(zdata));
   60|  1.37k|        if (action == a_deflate) {
  ------------------
  |  Branch (60:13): [True: 0, False: 1.37k]
  ------------------
   61|      0|            deflateEnd(&zstream);
   62|  1.37k|        } else {
   63|  1.37k|            inflateEnd(&zstream);
   64|  1.37k|        }
   65|  1.37k|    }
   66|       |
   67|  22.9k|    delete static_cast<z_stream*>(this->zdata);
   68|  22.9k|    zdata = nullptr;
   69|  22.9k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   73|  22.9k|    Pipeline(identifier, next),
   74|  22.9k|    m(std::make_unique<Members>(QIntC::to_size(out_bufsize_int), action))
   75|  22.9k|{
   76|  22.9k|    util::assertion(next, "Attempt to create Pl_Flate with nullptr as next");
   77|  22.9k|}
_ZN8Pl_FlateD2Ev:
   80|  22.9k|Pl_Flate::~Pl_Flate() = default;
_ZN8Pl_Flate12memory_limitEv:
   84|  5.64k|{
   85|  5.64k|    return ::memory_limit;
   86|  5.64k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   96|  23.0k|{
   97|  23.0k|    m->callback = callback;
   98|  23.0k|}
_ZN8Pl_Flate4warnEPKci:
  102|  5.64k|{
  103|  5.64k|    if (m->callback) {
  ------------------
  |  Branch (103:9): [True: 5.64k, False: 0]
  ------------------
  104|  5.64k|        m->callback(msg, code);
  105|  5.64k|    }
  106|  5.64k|}
_ZN8Pl_Flate5writeEPKhm:
  110|  81.5k|{
  111|  81.5k|    util::assertion(
  112|  81.5k|        m->outbuf.get(), identifier + ": Pl_Flate: write() called after finish() called");
  113|  81.5k|    if (m->zopfli_buf) {
  ------------------
  |  Branch (113:9): [True: 0, False: 81.5k]
  ------------------
  114|      0|        m->zopfli_buf->append(reinterpret_cast<char const*>(data), len);
  115|      0|        return;
  116|      0|    }
  117|       |
  118|       |    // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
  119|  81.5k|    static size_t const max_bytes = 1 << 30;
  120|  81.5k|    size_t bytes_left = len;
  121|  81.5k|    unsigned char const* buf = data;
  122|   152k|    while (bytes_left > 0) {
  ------------------
  |  Branch (122:12): [True: 71.0k, False: 81.5k]
  ------------------
  123|  71.0k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (123:25): [True: 0, False: 71.0k]
  ------------------
  124|  71.0k|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (124:33): [True: 71.0k, False: 0]
  ------------------
  125|  71.0k|        bytes_left -= bytes;
  126|  71.0k|        buf += bytes;
  127|  71.0k|    }
  128|  81.5k|}
_ZN8Pl_Flate10handleDataEPKhmi:
  132|  81.2k|{
  133|  81.2k|    util::no_ci_rt_error_if(
  134|  81.2k|        len > UINT_MAX, "Pl_Flate: zlib doesn't support data blocks larger than int");
  135|  81.2k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  136|       |    // zlib is known not to modify the data pointed to by next_in but doesn't declare the field
  137|       |    // value const unless compiled to do so.
  138|  81.2k|    zstream.next_in = const_cast<unsigned char*>(data);
  139|  81.2k|    zstream.avail_in = QIntC::to_uint(len);
  140|       |
  141|  81.2k|    if (!m->initialized) {
  ------------------
  |  Branch (141:9): [True: 10.5k, False: 70.6k]
  ------------------
  142|  10.5k|        int err = Z_OK;
  143|       |
  144|       |        // deflateInit and inflateInit are macros that use old-style casts.
  145|  10.5k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  146|  10.5k|# pragma GCC diagnostic push
  147|  10.5k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  148|  10.5k|#endif
  149|  10.5k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (149:13): [True: 0, False: 10.5k]
  ------------------
  150|      0|            err = deflateInit(&zstream, compression_level);
  151|  10.5k|        } else {
  152|  10.5k|            err = inflateInit(&zstream);
  153|  10.5k|        }
  154|  10.5k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  155|  10.5k|# pragma GCC diagnostic pop
  156|  10.5k|#endif
  157|       |
  158|  10.5k|        checkError("Init", err);
  159|  10.5k|        m->initialized = true;
  160|  10.5k|    }
  161|       |
  162|  81.2k|    int err = Z_OK;
  163|       |
  164|  81.2k|    bool done = false;
  165|   161k|    while (!done) {
  ------------------
  |  Branch (165:12): [True: 82.5k, False: 78.9k]
  ------------------
  166|  82.5k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (166:13): [True: 0, False: 82.5k]
  ------------------
  167|      0|            err = deflate(&zstream, flush);
  168|  82.5k|        } else {
  169|  82.5k|            err = inflate(&zstream, flush);
  170|  82.5k|        }
  171|  82.5k|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (171:13): [True: 82.5k, False: 0]
  |  Branch (171:41): [True: 15.4k, False: 67.0k]
  |  Branch (171:58): [True: 4.07k, False: 11.4k]
  ------------------
  172|  4.07k|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (172:13): [True: 1.95k, False: 2.11k]
  ------------------
  173|       |            // Other PDF readers ignore this specific error. Combining this with Z_SYNC_FLUSH
  174|       |            // enables qpdf to handle some broken zlib streams without losing data.
  175|  1.95k|            err = Z_STREAM_END;
  176|  1.95k|        }
  177|  82.5k|        switch (err) {
  178|  5.64k|        case Z_BUF_ERROR:
  ------------------
  |  Branch (178:9): [True: 5.64k, False: 76.8k]
  ------------------
  179|       |            // Probably shouldn't be able to happen, but possible as a boundary condition: if the
  180|       |            // last call to inflate exactly filled the output buffer, it's possible that the next
  181|       |            // call to inflate could have nothing to do. There are PDF files in the wild that have
  182|       |            // this error (including at least one in qpdf's test suite). In some cases, we want to
  183|       |            // know about this, because it indicates incorrect compression, so call a callback if
  184|       |            // provided.
  185|  5.64k|            warn("input stream is complete but output may still be valid", err);
  186|  5.64k|            done = true;
  187|  5.64k|            break;
  188|       |
  189|  7.64k|        case Z_STREAM_END:
  ------------------
  |  Branch (189:9): [True: 7.64k, False: 74.8k]
  ------------------
  190|  7.64k|            done = true;
  191|       |            // fall through
  192|       |
  193|  74.6k|        case Z_OK:
  ------------------
  |  Branch (193:9): [True: 67.0k, False: 15.4k]
  ------------------
  194|  74.6k|            {
  195|  74.6k|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (195:21): [True: 72.0k, False: 2.66k]
  |  Branch (195:48): [True: 71.9k, False: 74]
  ------------------
  196|       |                    // There is nothing left to read, and there was sufficient buffer space to write
  197|       |                    // everything we needed, so we're done for now.
  198|  71.9k|                    done = true;
  199|  71.9k|                }
  200|  74.6k|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  201|  74.6k|                if (ready > 0) {
  ------------------
  |  Branch (201:21): [True: 60.1k, False: 14.5k]
  ------------------
  202|  60.1k|                    if (::memory_limit && m->action != a_deflate) {
  ------------------
  |  Branch (202:25): [True: 60.1k, False: 0]
  |  Branch (202:43): [True: 60.1k, False: 0]
  ------------------
  203|  60.1k|                        m->written += ready;
  204|  60.1k|                        if (m->written > ::memory_limit) {
  ------------------
  |  Branch (204:29): [True: 46, False: 60.0k]
  ------------------
  205|     46|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  206|     46|                        }
  207|  60.1k|                    }
  208|  60.0k|                    next()->write(m->outbuf.get(), ready);
  209|  60.0k|                    zstream.next_out = m->outbuf.get();
  210|  60.0k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  211|  60.0k|                }
  212|  74.6k|            }
  213|  74.6k|            break;
  214|       |
  215|  74.6k|        default:
  ------------------
  |  Branch (215:9): [True: 2.19k, False: 80.3k]
  ------------------
  216|  2.19k|            checkError("data", err);
  217|  82.5k|        }
  218|  82.5k|    }
  219|  81.2k|}
_ZN8Pl_Flate6finishEv:
  223|  22.4k|{
  224|  22.4k|    if (m->written > ::memory_limit) {
  ------------------
  |  Branch (224:9): [True: 38, False: 22.4k]
  ------------------
  225|     38|        throw std::runtime_error("PL_Flate memory limit exceeded");
  226|     38|    }
  227|  22.4k|    try {
  228|  22.4k|        if (m->zopfli_buf) {
  ------------------
  |  Branch (228:13): [True: 0, False: 22.4k]
  ------------------
  229|      0|            finish_zopfli();
  230|  22.4k|        } else if (m->outbuf.get()) {
  ------------------
  |  Branch (230:20): [True: 22.4k, False: 0]
  ------------------
  231|  22.4k|            if (m->initialized) {
  ------------------
  |  Branch (231:17): [True: 10.1k, False: 12.2k]
  ------------------
  232|  10.1k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  233|  10.1k|                unsigned char buf[1];
  234|  10.1k|                buf[0] = '\0';
  235|  10.1k|                handleData(buf, 0, Z_FINISH);
  236|  10.1k|                int err = Z_OK;
  237|  10.1k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (237:21): [True: 0, False: 10.1k]
  ------------------
  238|      0|                    err = deflateEnd(&zstream);
  239|  10.1k|                } else {
  240|  10.1k|                    err = inflateEnd(&zstream);
  241|  10.1k|                }
  242|  10.1k|                m->initialized = false;
  243|  10.1k|                checkError("End", err);
  244|  10.1k|            }
  245|       |
  246|  22.4k|            m->outbuf = nullptr;
  247|  22.4k|        }
  248|  22.4k|    } catch (std::exception& e) {
  249|    974|        try {
  250|    974|            next()->finish();
  251|    974|        } catch (...) {
  252|       |            // ignore secondary exception
  253|     12|        }
  254|    974|        throw std::runtime_error(e.what());
  255|    974|    }
  256|  21.4k|    next()->finish();
  257|  21.4k|}
_ZN8Pl_Flate10checkErrorEPKci:
  267|  22.0k|{
  268|  22.0k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  269|  22.0k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (269:9): [True: 2.19k, False: 19.8k]
  ------------------
  270|  2.19k|        char const* action_str = (m->action == a_deflate ? "deflate" : "inflate");
  ------------------
  |  Branch (270:35): [True: 0, False: 2.19k]
  ------------------
  271|  2.19k|        std::string msg = identifier + ": " + action_str + ": " + prefix + ": ";
  272|       |
  273|  2.19k|        if (zstream.msg) {
  ------------------
  |  Branch (273:13): [True: 2.11k, False: 74]
  ------------------
  274|  2.11k|            msg += zstream.msg;
  275|  2.11k|        } else {
  276|     74|            switch (error_code) {
  277|      0|            case Z_ERRNO:
  ------------------
  |  Branch (277:13): [True: 0, False: 74]
  ------------------
  278|      0|                msg += "zlib system error";
  279|      0|                break;
  280|       |
  281|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (281:13): [True: 0, False: 74]
  ------------------
  282|      0|                msg += "zlib stream error";
  283|      0|                break;
  284|       |
  285|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (285:13): [True: 0, False: 74]
  ------------------
  286|      0|                msg += "zlib data error";
  287|      0|                break;
  288|       |
  289|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (289:13): [True: 0, False: 74]
  ------------------
  290|      0|                msg += "zlib memory error";
  291|      0|                break;
  292|       |
  293|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (293:13): [True: 0, False: 74]
  ------------------
  294|      0|                msg += "zlib buffer error";
  295|      0|                break;
  296|       |
  297|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (297:13): [True: 0, False: 74]
  ------------------
  298|      0|                msg += "zlib version error";
  299|      0|                break;
  300|       |
  301|     74|            default:
  ------------------
  |  Branch (301:13): [True: 74, False: 0]
  ------------------
  302|     74|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  303|     74|                break;
  304|     74|            }
  305|     74|        }
  306|       |
  307|  2.19k|        throw std::runtime_error(msg);
  308|  2.19k|    }
  309|  22.0k|}

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   12|  4.16k|    Pipeline(identifier, next),
   13|  4.16k|    code_change_delta(early_code_change)
   14|  4.16k|{
   15|  4.16k|    util::assertion(next, "Attempt to create Pl_LZWDecoder with nullptr as next");
   16|  4.16k|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   20|  86.7k|{
   21|   805k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 718k, False: 86.7k]
  ------------------
   22|   718k|        buf[next_char_++] = bytes[i];
   23|   718k|        if (next_char_ == 3) {
  ------------------
  |  Branch (23:13): [True: 239k, False: 479k]
  ------------------
   24|   239k|            next_char_ = 0;
   25|   239k|        }
   26|   718k|        bits_available += 8;
   27|   718k|        if (bits_available >= code_size) {
  ------------------
  |  Branch (27:13): [True: 550k, False: 168k]
  ------------------
   28|   550k|            sendNextCode();
   29|   550k|        }
   30|   718k|    }
   31|  86.7k|}
_ZN13Pl_LZWDecoder6finishEv:
   35|  3.90k|{
   36|  3.90k|    next()->finish();
   37|  3.90k|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   41|   550k|{
   42|   550k|    unsigned int high = byte_pos;
   43|   550k|    unsigned int med = (byte_pos + 1) % 3;
   44|   550k|    unsigned int low = (byte_pos + 2) % 3;
   45|       |
   46|   550k|    unsigned int bits_from_high = 8 - bit_pos;
   47|   550k|    unsigned int bits_from_med = code_size - bits_from_high;
   48|   550k|    unsigned int bits_from_low = 0;
   49|   550k|    if (bits_from_med > 8) {
  ------------------
  |  Branch (49:9): [True: 98.1k, False: 452k]
  ------------------
   50|  98.1k|        bits_from_low = bits_from_med - 8;
   51|  98.1k|        bits_from_med = 8;
   52|  98.1k|    }
   53|   550k|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   54|   550k|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   55|   550k|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   56|   550k|    unsigned int code = 0;
   57|   550k|    code += (buf[high] & high_mask) << bits_from_med;
   58|   550k|    code += ((buf[med] & med_mask) >> (8 - bits_from_med));
   59|   550k|    if (bits_from_low) {
  ------------------
  |  Branch (59:9): [True: 98.1k, False: 452k]
  ------------------
   60|  98.1k|        code <<= bits_from_low;
   61|  98.1k|        code += ((buf[low] & low_mask) >> (8 - bits_from_low));
   62|  98.1k|        byte_pos = low;
   63|  98.1k|        bit_pos = bits_from_low;
   64|   452k|    } else {
   65|   452k|        byte_pos = med;
   66|   452k|        bit_pos = bits_from_med;
   67|   452k|    }
   68|   550k|    if (bit_pos == 8) {
  ------------------
  |  Branch (68:9): [True: 68.7k, False: 481k]
  ------------------
   69|  68.7k|        bit_pos = 0;
   70|  68.7k|        ++byte_pos;
   71|  68.7k|        byte_pos %= 3;
   72|  68.7k|    }
   73|   550k|    bits_available -= code_size;
   74|       |
   75|   550k|    handleCode(code);
   76|   550k|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   80|  3.36k|{
   81|  3.36k|    if (code < 256) {
  ------------------
  |  Branch (81:9): [True: 54, False: 3.30k]
  ------------------
   82|     54|        return static_cast<unsigned char>(code);
   83|     54|    }
   84|  3.30k|    util::no_ci_rt_error_if(
   85|  3.30k|        code <= 257,
   86|  3.30k|        "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   87|       |
   88|  3.30k|    unsigned int idx = code - 258;
   89|  3.30k|    util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::getFirstChar: table overflow");
   90|  3.30k|    Buffer& b = table.at(idx);
   91|  3.30k|    return b.getBuffer()[0];
   92|  3.36k|}
_ZN13Pl_LZWDecoder10addToTableEh:
   96|   510k|{
   97|   510k|    unsigned int last_size = 0;
   98|   510k|    unsigned char const* last_data = nullptr;
   99|   510k|    unsigned char tmp[1];
  100|       |
  101|   510k|    if (last_code < 256) {
  ------------------
  |  Branch (101:9): [True: 507k, False: 3.29k]
  ------------------
  102|   507k|        tmp[0] = static_cast<unsigned char>(last_code);
  103|   507k|        last_data = tmp;
  104|   507k|        last_size = 1;
  105|   507k|    } else {
  106|  3.29k|        util::no_ci_rt_error_if(
  107|  3.29k|            last_code <= 257,
  108|  3.29k|            "Pl_LZWDecoder::addToTable called with invalid code (" + std::to_string(last_code) +
  109|  3.29k|                ")");
  110|  3.29k|        unsigned int idx = last_code - 258;
  111|  3.29k|        util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::addToTable: table overflow");
  112|  3.29k|        Buffer& b = table.at(idx);
  113|  3.29k|        last_data = b.getBuffer();
  114|  3.29k|        last_size = QIntC::to_uint(b.getSize());
  115|  3.29k|    }
  116|       |
  117|   510k|    Buffer entry(1 + last_size);
  118|   510k|    unsigned char* new_data = entry.getBuffer();
  119|   510k|    memcpy(new_data, last_data, last_size);
  120|   510k|    new_data[last_size] = c;
  121|   510k|    table.push_back(std::move(entry));
  122|   510k|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  126|   550k|{
  127|   550k|    if (eod) {
  ------------------
  |  Branch (127:9): [True: 35.9k, False: 514k]
  ------------------
  128|  35.9k|        return;
  129|  35.9k|    }
  130|       |
  131|   514k|    if (code == 256) {
  ------------------
  |  Branch (131:9): [True: 1.15k, False: 513k]
  ------------------
  132|  1.15k|        if (!table.empty()) {
  ------------------
  |  Branch (132:13): [True: 812, False: 346]
  ------------------
  133|    812|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  134|    812|        }
  135|  1.15k|        table.clear();
  136|  1.15k|        code_size = 9;
  137|   513k|    } else if (code == 257) {
  ------------------
  |  Branch (137:16): [True: 50, False: 513k]
  ------------------
  138|     50|        eod = true;
  139|   513k|    } else {
  140|   513k|        if (last_code != 256) {
  ------------------
  |  Branch (140:13): [True: 511k, False: 2.13k]
  ------------------
  141|       |            // Add to the table from last time.  New table entry would be what we read last plus the
  142|       |            // first character of what we're reading now.
  143|   511k|            unsigned char next_c = '\0';
  144|   511k|            unsigned int table_size = QIntC::to_uint(table.size());
  145|   511k|            if (code < 256) {
  ------------------
  |  Branch (145:17): [True: 507k, False: 3.64k]
  ------------------
  146|       |                // just read < 256; last time's next_c was code
  147|   507k|                next_c = static_cast<unsigned char>(code);
  148|   507k|            } else if (code > 257) {
  ------------------
  |  Branch (148:24): [True: 3.64k, False: 0]
  ------------------
  149|  3.64k|                size_t idx = code - 258;
  150|  3.64k|                if (idx > table_size) {
  ------------------
  |  Branch (150:21): [True: 285, False: 3.36k]
  ------------------
  151|    285|                    throw std::runtime_error("LZWDecoder: bad code received");
  152|  3.36k|                } else if (idx == table_size) {
  ------------------
  |  Branch (152:28): [True: 67, False: 3.29k]
  ------------------
  153|       |                    // The encoder would have just created this entry, so the first character of
  154|       |                    // this entry would have been the same as the first character of the last entry.
  155|     67|                    next_c = getFirstChar(last_code);
  156|  3.29k|                } else {
  157|  3.29k|                    next_c = getFirstChar(code);
  158|  3.29k|                }
  159|  3.64k|            }
  160|   510k|            unsigned int new_idx = 258 + table_size;
  161|   510k|            util::no_ci_rt_error_if(new_idx == 4096, "LZWDecoder: table full");
  162|   510k|            addToTable(next_c);
  163|   510k|            unsigned int change_idx = new_idx + code_change_delta;
  164|   510k|            if (change_idx == 511 || change_idx == 1023 || change_idx == 2047) {
  ------------------
  |  Branch (164:17): [True: 319, False: 510k]
  |  Branch (164:38): [True: 204, False: 510k]
  |  Branch (164:60): [True: 151, False: 510k]
  ------------------
  165|    668|                ++code_size;
  166|    668|            }
  167|   510k|        }
  168|       |
  169|   512k|        if (code < 256) {
  ------------------
  |  Branch (169:13): [True: 509k, False: 3.42k]
  ------------------
  170|   509k|            auto ch = static_cast<unsigned char>(code);
  171|   509k|            next()->write(&ch, 1);
  172|   509k|        } else {
  173|  3.42k|            unsigned int idx = code - 258;
  174|  3.42k|            if (idx >= table.size()) {
  ------------------
  |  Branch (174:17): [True: 58, False: 3.36k]
  ------------------
  175|     58|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  176|     58|            }
  177|  3.36k|            Buffer& b = table.at(idx);
  178|  3.36k|            next()->write(b.getBuffer(), b.getSize());
  179|  3.36k|        }
  180|   512k|    }
  181|       |
  182|   514k|    last_code = code;
  183|   514k|}

_ZN10Pl_OStreamC2EPKcRNSt3__113basic_ostreamIcNS2_11char_traitsIcEEEE:
   19|      2|    Pipeline(identifier, nullptr),
   20|      2|    m(std::make_unique<Members>(os))
   21|      2|{
   22|      2|}
_ZN10Pl_OStreamD2Ev:
   25|      2|Pl_OStream::~Pl_OStream() = default;
_ZN10Pl_OStream5writeEPKhm:
   29|  3.12M|{
   30|  3.12M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  3.12M|}
_ZN10Pl_OStream6finishEv:
   35|      2|{
   36|      2|    m->os.flush();
   37|      2|}
_ZN10Pl_OStream7MembersC2ERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
    9|      2|        os(os)
   10|      2|    {
   11|      2|    }

_ZN12Pl_PNGFilterC2EPKcP8PipelineNS_8action_eEjjj:
   30|  1.96k|    Pipeline(identifier, next),
   31|  1.96k|    action(action)
   32|  1.96k|{
   33|  1.96k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.96k|    util::no_ci_rt_error_if(
   35|  1.96k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.96k|    util::no_ci_rt_error_if(
   37|  1.96k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 74, False: 1.89k]
  |  Branch (37:35): [True: 66, False: 1.82k]
  |  Branch (37:59): [True: 66, False: 1.76k]
  ------------------
   38|  1.76k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.64k, False: 119]
  |  Branch (38:35): [True: 98, False: 21]
  ------------------
   39|  1.96k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.96k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.96k|    util::no_ci_rt_error_if(
   42|  1.96k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.96k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.96k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   45|  1.96k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   46|  1.96k|    util::no_ci_rt_error_if(
   47|  1.96k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (47:9): [True: 27, False: 1.94k]
  |  Branch (47:21): [True: 0, False: 1.94k]
  ------------------
   48|  1.96k|    util::no_ci_rt_error_if(
   49|  1.96k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (49:9): [True: 1.94k, False: 27]
  |  Branch (49:29): [True: 8, False: 1.93k]
  ------------------
   50|  1.96k|    bytes_per_row = static_cast<uint32_t>(bpr);
   51|  1.96k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   52|  1.96k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   53|  1.96k|    memset(buf1.get(), 0, bytes_per_row + 1);
   54|  1.96k|    memset(buf2.get(), 0, bytes_per_row + 1);
   55|  1.96k|    cur_row = buf1.get();
   56|  1.96k|    prev_row = buf2.get();
   57|       |
   58|       |    // number of bytes per incoming row
   59|  1.96k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (59:17): [True: 0, False: 1.96k]
  ------------------
   60|  1.96k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   70|  12.4k|{
   71|  12.4k|    size_t left = incoming - pos;
   72|  12.4k|    size_t offset = 0;
   73|  4.82M|    while (len >= left) {
  ------------------
  |  Branch (73:12): [True: 4.81M, False: 12.4k]
  ------------------
   74|       |        // finish off current row
   75|  4.81M|        memcpy(cur_row + pos, data + offset, left);
   76|  4.81M|        offset += left;
   77|  4.81M|        len -= left;
   78|       |
   79|  4.81M|        processRow();
   80|       |
   81|       |        // Swap rows
   82|  4.81M|        unsigned char* t = prev_row;
   83|  4.81M|        prev_row = cur_row;
   84|  4.81M|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (84:19): [True: 4.81M, False: 8]
  ------------------
   85|  4.81M|        memset(cur_row, 0, bytes_per_row + 1);
   86|  4.81M|        left = incoming;
   87|  4.81M|        pos = 0;
   88|  4.81M|    }
   89|  12.4k|    if (len) {
  ------------------
  |  Branch (89:9): [True: 11.5k, False: 875]
  ------------------
   90|  11.5k|        memcpy(cur_row + pos, data + offset, len);
   91|  11.5k|    }
   92|  12.4k|    pos += len;
   93|  12.4k|}
_ZN12Pl_PNGFilter10processRowEv:
   97|  4.81M|{
   98|  4.81M|    if (action == a_encode) {
  ------------------
  |  Branch (98:9): [True: 0, False: 4.81M]
  ------------------
   99|      0|        encodeRow();
  100|  4.81M|    } else {
  101|  4.81M|        decodeRow();
  102|  4.81M|    }
  103|  4.81M|}
_ZN12Pl_PNGFilter9decodeRowEv:
  107|  4.81M|{
  108|  4.81M|    int filter = cur_row[0];
  109|  4.81M|    if (prev_row) {
  ------------------
  |  Branch (109:9): [True: 4.81M, False: 0]
  ------------------
  110|  4.81M|        switch (filter) {
  111|  1.62M|        case 0:
  ------------------
  |  Branch (111:9): [True: 1.62M, False: 3.18M]
  ------------------
  112|  1.62M|            break;
  113|   986k|        case 1:
  ------------------
  |  Branch (113:9): [True: 986k, False: 3.82M]
  ------------------
  114|   986k|            decodeSub();
  115|   986k|            break;
  116|  1.04M|        case 2:
  ------------------
  |  Branch (116:9): [True: 1.04M, False: 3.76M]
  ------------------
  117|  1.04M|            decodeUp();
  118|  1.04M|            break;
  119|  2.41k|        case 3:
  ------------------
  |  Branch (119:9): [True: 2.41k, False: 4.80M]
  ------------------
  120|  2.41k|            decodeAverage();
  121|  2.41k|            break;
  122|  2.03k|        case 4:
  ------------------
  |  Branch (122:9): [True: 2.03k, False: 4.80M]
  ------------------
  123|  2.03k|            decodePaeth();
  124|  2.03k|            break;
  125|  1.14M|        default:
  ------------------
  |  Branch (125:9): [True: 1.14M, False: 3.66M]
  ------------------
  126|       |            // ignore
  127|  1.14M|            break;
  128|  4.81M|        }
  129|  4.81M|    }
  130|       |
  131|  4.81M|    next()->write(cur_row + 1, bytes_per_row);
  132|  4.81M|}
_ZN12Pl_PNGFilter9decodeSubEv:
  136|   986k|{
  137|   986k|    unsigned char* buffer = cur_row + 1;
  138|   986k|    unsigned int bpp = bytes_per_pixel;
  139|       |
  140|  4.61M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (140:30): [True: 3.62M, False: 986k]
  ------------------
  141|  3.62M|        unsigned char left = 0;
  142|       |
  143|  3.62M|        if (i >= bpp) {
  ------------------
  |  Branch (143:13): [True: 2.55M, False: 1.06M]
  ------------------
  144|  2.55M|            left = buffer[i - bpp];
  145|  2.55M|        }
  146|       |
  147|  3.62M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  148|  3.62M|    }
  149|   986k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  153|  1.04M|{
  154|  1.04M|    unsigned char* buffer = cur_row + 1;
  155|  1.04M|    unsigned char* above_buffer = prev_row + 1;
  156|       |
  157|  5.09M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (157:30): [True: 4.05M, False: 1.04M]
  ------------------
  158|  4.05M|        unsigned char up = above_buffer[i];
  159|  4.05M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  160|  4.05M|    }
  161|  1.04M|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  165|  2.41k|{
  166|  2.41k|    unsigned char* buffer = cur_row + 1;
  167|  2.41k|    unsigned char* above_buffer = prev_row + 1;
  168|  2.41k|    auto bpp = bytes_per_pixel;
  169|       |
  170|   384k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (170:30): [True: 382k, False: 2.41k]
  ------------------
  171|   382k|        int left = 0;
  172|   382k|        int up = 0;
  173|       |
  174|   382k|        if (i >= bpp) {
  ------------------
  |  Branch (174:13): [True: 375k, False: 6.40k]
  ------------------
  175|   375k|            left = buffer[i - bpp];
  176|   375k|        }
  177|       |
  178|   382k|        up = above_buffer[i];
  179|   382k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  180|   382k|    }
  181|  2.41k|}
_ZN12Pl_PNGFilter11decodePaethEv:
  185|  2.03k|{
  186|  2.03k|    unsigned char* buffer = cur_row + 1;
  187|  2.03k|    unsigned char* above_buffer = prev_row + 1;
  188|  2.03k|    auto bpp = bytes_per_pixel;
  189|       |
  190|   267k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (190:30): [True: 265k, False: 2.03k]
  ------------------
  191|   265k|        int left = 0;
  192|   265k|        int up = above_buffer[i];
  193|   265k|        int upper_left = 0;
  194|       |
  195|   265k|        if (i >= bpp) {
  ------------------
  |  Branch (195:13): [True: 263k, False: 2.03k]
  ------------------
  196|   263k|            left = buffer[i - bpp];
  197|   263k|            upper_left = above_buffer[i - bpp];
  198|   263k|        }
  199|       |
  200|   265k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  201|   265k|    }
  202|  2.03k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  206|   265k|{
  207|   265k|    int p = a + b - c;
  208|   265k|    int pa = abs_diff(p, a);
  209|   265k|    int pb = abs_diff(p, b);
  210|   265k|    int pc = abs_diff(p, c);
  211|       |
  212|   265k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (212:9): [True: 261k, False: 3.67k]
  |  Branch (212:21): [True: 261k, False: 504]
  ------------------
  213|   261k|        return a;
  214|   261k|    }
  215|  4.17k|    if (pb <= pc) {
  ------------------
  |  Branch (215:9): [True: 3.61k, False: 560]
  ------------------
  216|  3.61k|        return b;
  217|  3.61k|    }
  218|    560|    return c;
  219|  4.17k|}
_ZN12Pl_PNGFilter6finishEv:
  239|  1.87k|{
  240|  1.87k|    if (pos) {
  ------------------
  |  Branch (240:9): [True: 1.02k, False: 856]
  ------------------
  241|       |        // write partial row
  242|  1.02k|        processRow();
  243|  1.02k|    }
  244|  1.87k|    prev_row = nullptr;
  245|  1.87k|    cur_row = buf1.get();
  246|  1.87k|    pos = 0;
  247|  1.87k|    memset(cur_row, 0, bytes_per_row + 1);
  248|       |
  249|  1.87k|    next()->finish();
  250|  1.87k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|   795k|{
   20|   795k|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 18.1k, False: 777k]
  ------------------
   21|   795k|}

_ZN16Pl_QPDFTokenizerC2EPKcPN16QPDFObjectHandle11TokenFilterEP8Pipeline:
   26|  18.5k|    Pipeline(identifier, next),
   27|  18.5k|    m(std::make_unique<Members>())
   28|  18.5k|{
   29|  18.5k|    m->filter = filter;
   30|  18.5k|    QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, next);
   31|  18.5k|    m->tokenizer.allowEOF();
   32|  18.5k|    m->tokenizer.includeIgnorable();
   33|  18.5k|}
_ZN16Pl_QPDFTokenizerD2Ev:
   36|  18.5k|Pl_QPDFTokenizer::~Pl_QPDFTokenizer() = default;
_ZN16Pl_QPDFTokenizer5writeEPKhm:
   40|  18.4k|{
   41|  18.4k|    m->buf.write(data, len);
   42|  18.4k|}
_ZN16Pl_QPDFTokenizer6finishEv:
   46|  18.4k|{
   47|  18.4k|    auto input = is::OffsetBuffer("tokenizer data", m->buffer);
   48|  18.4k|    std::string empty;
   49|  2.21M|    while (true) {
  ------------------
  |  Branch (49:12): [True: 2.21M, Folded]
  ------------------
   50|  2.21M|        auto token = m->tokenizer.readToken(input, empty, true);
   51|  2.21M|        m->filter->handleToken(token);
   52|  2.21M|        if (token.getType() == QPDFTokenizer::tt_eof) {
  ------------------
  |  Branch (52:13): [True: 18.4k, False: 2.20M]
  ------------------
   53|  18.4k|            break;
   54|  2.20M|        } else if (token.isWord("ID")) {
  ------------------
  |  Branch (54:20): [True: 1.20k, False: 2.19M]
  ------------------
   55|       |            // Read the space after the ID.
   56|  1.20k|            char ch = ' ';
   57|  1.20k|            input.read(&ch, 1);
   58|  1.20k|            m->filter->handleToken(
   59|       |                // line-break
   60|  1.20k|                QPDFTokenizer::Token(QPDFTokenizer::tt_space, std::string(1, ch)));
   61|  1.20k|            QTC::TC("qpdf", "Pl_QPDFTokenizer found ID");
   62|  1.20k|            m->tokenizer.expectInlineImage(input);
   63|  1.20k|        }
   64|  2.21M|    }
   65|  18.4k|    m->filter->handleEOF();
   66|  18.4k|    QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, nullptr);
   67|  18.4k|    if (next()) {
  ------------------
  |  Branch (67:9): [True: 9.10k, False: 9.33k]
  ------------------
   68|  9.10k|        next()->finish();
   69|  9.10k|    }
   70|  18.4k|}
_ZN16Pl_QPDFTokenizer7MembersC2Ev:
   14|  18.5k|    Members() = default;
_ZN16Pl_QPDFTokenizer7MembersD2Ev:
   16|  18.5k|    ~Members() = default;

_ZN6Pl_RC4C2EPKcP8PipelineNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEm:
    9|  1.76k|    Pipeline(identifier, next),
   10|  1.76k|    out_bufsize(out_bufsize),
   11|  1.76k|    rc4(reinterpret_cast<unsigned char const*>(key.data()), static_cast<int>(key.size()))
   12|  1.76k|{
   13|  1.76k|    util::assertion(next, "Attempt to create Pl_RC4 with nullptr as next");
   14|  1.76k|    this->outbuf = QUtil::make_shared_array<unsigned char>(out_bufsize);
   15|  1.76k|}
_ZN6Pl_RC45writeEPKhm:
   19|  1.76k|{
   20|  1.76k|    util::assertion(outbuf.get(), "Pl_RC4: write() called after finish() called");
   21|       |
   22|  1.76k|    size_t bytes_left = len;
   23|  1.76k|    unsigned char const* p = data;
   24|       |
   25|  3.13k|    while (bytes_left > 0) {
  ------------------
  |  Branch (25:12): [True: 1.37k, False: 1.76k]
  ------------------
   26|  1.37k|        size_t bytes = (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
  ------------------
  |  Branch (26:25): [True: 1.01k, False: 359]
  ------------------
   27|  1.37k|        bytes_left -= bytes;
   28|  1.37k|        rc4.process(p, bytes, outbuf.get());
   29|  1.37k|        p += bytes;
   30|  1.37k|        next()->write(outbuf.get(), bytes);
   31|  1.37k|    }
   32|  1.76k|}
_ZN6Pl_RC46finishEv:
   36|  1.76k|{
   37|  1.76k|    outbuf = nullptr;
   38|  1.76k|    next()->finish();
   39|  1.76k|}

_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   32|  12.1k|    Pipeline(identifier, next),
   33|  12.1k|    m(std::make_unique<Members>(action))
   34|  12.1k|{
   35|  12.1k|    util::assertion(next, "Attempt to create Pl_RunLength with nullptr as next");
   36|  12.1k|}
_ZN12Pl_RunLengthD2Ev:
   44|  12.1k|Pl_RunLength::~Pl_RunLength() = default;
_ZN12Pl_RunLength5writeEPKhm:
   48|  95.7k|{
   49|  95.7k|    if (m->action == a_encode) {
  ------------------
  |  Branch (49:9): [True: 0, False: 95.7k]
  ------------------
   50|      0|        encode(data, len);
   51|  95.7k|    } else {
   52|  95.7k|        decode(data, len);
   53|  95.7k|    }
   54|  95.7k|}
_ZN12Pl_RunLength6decodeEPKhm:
   90|  95.7k|{
   91|  95.7k|    util::no_ci_rt_error_if(
   92|  95.7k|        memory_limit && (len + m->out.size()) > memory_limit, "Pl_RunLength memory limit exceeded");
  ------------------
  |  Branch (92:9): [True: 95.7k, False: 0]
  |  Branch (92:25): [True: 30, False: 95.7k]
  ------------------
   93|  95.7k|    m->out.reserve(len);
   94|  17.4M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (94:24): [True: 17.3M, False: 95.7k]
  ------------------
   95|  17.3M|        unsigned char const& ch = data[i];
   96|  17.3M|        switch (m->state) {
  ------------------
  |  Branch (96:17): [True: 17.3M, False: 0]
  ------------------
   97|  7.39M|        case st_top:
  ------------------
  |  Branch (97:9): [True: 7.39M, False: 9.93M]
  ------------------
   98|  7.39M|            if (ch < 128) {
  ------------------
  |  Branch (98:17): [True: 85.7k, False: 7.30M]
  ------------------
   99|       |                // length represents remaining number of bytes to copy
  100|  85.7k|                m->length = 1U + ch;
  101|  85.7k|                m->state = st_copying;
  102|  7.30M|            } else if (ch > 128) {
  ------------------
  |  Branch (102:24): [True: 7.30M, False: 1.12k]
  ------------------
  103|       |                // length represents number of copies of next byte
  104|  7.30M|                m->length = 257U - ch;
  105|  7.30M|                m->state = st_run;
  106|  7.30M|            } else // ch == 128
  107|  1.12k|            {
  108|       |                // EOD; stay in this state
  109|  1.12k|            }
  110|  7.39M|            break;
  111|       |
  112|  2.63M|        case st_copying:
  ------------------
  |  Branch (112:9): [True: 2.63M, False: 14.7M]
  ------------------
  113|  2.63M|            m->out.append(1, static_cast<char>(ch));
  114|  2.63M|            if (--m->length == 0) {
  ------------------
  |  Branch (114:17): [True: 84.8k, False: 2.54M]
  ------------------
  115|  84.8k|                m->state = st_top;
  116|  84.8k|            }
  117|  2.63M|            break;
  118|       |
  119|  7.30M|        case st_run:
  ------------------
  |  Branch (119:9): [True: 7.30M, False: 10.0M]
  ------------------
  120|  7.30M|            m->out.append(m->length, static_cast<char>(ch));
  121|  7.30M|            m->state = st_top;
  122|  7.30M|            break;
  123|  17.3M|        }
  124|  17.3M|    }
  125|  95.7k|}
_ZN12Pl_RunLength6finishEv:
  159|  11.9k|{
  160|       |    // When decoding, we might have read a length byte not followed by data, which means the stream
  161|       |    // was terminated early, but we will just ignore this case since this is the only sensible thing
  162|       |    // to do.
  163|  11.9k|    if (m->action == a_encode) {
  ------------------
  |  Branch (163:9): [True: 0, False: 11.9k]
  ------------------
  164|      0|        flush_encode();
  165|      0|        unsigned char ch = 128;
  166|      0|        next()->write(&ch, 1);
  167|  11.9k|    } else {
  168|  11.9k|        if (memory_limit && (m->out.size()) > memory_limit) {
  ------------------
  |  Branch (168:13): [True: 11.9k, False: 0]
  |  Branch (168:29): [True: 51, False: 11.9k]
  ------------------
  169|     51|            throw std::runtime_error("Pl_RunLength memory limit exceeded");
  170|     51|        }
  171|  11.9k|        next()->writeString(m->out);
  172|  11.9k|    }
  173|  11.9k|    next()->finish();
  174|  11.9k|}
_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   18|  12.1k|        action(action)
   19|  12.1k|    {
   20|  12.1k|    }
_ZN12Pl_RunLength7MembersD2Ev:
   22|  12.1k|    ~Members() = default;

_ZN7Pl_SHA2C2EiP8Pipeline:
   10|   181k|    Pipeline("sha2", next)
   11|   181k|{
   12|   181k|    if (bits) {
  ------------------
  |  Branch (12:9): [True: 181k, False: 0]
  ------------------
   13|   181k|        resetBits(bits);
   14|   181k|    }
   15|   181k|}
_ZN7Pl_SHA25writeEPKhm:
   19|   187k|{
   20|   187k|    if (!in_progress) {
  ------------------
  |  Branch (20:9): [True: 181k, False: 5.69k]
  ------------------
   21|   181k|        in_progress = true;
   22|   181k|    }
   23|       |
   24|       |    // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
   25|   187k|    static size_t const max_bytes = 1 << 30;
   26|   187k|    size_t bytes_left = len;
   27|   187k|    unsigned char const* data = buf;
   28|   371k|    while (bytes_left > 0) {
  ------------------
  |  Branch (28:12): [True: 183k, False: 187k]
  ------------------
   29|   183k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (29:25): [True: 0, False: 183k]
  ------------------
   30|   183k|        crypto->SHA2_update(data, bytes);
   31|   183k|        bytes_left -= bytes;
   32|   183k|        data += bytes;
   33|   183k|    }
   34|       |
   35|   187k|    if (next()) {
  ------------------
  |  Branch (35:9): [True: 0, False: 187k]
  ------------------
   36|      0|        next()->write(buf, len);
   37|      0|    }
   38|   187k|}
_ZN7Pl_SHA26finishEv:
   42|   181k|{
   43|   181k|    if (next()) {
  ------------------
  |  Branch (43:9): [True: 0, False: 181k]
  ------------------
   44|      0|        next()->finish();
   45|      0|    }
   46|   181k|    crypto->SHA2_finalize();
   47|   181k|    in_progress = false;
   48|   181k|}
_ZN7Pl_SHA29resetBitsEi:
   52|   181k|{
   53|   181k|    util::assertion(!in_progress, "bit reset requested for in-progress SHA2 Pipeline");
   54|   181k|    crypto = QPDFCryptoProvider::getImpl();
   55|   181k|    crypto->SHA2_init(bits);
   56|   181k|}
_ZN7Pl_SHA212getRawDigestEv:
   60|   181k|{
   61|   181k|    util::assertion(!in_progress, "digest requested for in-progress SHA2 Pipeline");
   62|   181k|    return crypto->SHA2_digest();
   63|   181k|}

_ZN9Pl_StringC2EPKcP8PipelineRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   19|  19.6k|    Pipeline(identifier, next),
   20|  19.6k|    m(std::make_unique<Members>(s))
   21|  19.6k|{
   22|  19.6k|}
_ZN9Pl_StringD2Ev:
   25|  19.6k|Pl_String::~Pl_String() = default;
_ZN9Pl_String5writeEPKhm:
   29|  3.35M|{
   30|  3.35M|    if (!len) {
  ------------------
  |  Branch (30:9): [True: 0, False: 3.35M]
  ------------------
   31|      0|        return;
   32|      0|    }
   33|  3.35M|    m->s.append(reinterpret_cast<char const*>(buf), len);
   34|  3.35M|    if (next()) {
  ------------------
  |  Branch (34:9): [True: 0, False: 3.35M]
  ------------------
   35|      0|        next()->write(buf, len);
   36|      0|    }
   37|  3.35M|}
_ZN9Pl_String7MembersC2ERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
    9|  19.6k|        s(s)
   10|  19.6k|    {
   11|  19.6k|    }

_ZN16Pl_TIFFPredictorC2EPKcP8PipelineNS_8action_eEjjj:
   26|  1.13k|    Pipeline(identifier, next),
   27|  1.13k|    action(action),
   28|  1.13k|    columns(columns),
   29|  1.13k|    samples_per_pixel(samples_per_pixel),
   30|  1.13k|    bits_per_sample(bits_per_sample)
   31|  1.13k|{
   32|  1.13k|    util::assertion(next, "Attempt to create Pl_TIFFPredictor with nullptr as next");
   33|  1.13k|    util::no_ci_rt_error_if(
   34|  1.13k|        samples_per_pixel < 1, "TIFFPredictor created with invalid samples_per_pixel");
   35|  1.13k|    util::no_ci_rt_error_if(
   36|  1.13k|        bits_per_sample < 1 || bits_per_sample > (8 * (sizeof(unsigned long long))),
  ------------------
  |  Branch (36:9): [True: 6, False: 1.13k]
  |  Branch (36:32): [True: 4, False: 1.12k]
  ------------------
   37|  1.13k|        "TIFFPredictor created with invalid bits_per_sample");
   38|  1.13k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   39|  1.13k|    util::no_ci_rt_error_if(
   40|  1.13k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   41|  1.13k|        "TIFFPredictor created with bits_per_sample and samples_per_pixel values that cause "
   42|  1.13k|        "overflow");
   43|  1.13k|    auto bpr = (columns * bits_per_pixel + 7) / 8;
   44|  1.13k|    util::no_ci_rt_error_if(
   45|  1.13k|        bpr == 0 || !util::fits<uint32_t>(bpr), "TIFFPredictor created with invalid columns value");
  ------------------
  |  Branch (45:9): [True: 10, False: 1.12k]
  |  Branch (45:21): [True: 0, False: 1.12k]
  ------------------
   46|  1.13k|    util::no_ci_rt_error_if(
   47|  1.13k|        memory_limit > 0 && bpr > (memory_limit / 2ULL), "TIFFPredictor memory limit exceeded");
  ------------------
  |  Branch (47:9): [True: 1.12k, False: 10]
  |  Branch (47:29): [True: 12, False: 1.11k]
  ------------------
   48|  1.13k|    bytes_per_row = static_cast<uint32_t>(bpr);
   49|  1.13k|}
_ZN16Pl_TIFFPredictor5writeEPKhm:
   59|   383k|{
   60|   383k|    auto end = data + len;
   61|   383k|    auto row_end = data + (bytes_per_row - cur_row.size());
   62|  1.56M|    while (row_end <= end) {
  ------------------
  |  Branch (62:12): [True: 1.17M, False: 383k]
  ------------------
   63|       |        // finish off current row
   64|  1.17M|        cur_row.insert(cur_row.end(), data, row_end);
   65|  1.17M|        data = row_end;
   66|  1.17M|        row_end += bytes_per_row;
   67|       |
   68|  1.17M|        processRow();
   69|       |
   70|       |        // Prepare for next row
   71|  1.17M|        cur_row.clear();
   72|  1.17M|    }
   73|       |
   74|   383k|    cur_row.insert(cur_row.end(), data, end);
   75|   383k|}
_ZN16Pl_TIFFPredictor10processRowEv:
   79|  1.17M|{
   80|  1.17M|    QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
  ------------------
  |  Branch (80:57): [True: 1.17M, False: 0]
  ------------------
   81|  1.17M|    previous.assign(samples_per_pixel, 0);
   82|  1.17M|    if (bits_per_sample != 8) {
  ------------------
  |  Branch (82:9): [True: 1.46k, False: 1.17M]
  ------------------
   83|  1.46k|        BitWriter bw(next());
   84|  1.46k|        BitStream in(cur_row.data(), cur_row.size());
   85|   614k|        for (uint32_t col = 0; col < this->columns; ++col) {
  ------------------
  |  Branch (85:32): [True: 612k, False: 1.46k]
  ------------------
   86|   678k|            for (auto& prev: previous) {
  ------------------
  |  Branch (86:28): [True: 678k, False: 612k]
  ------------------
   87|   678k|                long long sample = in.getBitsSigned(this->bits_per_sample);
   88|   678k|                long long new_sample = sample;
   89|   678k|                if (action == a_encode) {
  ------------------
  |  Branch (89:21): [True: 0, False: 678k]
  ------------------
   90|      0|                    new_sample -= prev;
   91|      0|                    prev = sample;
   92|   678k|                } else {
   93|   678k|                    new_sample += prev;
   94|   678k|                    prev = new_sample;
   95|   678k|                }
   96|   678k|                bw.writeBitsSigned(new_sample, this->bits_per_sample);
   97|   678k|            }
   98|   612k|        }
   99|  1.46k|        bw.flush();
  100|  1.17M|    } else {
  101|  1.17M|        out.clear();
  102|  1.17M|        auto next_it = cur_row.begin();
  103|  1.17M|        auto cr_end = cur_row.end();
  104|  1.17M|        auto pr_end = previous.end();
  105|       |
  106|  6.26M|        while (next_it != cr_end) {
  ------------------
  |  Branch (106:16): [True: 5.08M, False: 1.17M]
  ------------------
  107|  11.3M|            for (auto prev = previous.begin(); prev != pr_end && next_it != cr_end;
  ------------------
  |  Branch (107:48): [True: 6.30M, False: 5.08M]
  |  Branch (107:66): [True: 6.30M, False: 0]
  ------------------
  108|  6.30M|                 ++prev, ++next_it) {
  109|  6.30M|                long long sample = *next_it;
  110|  6.30M|                long long new_sample = sample;
  111|  6.30M|                if (action == a_encode) {
  ------------------
  |  Branch (111:21): [True: 0, False: 6.30M]
  ------------------
  112|      0|                    new_sample -= *prev;
  113|      0|                    *prev = sample;
  114|  6.30M|                } else {
  115|  6.30M|                    new_sample += *prev;
  116|  6.30M|                    *prev = new_sample;
  117|  6.30M|                }
  118|  6.30M|                out.push_back(static_cast<unsigned char>(255U & new_sample));
  119|  6.30M|            }
  120|  5.08M|        }
  121|  1.17M|        next()->write(out.data(), out.size());
  122|  1.17M|    }
  123|  1.17M|}
_ZN16Pl_TIFFPredictor6finishEv:
  127|  1.08k|{
  128|  1.08k|    if (!cur_row.empty()) {
  ------------------
  |  Branch (128:9): [True: 432, False: 648]
  ------------------
  129|       |        // write partial row
  130|    432|        cur_row.insert(cur_row.end(), bytes_per_row - cur_row.size(), 0);
  131|    432|        processRow();
  132|    432|    }
  133|  1.08k|    cur_row.clear();
  134|  1.08k|    next()->finish();
  135|  1.08k|}

_ZN4QPDF15StringDecrypterC2EPS_10QPDFObjGen:
  118|   153k|    qpdf(qpdf),
  119|   153k|    og(og)
  120|   153k|{
  121|   153k|}
_ZN4QPDF7MembersC2ERS_:
  131|  25.9k|    Doc(qpdf, this),
  132|  25.9k|    c(qpdf, this),
  133|  25.9k|    lin(*this),
  134|  25.9k|    objects(*this),
  135|  25.9k|    pages(*this),
  136|  25.9k|    file(std::make_shared<InvalidInputSource>()),
  137|  25.9k|    encp(std::make_shared<EncryptionParameters>())
  138|  25.9k|{
  139|  25.9k|}
_ZN4QPDFC2Ev:
  142|  25.9k|    m(std::make_unique<Members>(*this))
  143|  25.9k|{
  144|  25.9k|    m->tokenizer.allowEOF();
  145|       |    // Generate a unique ID. It just has to be unique among all QPDF objects allocated throughout
  146|       |    // the lifetime of this running application.
  147|  25.9k|    static std::atomic<unsigned long long> unique_id{0};
  148|  25.9k|    m->unique_id = unique_id.fetch_add(1ULL);
  149|  25.9k|}
_ZN4QPDF3Doc13init_acroformEv:
  161|  9.16k|{
  162|  9.16k|    acroform_dh_ = std::make_unique<QPDFAcroFormDocumentHelper>(qpdf);
  163|  9.16k|    acroform_ = acroform_dh_->m.get();
  164|  9.16k|}
_ZN4QPDFD2Ev:
  186|  25.9k|{
  187|       |    // If two objects are mutually referential (through each object having an array or dictionary
  188|       |    // that contains an indirect reference to the other), the circular references in the
  189|       |    // std::shared_ptr objects will prevent the objects from being deleted. Walk through all objects
  190|       |    // in the object cache, which is those objects that we read from the file, and break all
  191|       |    // resolved indirect references by replacing them with an internal object type representing that
  192|       |    // they have been destroyed. Note that we can't break references like this at any time when the
  193|       |    // QPDF object is active. The call to reset also causes all direct QPDFObjectHandle objects that
  194|       |    // are reachable from this object to release their association with this QPDF. Direct objects
  195|       |    // are not destroyed since they can be moved to other QPDF objects safely.
  196|       |
  197|       |    // At this point, obviously no one is still using the QPDF object, but we'll explicitly clear
  198|       |    // the xref table anyway just to prevent any possibility of resolve() succeeding.
  199|  25.9k|    m->xref_table.clear();
  200|   400k|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (200:26): [True: 400k, False: 25.9k]
  ------------------
  201|   400k|        Disconnect(iter.second.object).disconnect();
  202|   400k|    }
  203|  25.9k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  235|  25.9k|{
  236|  25.9k|    m->file = source;
  237|  25.9k|    m->objects.parse(password);
  238|  25.9k|}
_ZN4QPDF4warnERK7QPDFExc:
  337|   720k|{
  338|   720k|    m->c.warn(e);
  339|   720k|}
_ZN4QPDF3Doc6Common4warnERK7QPDFExc:
  343|  1.05M|{
  344|  1.05M|    if (cf.max_warnings() > 0 && m->warnings.size() >= cf.max_warnings()) {
  ------------------
  |  Branch (344:9): [True: 883k, False: 174k]
  |  Branch (344:34): [True: 30.3k, False: 853k]
  ------------------
  345|  30.3k|        stopOnError("Too many warnings - file is too badly damaged");
  346|  30.3k|    }
  347|  1.05M|    m->warnings.emplace_back(e);
  348|  1.05M|    if (!cf.suppress_warnings()) {
  ------------------
  |  Branch (348:9): [True: 1.02M, False: 30.3k]
  ------------------
  349|  1.02M|        *cf.log()->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  350|  1.02M|    }
  351|  1.05M|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  359|  13.6k|{
  360|  13.6k|    m->c.warn(QPDFExc(error_code, getFilename(), object, offset, message));
  361|  13.6k|}
_ZN4QPDF3Doc6Common4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEExSB_:
  369|    586|{
  370|    586|    warn(QPDFExc(error_code, qpdf.getFilename(), object, offset, message));
  371|    586|}
_ZN4QPDF9newStreamEv:
  387|  15.9k|{
  388|  15.9k|    return makeIndirectObject(
  389|  15.9k|        qpdf::Stream(*this, m->objects.nextObjGen(), Dictionary::empty(), 0, 0));
  390|  15.9k|}
_ZN4QPDF9newStreamERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  402|  10.9k|{
  403|  10.9k|    auto result = newStream();
  404|  10.9k|    result.replaceStreamData(data, {}, {});
  405|  10.9k|    return result;
  406|  10.9k|}
_ZN4QPDF9getObjectEii:
  410|  26.3k|{
  411|  26.3k|    return getObject({objid, generation});
  412|  26.3k|}
_ZNK4QPDF11getFilenameEv:
  625|  88.2k|{
  626|  88.2k|    return m->file->getName();
  627|  88.2k|}
_ZN4QPDF7getRootEv:
  669|   150k|{
  670|   150k|    Dictionary Root = m->trailer["/Root"];
  671|   150k|    if (!Root) {
  ------------------
  |  Branch (671:9): [True: 5.83k, False: 144k]
  ------------------
  672|  5.83k|        throw m->c.damagedPDF("", -1, "unable to find /Root dictionary");
  673|  5.83k|    }
  674|   144k|    if (!m->objects.root_checked()) {
  ------------------
  |  Branch (674:9): [True: 11.5k, False: 133k]
  ------------------
  675|  11.5k|        m->objects.root_checked(true);
  676|  11.5k|        if (Name(Root["/Type"]) != "/Catalog") {
  ------------------
  |  Branch (676:13): [True: 3.42k, False: 8.16k]
  ------------------
  677|  3.42k|            warn(m->c.damagedPDF(
  678|  3.42k|                "", -1, "Catalog: setting missing or invalid /Type entry to /Catalog"));
  679|  3.42k|            if (!global::Options::inspection_mode()) {
  ------------------
  |  Branch (679:17): [True: 3.42k, False: 1]
  ------------------
  680|  3.42k|                Root.replace("/Type", Name("/Catalog"));
  681|  3.42k|            }
  682|  3.42k|        }
  683|  11.5k|    }
  684|   144k|    return Root.oh();
  685|   150k|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  713|  28.0k|{
  714|  28.0k|    std::unique_ptr<Pipeline> to_delete;
  715|  28.0k|    if (encp->encrypted) {
  ------------------
  |  Branch (715:9): [True: 5.51k, False: 22.5k]
  ------------------
  716|  5.51k|        decryptStream(
  717|  5.51k|            encp, file, qpdf_for_warning, pipeline, og, stream_dict, is_root_metadata, to_delete);
  718|  5.51k|    }
  719|       |
  720|  28.0k|    bool attempted_finish = false;
  721|  28.0k|    try {
  722|  28.0k|        auto buf = file->read(length, offset);
  723|  28.0k|        if (buf.size() != length) {
  ------------------
  |  Branch (723:13): [True: 0, False: 28.0k]
  ------------------
  724|      0|            throw qpdf_for_warning.m->c.damagedPDF(
  725|      0|                *file,
  726|      0|                "",
  727|      0|                offset + QIntC::to_offset(buf.size()),
  728|      0|                "unexpected EOF reading stream data");
  729|      0|        }
  730|  28.0k|        pipeline->write(buf.data(), length);
  731|  28.0k|        attempted_finish = true;
  732|  28.0k|        pipeline->finish();
  733|  28.0k|        return true;
  734|  28.0k|    } catch (QPDFExc& e) {
  735|      1|        if (!suppress_warnings) {
  ------------------
  |  Branch (735:13): [True: 1, False: 0]
  ------------------
  736|      1|            qpdf_for_warning.warn(e);
  737|      1|        }
  738|  2.59k|    } catch (std::exception& e) {
  739|  2.59k|        if (!suppress_warnings) {
  ------------------
  |  Branch (739:13): [True: 2.59k, False: 0]
  ------------------
  740|  2.59k|            QTC::TC("qpdf", "QPDF decoding error warning");
  741|  2.59k|            qpdf_for_warning.warn(
  742|       |                // line-break
  743|  2.59k|                qpdf_for_warning.m->c.damagedPDF(
  744|  2.59k|                    *file,
  745|  2.59k|                    "",
  746|  2.59k|                    file->getLastOffset(),
  747|  2.59k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
  748|  2.59k|                     e.what())));
  749|  2.59k|            if (will_retry) {
  ------------------
  |  Branch (749:17): [True: 0, False: 2.59k]
  ------------------
  750|      0|                qpdf_for_warning.warn(
  751|       |                    // line-break
  752|      0|                    qpdf_for_warning.m->c.damagedPDF(
  753|      0|                        *file,
  754|      0|                        "",
  755|      0|                        file->getLastOffset(),
  756|      0|                        "stream will be re-processed without filtering to avoid data loss"));
  757|      0|            }
  758|  2.59k|        }
  759|  2.59k|    }
  760|  2.53k|    if (!attempted_finish) {
  ------------------
  |  Branch (760:9): [True: 1.86k, False: 671]
  ------------------
  761|  1.86k|        try {
  762|  1.86k|            pipeline->finish();
  763|  1.86k|        } catch (std::exception&) {
  764|       |            // ignore
  765|  1.22k|        }
  766|  1.86k|    }
  767|  2.53k|    return false;
  768|  2.53k|}
_ZN4QPDF14pipeStreamDataE10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  780|  28.0k|{
  781|  28.0k|    return pipeStreamData(
  782|  28.0k|        m->encp,
  783|  28.0k|        m->file,
  784|  28.0k|        *this,
  785|  28.0k|        og,
  786|  28.0k|        offset,
  787|  28.0k|        length,
  788|  28.0k|        stream_dict,
  789|  28.0k|        is_root_metadata,
  790|  28.0k|        pipeline,
  791|  28.0k|        suppress_warnings,
  792|  28.0k|        will_retry);
  793|  28.0k|}
_ZN4QPDF3Doc6Common11stopOnErrorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  799|  30.3k|{
  800|  30.3k|    throw damagedPDF("", message);
  801|  30.3k|}
_ZN4QPDF3Doc6Common10damagedPDFER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEExSC_:
  807|  49.0k|{
  808|  49.0k|    return {qpdf_e_damaged_pdf, input.getName(), object, offset, message, true};
  809|  49.0k|}
_ZNK4QPDF3Doc6Common10damagedPDFER11InputSourcexRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  815|  46.4k|{
  816|  46.4k|    return damagedPDF(input, m->last_object_description, offset, message);
  817|  46.4k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEExSA_:
  823|   298k|{
  824|   298k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message, true};
  825|   298k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  831|  72.1k|{
  832|  72.1k|    return damagedPDF(object, m->file->getLastOffset(), message);
  833|  72.1k|}
_ZNK4QPDF3Doc6Common10damagedPDFExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  839|  42.2k|{
  840|  42.2k|    return damagedPDF(m->last_object_description, offset, message);
  841|  42.2k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  847|  47.2k|{
  848|  47.2k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
  849|  47.2k|}
_ZN10DisconnectC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  172|   400k|        BaseHandle(obj)
  173|   400k|    {
  174|   400k|    }
_ZN10Disconnect10disconnectEv:
  177|   400k|    {
  178|   400k|        BaseHandle::disconnect(false);
  179|   400k|        if (raw_type_code() != ::ot_null) {
  ------------------
  |  Branch (179:13): [True: 175k, False: 224k]
  ------------------
  180|   175k|            obj->value = QPDF_Destroyed();
  181|   175k|        }
  182|   400k|    }

_ZN26QPDFAcroFormDocumentHelperC2ER4QPDF:
   24|  18.9k|    QPDFDocumentHelper(qpdf),
   25|  18.9k|    m(std::make_shared<Members>(qpdf))
   26|  18.9k|{
   27|  18.9k|}
_ZN4qpdf4impl8AcroForm8validateEb:
   43|  18.9k|{
   44|  18.9k|    invalidateCache();
   45|  18.9k|    analyze();
   46|  18.9k|}
_ZN4qpdf4impl8AcroForm15invalidateCacheEv:
   56|  18.9k|{
   57|  18.9k|    cache_valid_ = false;
   58|  18.9k|    fields_.clear();
   59|  18.9k|    annotation_to_field_.clear();
   60|  18.9k|    bad_fields_.clear();
   61|  18.9k|    unnamed_fields_.clear();
   62|  18.9k|    name_to_fields_.clear();
   63|  18.9k|}
_ZN26QPDFAcroFormDocumentHelper27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  279|  18.9k|{
  280|  18.9k|    return m->getWidgetAnnotationsForPage(h);
  281|  18.9k|}
_ZN4qpdf4impl8AcroForm27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  285|  30.5k|{
  286|  30.5k|    return h.getAnnotations("/Widget");
  287|  30.5k|}
_ZN26QPDFAcroFormDocumentHelper21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  312|  2.22k|{
  313|  2.22k|    return m->getFieldForAnnotation(h);
  314|  2.22k|}
_ZN4qpdf4impl8AcroForm21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  318|  23.5k|{
  319|  23.5k|    QPDFObjectHandle oh = h.getObjectHandle();
  320|  23.5k|    if (!oh.isDictionaryOfType("", "/Widget")) {
  ------------------
  |  Branch (320:9): [True: 0, False: 23.5k]
  ------------------
  321|      0|        return Null::temp();
  322|      0|    }
  323|  23.5k|    analyze();
  324|  23.5k|    QPDFObjGen og(oh.getObjGen());
  325|  23.5k|    if (annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (325:9): [True: 21.7k, False: 1.78k]
  ------------------
  326|  21.7k|        return annotation_to_field_[og];
  327|  21.7k|    }
  328|  1.78k|    return Null::temp();
  329|  23.5k|}
_ZN4qpdf4impl8AcroForm7analyzeEv:
  333|  42.4k|{
  334|  42.4k|    if (cache_valid_) {
  ------------------
  |  Branch (334:9): [True: 23.5k, False: 18.9k]
  ------------------
  335|  23.5k|        return;
  336|  23.5k|    }
  337|  18.9k|    cache_valid_ = true;
  338|  18.9k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  339|  18.9k|    if (!(acroform.isDictionary() && acroform.hasKey("/Fields"))) {
  ------------------
  |  Branch (339:9): [True: 11.9k, False: 6.92k]
  |  Branch (339:11): [True: 6.99k, False: 11.9k]
  |  Branch (339:38): [True: 6.92k, False: 69]
  ------------------
  340|  11.9k|        return;
  341|  11.9k|    }
  342|  6.92k|    QPDFObjectHandle fields = acroform.getKey("/Fields");
  343|  6.92k|    if (Array fa = fields) {
  ------------------
  |  Branch (343:15): [True: 6.89k, False: 35]
  ------------------
  344|       |        // Traverse /AcroForm to find annotations and map them bidirectionally to fields.
  345|  35.4k|        for (auto const& field: fa) {
  ------------------
  |  Branch (345:31): [True: 35.4k, False: 6.89k]
  ------------------
  346|  35.4k|            traverseField(field, {}, 0);
  347|  35.4k|        }
  348|  6.89k|    } else {
  349|     35|        acroform.warn("/Fields key of /AcroForm dictionary is not an array; ignoring");
  350|     35|        fields = Array::empty();
  351|     35|    }
  352|       |
  353|       |    // All Widget annotations should have been encountered by traversing /AcroForm, but in case any
  354|       |    // weren't, find them by walking through pages, and treat any widget annotation that is not
  355|       |    // associated with a field as its own field. This just ensures that requesting the field for any
  356|       |    // annotation we find through a page's /Annots list will have some associated field. Note that
  357|       |    // a file that contains this kind of error will probably not
  358|       |    // actually work with most viewers.
  359|       |
  360|  8.06k|    for (QPDFPageObjectHelper ph: pages) {
  ------------------
  |  Branch (360:33): [True: 8.06k, False: 6.92k]
  ------------------
  361|  26.3k|        for (auto const& iter: getWidgetAnnotationsForPage(ph)) {
  ------------------
  |  Branch (361:30): [True: 26.3k, False: 8.06k]
  ------------------
  362|  26.3k|            QPDFObjectHandle annot(iter.getObjectHandle());
  363|  26.3k|            QPDFObjGen og(annot.getObjGen());
  364|  26.3k|            if (!annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (364:17): [True: 18.1k, False: 8.23k]
  ------------------
  365|       |                // This is not supposed to happen, but it's easy enough for us to handle this case.
  366|       |                // Treat the annotation as its own field. This could allow qpdf to sensibly handle a
  367|       |                // case such as a PDF creator adding a self-contained annotation (merged with the
  368|       |                // field dictionary) to the page's /Annots array and forgetting to also put it in
  369|       |                // /AcroForm.
  370|  18.1k|                annot.warn(
  371|  18.1k|                    "this widget annotation is not reachable from /AcroForm in the document "
  372|  18.1k|                    "catalog");
  373|  18.1k|                annotation_to_field_[og] = QPDFFormFieldObjectHelper(annot);
  374|  18.1k|                fields_[og].annotations.emplace_back(annot);
  375|  18.1k|            }
  376|  26.3k|        }
  377|  8.06k|    }
  378|  6.92k|}
_ZN4qpdf4impl8AcroForm13traverseFieldE16QPDFObjectHandleRKS2_i:
  382|  68.1k|{
  383|  68.1k|    if (depth > 100) {
  ------------------
  |  Branch (383:9): [True: 0, False: 68.1k]
  ------------------
  384|       |        // Arbitrarily cut off recursion at a fixed depth to avoid specially crafted files that
  385|       |        // could cause stack overflow.
  386|      0|        return false;
  387|      0|    }
  388|  68.1k|    if (!field.indirect()) {
  ------------------
  |  Branch (388:9): [True: 18.9k, False: 49.1k]
  ------------------
  389|  18.9k|        field.warn(
  390|  18.9k|            "encountered a direct object as a field or annotation while traversing /AcroForm; "
  391|  18.9k|            "ignoring field or annotation");
  392|  18.9k|        return false;
  393|  18.9k|    }
  394|  49.1k|    if (field == parent) {
  ------------------
  |  Branch (394:9): [True: 138, False: 49.0k]
  ------------------
  395|    138|        field.warn("loop detected while traversing /AcroForm");
  396|    138|        return false;
  397|    138|    }
  398|  49.0k|    if (!field.isDictionary()) {
  ------------------
  |  Branch (398:9): [True: 31.9k, False: 17.0k]
  ------------------
  399|  31.9k|        field.warn(
  400|  31.9k|            "encountered a non-dictionary as a field or annotation while traversing /AcroForm; "
  401|  31.9k|            "ignoring field or annotation");
  402|  31.9k|        return false;
  403|  31.9k|    }
  404|  17.0k|    QPDFObjGen og(field.getObjGen());
  405|  17.0k|    if (unnamed_fields_.contains(og)) {
  ------------------
  |  Branch (405:9): [True: 1.12k, False: 15.9k]
  ------------------
  406|  1.12k|        bad_fields_.insert(og);
  407|  1.12k|    }
  408|  17.0k|    if (fields_.contains(og) || annotation_to_field_.contains(og) || bad_fields_.contains(og)) {
  ------------------
  |  Branch (408:9): [True: 527, False: 16.5k]
  |  Branch (408:33): [True: 301, False: 16.2k]
  |  Branch (408:70): [True: 1.23k, False: 15.0k]
  ------------------
  409|  2.06k|        field.warn("loop detected while traversing /AcroForm");
  410|  2.06k|        return false;
  411|  2.06k|    }
  412|       |
  413|       |    // A dictionary encountered while traversing the /AcroForm field may be a form field, an
  414|       |    // annotation, or the merger of the two. A field that has no fields below it is a terminal. If a
  415|       |    // terminal field looks like an annotation, it is an annotation because annotation dictionary
  416|       |    // fields can be merged with terminal field dictionaries. Otherwise, the annotation fields might
  417|       |    // be there to be inherited by annotations below it.
  418|       |
  419|  15.0k|    FormNode node = field;
  420|  15.0k|    const bool is_field = node.field();
  421|  15.0k|    const bool is_annotation = node.widget();
  422|       |
  423|  15.0k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper field found", (depth == 0) ? 0 : 1);
  ------------------
  |  Branch (423:63): [True: 5.49k, False: 9.51k]
  ------------------
  424|  15.0k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper annotation found", (is_field ? 0 : 1));
  ------------------
  |  Branch (424:69): [True: 12.0k, False: 2.94k]
  ------------------
  425|       |
  426|  15.0k|    if (!is_field && !is_annotation) {
  ------------------
  |  Branch (426:9): [True: 2.94k, False: 12.0k]
  |  Branch (426:22): [True: 2.36k, False: 576]
  ------------------
  427|  2.36k|        field.warn(
  428|  2.36k|            "encountered an object that is neither field nor annotation while traversing "
  429|  2.36k|            "/AcroForm");
  430|  2.36k|        return false;
  431|  2.36k|    }
  432|       |
  433|  12.6k|    if (is_annotation) {
  ------------------
  |  Branch (433:9): [True: 8.01k, False: 4.62k]
  ------------------
  434|  8.01k|        auto our_field = (is_field ? field : parent);
  ------------------
  |  Branch (434:27): [True: 7.44k, False: 576]
  ------------------
  435|  8.01k|        fields_[our_field].annotations.emplace_back(field);
  436|  8.01k|        annotation_to_field_[og] = QPDFFormFieldObjectHelper(our_field);
  437|  8.01k|    }
  438|       |
  439|  12.6k|    if (!is_field) {
  ------------------
  |  Branch (439:9): [True: 576, False: 12.0k]
  ------------------
  440|    576|        return true;
  441|    576|    }
  442|       |
  443|  12.0k|    if (depth != 0 && field["/Parent"] != parent) {
  ------------------
  |  Branch (443:9): [True: 8.24k, False: 3.81k]
  |  Branch (443:9): [True: 1.72k, False: 10.3k]
  |  Branch (443:23): [True: 1.72k, False: 6.52k]
  ------------------
  444|  24.1k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (444:29): [True: 24.1k, False: 1.45k]
  ------------------
  445|  24.1k|            if (kid == field) {
  ------------------
  |  Branch (445:17): [True: 267, False: 23.8k]
  ------------------
  446|    267|                field.warn("while traversing /AcroForm found field with two parents");
  447|    267|                return true;
  448|    267|            }
  449|  24.1k|        }
  450|  11.1k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (450:29): [True: 11.1k, False: 1.29k]
  ------------------
  451|  11.1k|            if (kid == parent) {
  ------------------
  |  Branch (451:17): [True: 160, False: 10.9k]
  ------------------
  452|    160|                field.warn("loop detected while traversing /AcroForm");
  453|    160|                return false;
  454|    160|            }
  455|  11.1k|        }
  456|  1.29k|        field.warn("encountered invalid /Parent entry while traversing /AcroForm; correcting");
  457|  1.29k|        field.replaceKey("/Parent", parent);
  458|  1.29k|    }
  459|       |
  460|  11.6k|    if (node.T()) {
  ------------------
  |  Branch (460:9): [True: 9.16k, False: 2.47k]
  ------------------
  461|  9.16k|        auto old = fields_.find(og);
  462|  9.16k|        if (old != fields_.end() && !old->second.name.empty()) {
  ------------------
  |  Branch (462:13): [True: 6.08k, False: 3.07k]
  |  Branch (462:13): [True: 0, False: 9.16k]
  |  Branch (462:37): [True: 0, False: 6.08k]
  ------------------
  463|       |            // We might be updating after a name change, so remove any old information
  464|      0|            name_to_fields_[old->second.name].erase(og);
  465|      0|        }
  466|  9.16k|        std::string name = node.fully_qualified_name();
  467|  9.16k|        fields_[og].name = name;
  468|  9.16k|        name_to_fields_[name].insert(og);
  469|  9.16k|    } else if (!is_annotation) {
  ------------------
  |  Branch (469:16): [True: 1.40k, False: 1.07k]
  ------------------
  470|  1.40k|        unnamed_fields_.insert(og);
  471|  1.40k|    }
  472|       |
  473|  56.8k|    for (auto const& kid: node.Kids()) {
  ------------------
  |  Branch (473:25): [True: 56.8k, False: 11.6k]
  ------------------
  474|  56.8k|        if (bad_fields_.contains(kid)) {
  ------------------
  |  Branch (474:13): [True: 24.1k, False: 32.7k]
  ------------------
  475|  24.1k|            continue;
  476|  24.1k|        }
  477|       |
  478|  32.7k|        if (!traverseField(kid, field, 1 + depth)) {
  ------------------
  |  Branch (478:13): [True: 24.3k, False: 8.38k]
  ------------------
  479|  24.3k|            bad_fields_.insert(kid);
  480|  24.3k|        }
  481|  32.7k|    }
  482|  11.6k|    return true;
  483|  12.0k|}
_ZN4qpdf4impl8AcroForm18getNeedAppearancesEv:
  493|  50.3k|{
  494|  50.3k|    bool result = false;
  495|  50.3k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  496|  50.3k|    if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) {
  ------------------
  |  Branch (496:9): [True: 13.9k, False: 36.3k]
  |  Branch (496:9): [True: 3.09k, False: 47.2k]
  |  Branch (496:36): [True: 3.09k, False: 10.8k]
  ------------------
  497|  3.09k|        result = acroform.getKey("/NeedAppearances").getBoolValue();
  498|  3.09k|    }
  499|  50.3k|    return result;
  500|  50.3k|}
_ZN4qpdf4impl8AcroForm18setNeedAppearancesEb:
  510|  2.47k|{
  511|  2.47k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  512|  2.47k|    if (!acroform.isDictionary()) {
  ------------------
  |  Branch (512:9): [True: 0, False: 2.47k]
  ------------------
  513|      0|        qpdf.getRoot().warn(
  514|      0|            "ignoring call to QPDFAcroFormDocumentHelper::setNeedAppearances"
  515|      0|            " on a file that lacks an /AcroForm dictionary");
  516|      0|        return;
  517|      0|    }
  518|  2.47k|    if (val) {
  ------------------
  |  Branch (518:9): [True: 0, False: 2.47k]
  ------------------
  519|      0|        acroform.replaceKey("/NeedAppearances", QPDFObjectHandle::newBool(true));
  520|  2.47k|    } else {
  521|  2.47k|        acroform.removeKey("/NeedAppearances");
  522|  2.47k|    }
  523|  2.47k|}
_ZN26QPDFAcroFormDocumentHelper27generateAppearancesIfNeededEv:
  527|  9.75k|{
  528|  9.75k|    m->generateAppearancesIfNeeded();
  529|  9.75k|}
_ZN4qpdf4impl8AcroForm27generateAppearancesIfNeededEv:
  533|  9.75k|{
  534|  9.75k|    if (!getNeedAppearances()) {
  ------------------
  |  Branch (534:9): [True: 6.68k, False: 3.06k]
  ------------------
  535|  6.68k|        return;
  536|  6.68k|    }
  537|       |
  538|  3.50k|    for (auto const& page: QPDFPageDocumentHelper(qpdf).getAllPages()) {
  ------------------
  |  Branch (538:26): [True: 3.50k, False: 3.06k]
  ------------------
  539|  12.0k|        for (auto& aoh: getWidgetAnnotationsForPage(page)) {
  ------------------
  |  Branch (539:23): [True: 12.0k, False: 3.50k]
  ------------------
  540|  12.0k|            QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh);
  541|  12.0k|            if (ffh.getFieldType() == "/Btn") {
  ------------------
  |  Branch (541:17): [True: 681, False: 11.3k]
  ------------------
  542|       |                // Rather than generating appearances for button fields, rely on what's already
  543|       |                // there. Just make sure /AS is consistent with /V, which we can do by resetting the
  544|       |                // value of the field back to itself. This code is referenced in a comment in
  545|       |                // QPDFFormFieldObjectHelper::generateAppearance.
  546|    681|                if (ffh.isRadioButton() || ffh.isCheckbox()) {
  ------------------
  |  Branch (546:21): [True: 341, False: 340]
  |  Branch (546:44): [True: 329, False: 11]
  ------------------
  547|    670|                    ffh.setV(ffh.getValue());
  548|    670|                }
  549|  11.3k|            } else {
  550|  11.3k|                ffh.generateAppearance(aoh);
  551|  11.3k|            }
  552|  12.0k|        }
  553|  3.50k|    }
  554|  3.06k|    setNeedAppearances(false);
  555|  3.06k|}

_ZN26QPDFAnnotationObjectHelperC2E16QPDFObjectHandle:
   11|  85.6k|    QPDFObjectHelper(oh)
   12|  85.6k|{
   13|  85.6k|}
_ZN26QPDFAnnotationObjectHelper10getSubtypeEv:
   17|  17.3k|{
   18|  17.3k|    return oh().getKey("/Subtype").getName();
   19|  17.3k|}
_ZN26QPDFAnnotationObjectHelper7getRectEv:
   23|  4.39k|{
   24|  4.39k|    return oh().getKey("/Rect").getArrayAsRectangle();
   25|  4.39k|}
_ZN26QPDFAnnotationObjectHelper23getAppearanceDictionaryEv:
   29|  55.7k|{
   30|  55.7k|    return oh().getKey("/AP");
   31|  55.7k|}
_ZN26QPDFAnnotationObjectHelper18getAppearanceStateEv:
   35|  48.5k|{
   36|  48.5k|    Name AS = get("/AS");
   37|  48.5k|    return AS ? AS.value() : "";
  ------------------
  |  Branch (37:12): [True: 1.35k, False: 47.2k]
  ------------------
   38|  48.5k|}
_ZN26QPDFAnnotationObjectHelper8getFlagsEv:
   42|  10.5k|{
   43|  10.5k|    Integer flags_obj = get("/F");
   44|  10.5k|    return flags_obj ? flags_obj : 0;
  ------------------
  |  Branch (44:12): [True: 8.20k, False: 2.33k]
  ------------------
   45|  10.5k|}
_ZN26QPDFAnnotationObjectHelper19getAppearanceStreamERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
   49|  48.5k|{
   50|  48.5k|    QPDFObjectHandle ap = getAppearanceDictionary();
   51|  48.5k|    std::string desired_state = state.empty() ? getAppearanceState() : state;
  ------------------
  |  Branch (51:33): [True: 48.5k, False: 0]
  ------------------
   52|  48.5k|    if (ap.isDictionary()) {
  ------------------
  |  Branch (52:9): [True: 40.3k, False: 8.18k]
  ------------------
   53|  40.3k|        QPDFObjectHandle ap_sub = ap.getKey(which);
   54|  40.3k|        if (ap_sub.isStream()) {
  ------------------
  |  Branch (54:13): [True: 36.9k, False: 3.44k]
  ------------------
   55|       |            // According to the spec, Appearance State is supposed to refer to a subkey of the
   56|       |            // appearance stream when /AP is a dictionary, but files have been seen in the wild
   57|       |            // where Appearance State is `/N` and `/AP` is a stream. Therefore, if `which` points to
   58|       |            // a stream, disregard state and just use the stream. See qpdf issue #949 for details.
   59|  36.9k|            return ap_sub;
   60|  36.9k|        }
   61|  3.44k|        if (ap_sub.isDictionary() && !desired_state.empty()) {
  ------------------
  |  Branch (61:13): [True: 1.34k, False: 2.10k]
  |  Branch (61:38): [True: 1.05k, False: 283]
  ------------------
   62|  1.05k|            QPDFObjectHandle ap_sub_val = ap_sub.getKey(desired_state);
   63|  1.05k|            if (ap_sub_val.isStream()) {
  ------------------
  |  Branch (63:17): [True: 423, False: 636]
  ------------------
   64|    423|                return ap_sub_val;
   65|    423|            }
   66|  1.05k|        }
   67|  3.44k|    }
   68|  11.2k|    return Null::temp();
   69|  48.5k|}
_ZN26QPDFAnnotationObjectHelper27getPageContentForAppearanceERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiii:
   74|  10.5k|{
   75|  10.5k|    if (!getAppearanceStream("/N").isStream()) {
  ------------------
  |  Branch (75:9): [True: 0, False: 10.5k]
  ------------------
   76|      0|        return "";
   77|      0|    }
   78|       |
   79|       |    // The appearance matrix computed by this method is the transformation matrix that needs to be
   80|       |    // in effect when drawing this annotation's appearance stream on the page. The algorithm for
   81|       |    // computing the appearance matrix described in section 12.5.5 of the ISO-32000 PDF spec is
   82|       |    // similar but not identical to what we are doing here.
   83|       |
   84|       |    // When rendering an appearance stream associated with an annotation, there are four relevant
   85|       |    // components:
   86|       |    //
   87|       |    // * The appearance stream's bounding box (/BBox)
   88|       |    // * The appearance stream's matrix (/Matrix)
   89|       |    // * The annotation's rectangle (/Rect)
   90|       |    // * In the case of form fields with the NoRotate flag, the page's rotation
   91|       |
   92|       |    // When rendering a form xobject in isolation, just drawn with a /Do operator, there is no form
   93|       |    // field, so page rotation is not relevant, and there is no annotation, so /Rect is not
   94|       |    // relevant, so only /BBox and /Matrix are relevant. The effect of these are as follows:
   95|       |
   96|       |    // * /BBox is treated as a clipping region
   97|       |    // * /Matrix is applied as a transformation prior to rendering the appearance stream.
   98|       |
   99|       |    // There is no relationship between /BBox and /Matrix in this case.
  100|       |
  101|       |    // When rendering a form xobject in the context of an annotation, things are a little different.
  102|       |    // In particular, a matrix is established such that /BBox, when transformed by /Matrix, would
  103|       |    // fit completely inside of /Rect. /BBox is no longer a clipping region. To illustrate the
  104|       |    // difference, consider a /Matrix of [2 0 0 2 0 0], which is scaling by a factor of two along
  105|       |    // both axes. If the appearance stream drew a rectangle equal to /BBox, in the case of the form
  106|       |    // xobject in isolation, this matrix would cause only the lower-left quadrant of the rectangle
  107|       |    // to be visible since the scaling would cause the rest of it to fall outside of the clipping
  108|       |    // region. In the case of the form xobject displayed in the context of an annotation, such a
  109|       |    // matrix would have no effect at all because it would be applied to the bounding box first, and
  110|       |    // then when the resulting enclosing quadrilateral was transformed to fit into /Rect, the effect
  111|       |    // of the scaling would be undone.
  112|       |
  113|       |    // Our job is to create a transformation matrix that compensates for these differences so that
  114|       |    // the appearance stream of an annotation can be drawn as a regular form xobject.
  115|       |
  116|       |    // To do this, we perform the following steps, which overlap significantly with the algorithm
  117|       |    // in 12.5.5:
  118|       |
  119|       |    // 1. Transform the four corners of /BBox by applying /Matrix to them, creating an arbitrarily
  120|       |    //    transformed quadrilateral.
  121|       |
  122|       |    // 2. Find the minimum upright rectangle that encompasses the resulting quadrilateral. This is
  123|       |    //    the "transformed appearance box", T.
  124|       |
  125|       |    // 3. Compute matrix A that maps the lower left and upper right corners of T to the annotation's
  126|       |    //    /Rect. This can be done by scaling so that the sizes match and translating so that the
  127|       |    //    scaled T exactly overlaps /Rect.
  128|       |
  129|       |    // If the annotation's /F flag has bit 4 set, this means that annotation is to be rotated about
  130|       |    // its upper left corner to counteract any rotation of the page so it remains upright. To
  131|       |    // achieve this effect, we do the following extra steps:
  132|       |
  133|       |    // 1. Perform the rotation on /BBox box prior to transforming it with /Matrix (by replacing
  134|       |    //    matrix with concatenation of matrix onto the rotation)
  135|       |
  136|       |    // 2. Rotate the destination rectangle by the specified amount
  137|       |
  138|       |    // 3. Apply the rotation to A as computed above to get the final appearance matrix.
  139|       |
  140|  10.5k|    QPDFObjectHandle rect_obj = oh().getKey("/Rect");
  141|  10.5k|    QPDFObjectHandle as = getAppearanceStream("/N").getDict();
  142|  10.5k|    QPDFObjectHandle bbox_obj = as.getKey("/BBox");
  143|  10.5k|    QPDFObjectHandle matrix_obj = as.getKey("/Matrix");
  144|       |
  145|  10.5k|    int flags = getFlags();
  146|  10.5k|    if (flags & forbidden_flags) {
  ------------------
  |  Branch (146:9): [True: 329, False: 10.2k]
  ------------------
  147|    329|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper forbidden flags");
  148|    329|        return "";
  149|    329|    }
  150|  10.2k|    if ((flags & required_flags) != required_flags) {
  ------------------
  |  Branch (150:9): [True: 0, False: 10.2k]
  ------------------
  151|      0|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper missing required flags");
  152|      0|        return "";
  153|      0|    }
  154|       |
  155|  10.2k|    if (!(bbox_obj.isRectangle() && rect_obj.isRectangle())) {
  ------------------
  |  Branch (155:11): [True: 9.74k, False: 468]
  |  Branch (155:37): [True: 6.64k, False: 3.09k]
  ------------------
  156|  3.56k|        return "";
  157|  3.56k|    }
  158|  6.64k|    QPDFMatrix matrix;
  159|  6.64k|    if (matrix_obj.isMatrix()) {
  ------------------
  |  Branch (159:9): [True: 459, False: 6.18k]
  ------------------
  160|    459|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper explicit matrix");
  161|    459|        matrix = QPDFMatrix(matrix_obj.getArrayAsMatrix());
  162|  6.18k|    } else {
  163|  6.18k|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper default matrix");
  164|  6.18k|    }
  165|  6.64k|    QPDFObjectHandle::Rectangle rect = rect_obj.getArrayAsRectangle();
  166|  6.64k|    bool do_rotate = (rotate && (flags & an_no_rotate));
  ------------------
  |  Branch (166:23): [True: 189, False: 6.45k]
  |  Branch (166:33): [True: 105, False: 84]
  ------------------
  167|  6.64k|    if (do_rotate) {
  ------------------
  |  Branch (167:9): [True: 105, False: 6.54k]
  ------------------
  168|       |        // If the annotation flags include the NoRotate bit and the page is rotated, we have to
  169|       |        // rotate the annotation about its upper left corner by the same amount in the opposite
  170|       |        // direction so that it will remain upright in absolute coordinates. Since the semantics of
  171|       |        // /Rotate for a page are to rotate the page, while the effect of rotating using a
  172|       |        // transformation matrix is to rotate the coordinate system, the opposite directionality is
  173|       |        // explicit in the code.
  174|    105|        QPDFMatrix mr;
  175|    105|        mr.rotatex90(rotate);
  176|    105|        mr.concat(matrix);
  177|    105|        matrix = mr;
  178|    105|        double rect_w = rect.urx - rect.llx;
  179|    105|        double rect_h = rect.ury - rect.lly;
  180|    105|        switch (rotate) {
  181|      8|        case 90:
  ------------------
  |  Branch (181:9): [True: 8, False: 97]
  ------------------
  182|      8|            QTC::TC("qpdf", "QPDFAnnotationObjectHelper rotate 90");
  183|      8|            rect = QPDFObjectHandle::Rectangle(
  184|      8|                rect.llx, rect.ury, rect.llx + rect_h, rect.ury + rect_w);
  185|      8|            break;
  186|     11|        case 180:
  ------------------
  |  Branch (186:9): [True: 11, False: 94]
  ------------------
  187|     11|            QTC::TC("qpdf", "QPDFAnnotationObjectHelper rotate 180");
  188|     11|            rect = QPDFObjectHandle::Rectangle(
  189|     11|                rect.llx - rect_w, rect.ury, rect.llx, rect.ury + rect_h);
  190|     11|            break;
  191|     66|        case 270:
  ------------------
  |  Branch (191:9): [True: 66, False: 39]
  ------------------
  192|     66|            QTC::TC("qpdf", "QPDFAnnotationObjectHelper rotate 270");
  193|     66|            rect = QPDFObjectHandle::Rectangle(
  194|     66|                rect.llx - rect_h, rect.ury - rect_w, rect.llx, rect.ury);
  195|     66|            break;
  196|     20|        default:
  ------------------
  |  Branch (196:9): [True: 20, False: 85]
  ------------------
  197|       |            // ignore
  198|     20|            break;
  199|    105|        }
  200|    105|    }
  201|       |
  202|       |    // Transform bounding box by matrix to get T
  203|  6.64k|    QPDFObjectHandle::Rectangle bbox = bbox_obj.getArrayAsRectangle();
  204|  6.64k|    QPDFObjectHandle::Rectangle T = matrix.transformRectangle(bbox);
  205|  6.64k|    if ((T.urx == T.llx) || (T.ury == T.lly)) {
  ------------------
  |  Branch (205:9): [True: 17, False: 6.63k]
  |  Branch (205:29): [True: 74, False: 6.55k]
  ------------------
  206|       |        // avoid division by zero
  207|     90|        return "";
  208|     90|    }
  209|       |    // Compute a matrix to transform the appearance box to the rectangle
  210|  6.55k|    QPDFMatrix AA;
  211|  6.55k|    AA.translate(rect.llx, rect.lly);
  212|  6.55k|    AA.scale((rect.urx - rect.llx) / (T.urx - T.llx), (rect.ury - rect.lly) / (T.ury - T.lly));
  213|  6.55k|    AA.translate(-T.llx, -T.lly);
  214|  6.55k|    if (do_rotate) {
  ------------------
  |  Branch (214:9): [True: 90, False: 6.46k]
  ------------------
  215|     90|        AA.rotatex90(rotate);
  216|     90|    }
  217|       |
  218|  6.55k|    as.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
  219|  6.55k|    return ("q\n" + AA.unparse() + " cm\n" + name + " Do\n" + "Q\n");
  220|  6.64k|}

_ZN18QPDFCryptoProvider7getImplEv:
   19|   484k|{
   20|   484k|    QPDFCryptoProvider& p = getInstance();
   21|   484k|    if (p.m->default_provider.empty()) {
  ------------------
  |  Branch (21:9): [True: 0, False: 484k]
  ------------------
   22|      0|        throw std::logic_error("QPDFCryptoProvider::getImpl called with no default provider.");
   23|      0|    }
   24|   484k|    return p.getImpl_internal(p.m->default_provider);
   25|   484k|}
_ZN18QPDFCryptoProviderC2Ev:
   46|      1|    m(std::make_shared<Members>())
   47|      1|{
   48|      1|#ifdef USE_CRYPTO_NATIVE
   49|      1|    registerImpl_internal("native", std::make_shared<QPDFCrypto_native>);
   50|      1|#endif
   51|       |#ifdef USE_CRYPTO_GNUTLS
   52|       |    registerImpl_internal("gnutls", std::make_shared<QPDFCrypto_gnutls>);
   53|       |#endif
   54|       |#ifdef USE_CRYPTO_OPENSSL
   55|       |    registerImpl_internal("openssl", std::make_shared<QPDFCrypto_openssl>);
   56|       |#endif
   57|      1|    std::string default_crypto;
   58|      1|    if (!QUtil::get_env("QPDF_CRYPTO_PROVIDER", &default_crypto)) {
  ------------------
  |  Branch (58:9): [True: 1, False: 0]
  ------------------
   59|      1|        default_crypto = DEFAULT_CRYPTO;
  ------------------
  |  |    3|      1|#define DEFAULT_CRYPTO "native"
  ------------------
   60|      1|    }
   61|      1|    setDefaultProvider_internal(default_crypto);
   62|      1|}
_ZN18QPDFCryptoProvider11getInstanceEv:
   66|   484k|{
   67|   484k|    static QPDFCryptoProvider instance;
   68|   484k|    return instance;
   69|   484k|}
_ZNK18QPDFCryptoProvider16getImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   73|   484k|{
   74|   484k|    auto iter = m->providers.find(name);
   75|   484k|    if (iter == m->providers.end()) {
  ------------------
  |  Branch (75:9): [True: 0, False: 484k]
  ------------------
   76|      0|        throw std::logic_error(
   77|      0|            "QPDFCryptoProvider requested unknown implementation \"" + name + "\"");
   78|      0|    }
   79|   484k|    return m->providers[name]();
   80|   484k|}
_ZN18QPDFCryptoProvider21registerImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS0_8functionIFNS0_10shared_ptrI14QPDFCryptoImplEEvEEE:
   84|      1|{
   85|      1|    m->providers[name] = std::move(f);
   86|      1|}
_ZN18QPDFCryptoProvider27setDefaultProvider_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   90|      1|{
   91|      1|    if (!m->providers.contains(name)) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1]
  ------------------
   92|      0|        throw std::logic_error(
   93|      0|            "QPDFCryptoProvider: request to set default provider to unknown implementation \"" +
   94|      0|            name + "\"");
   95|      0|    }
   96|      1|    m->default_provider = name;
   97|      1|}

_ZN17QPDFCrypto_native17provideRandomDataEPhm:
   36|    490|{
   37|    490|    getRandomProvider()->provideRandomData(data, len);
   38|    490|}
_ZN17QPDFCrypto_native8MD5_initEv:
   42|  83.1k|{
   43|  83.1k|    md5 = std::make_shared<MD5_native>();
   44|  83.1k|}
_ZN17QPDFCrypto_native10MD5_updateEPKhm:
   48|  87.6k|{
   49|  87.6k|    md5->update(const_cast<unsigned char*>(data), len);
   50|  87.6k|}
_ZN17QPDFCrypto_native12MD5_finalizeEv:
   54|  83.1k|{
   55|  83.1k|    md5->finalize();
   56|  83.1k|}
_ZN17QPDFCrypto_native10MD5_digestEPh:
   60|  83.1k|{
   61|  83.1k|    md5->digest(d);
   62|  83.1k|}
_ZN17QPDFCrypto_native8RC4_initEPKhi:
   66|  32.2k|{
   67|  32.2k|    rc4 = std::make_shared<RC4_native>(key_data, key_len);
   68|  32.2k|}
_ZN17QPDFCrypto_native11RC4_processEPKhmPh:
   72|  31.8k|{
   73|  31.8k|    rc4->process(in_data, len, out_data);
   74|  31.8k|}
_ZN17QPDFCrypto_native9SHA2_initEi:
   83|   181k|{
   84|   181k|    sha2 = std::make_shared<SHA2_native>(bits);
   85|   181k|}
_ZN17QPDFCrypto_native11SHA2_updateEPKhm:
   89|   183k|{
   90|   183k|    sha2->update(data, len);
   91|   183k|}
_ZN17QPDFCrypto_native13SHA2_finalizeEv:
   95|   181k|{
   96|   181k|    sha2->finalize();
   97|   181k|}
_ZN17QPDFCrypto_native11SHA2_digestEv:
  101|   181k|{
  102|   181k|    return sha2->getRawDigest();
  103|   181k|}
_ZN17QPDFCrypto_native13rijndael_initEbPKhmbPh:
  113|   187k|{
  114|   187k|    aes_pdf = std::make_shared<AES_PDF_native>(encrypt, key_data, key_len, cbc_mode, cbc_block);
  115|   187k|}
_ZN17QPDFCrypto_native16rijndael_processEPhS0_:
  119|  51.9M|{
  120|  51.9M|    aes_pdf->update(in_data, out_data);
  121|  51.9M|}
_ZN17QPDFCrypto_native17rijndael_finalizeEv:
  125|   186k|{
  126|   186k|}
QPDFCrypto_native.cc:_ZL17getRandomProviderv:
   12|    490|{
   13|       |#ifdef USE_INSECURE_RANDOM
   14|       |    static RandomDataProvider* insecure_random_data_provider =
   15|       |        InsecureRandomDataProvider::getInstance();
   16|       |#else
   17|    490|    static RandomDataProvider* insecure_random_data_provider = nullptr;
   18|    490|#endif
   19|    490|    static RandomDataProvider* secure_random_data_provider =
   20|    490|        SecureRandomDataProvider::getInstance();
   21|       |
   22|    490|    static RandomDataProvider* provider =
   23|    490|        (secure_random_data_provider         ? secure_random_data_provider
  ------------------
  |  Branch (23:10): [True: 1, False: 489]
  ------------------
   24|    490|             : insecure_random_data_provider ? insecure_random_data_provider
  ------------------
  |  Branch (24:16): [True: 0, False: 489]
  ------------------
   25|    489|                                             : nullptr);
   26|       |
   27|    490|    if (provider == nullptr) {
  ------------------
  |  Branch (27:9): [True: 0, False: 490]
  ------------------
   28|      0|        throw std::logic_error("QPDFCrypto_native has no random data provider");
   29|      0|    }
   30|       |
   31|    490|    return provider;
   32|    490|}

_ZN18QPDFDocumentHelperD2Ev:
    4|  51.3k|{
    5|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
    6|  51.3k|}

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   735k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 505k, False: 229k]
  ------------------
   10|   735k|    error_code(error_code),
   11|   735k|    filename(filename),
   12|   735k|    object(object),
   13|   735k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 505k, False: 229k]
  ------------------
   14|   735k|    message(message)
   15|   735k|{
   16|   735k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   358k|    std::runtime_error(
   26|   358k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 358k, False: 79]
  |  Branch (26:49): [True: 79, False: 0]
  ------------------
   27|   358k|    error_code(error_code),
   28|   358k|    filename(filename),
   29|   358k|    object(object),
   30|   358k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 358k, False: 79]
  |  Branch (30:22): [True: 79, False: 0]
  ------------------
   31|   358k|    message(message)
   32|   358k|{
   33|   358k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|  1.09M|{
   42|  1.09M|    std::string result;
   43|  1.09M|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 877k, False: 216k]
  ------------------
   44|   877k|        result += filename;
   45|   877k|    }
   46|  1.09M|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 173k, False: 920k]
  |  Branch (46:29): [True: 128k, False: 45.5k]
  ------------------
   47|   966k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 749k, False: 216k]
  ------------------
   48|   749k|            result += " (";
   49|   749k|        }
   50|   966k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 920k, False: 45.5k]
  ------------------
   51|   920k|            result += object;
   52|   920k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 691k, False: 229k]
  ------------------
   53|   691k|                result += ", ";
   54|   691k|            }
   55|   920k|        }
   56|   966k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 736k, False: 229k]
  ------------------
   57|   736k|            result += "offset " + std::to_string(offset);
   58|   736k|        }
   59|   966k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 749k, False: 216k]
  ------------------
   60|   749k|            result += ")";
   61|   749k|        }
   62|   966k|    }
   63|  1.09M|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 1.09M, False: 153]
  ------------------
   64|  1.09M|        result += ": ";
   65|  1.09M|    }
   66|  1.09M|    result += message;
   67|  1.09M|    return result;
   68|  1.09M|}

_ZN25QPDFFormFieldObjectHelperC2E16QPDFObjectHandle:
   34|  27.9k|    QPDFObjectHelper(o),
   35|  27.9k|    m(std::make_shared<Members>(oh()))
   36|  27.9k|{
   37|  27.9k|}
_ZN25QPDFFormFieldObjectHelperC2Ev:
   40|  26.1k|    QPDFObjectHelper(Null::temp()),
   41|  26.1k|    m(std::make_shared<Members>(QPDFObjectHandle()))
   42|  26.1k|{
   43|  26.1k|}
_ZNK4qpdf4impl8FormNode9inheritedERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
   92|  20.8k|{
   93|  20.8k|    if (!obj) {
  ------------------
  |  Branch (93:9): [True: 694, False: 20.1k]
  ------------------
   94|    694|        return null_oh;
   95|    694|    }
   96|  20.1k|    auto node = *this;
   97|  20.1k|    QPDFObjGen::set seen;
   98|  20.1k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
   99|  33.9k|    while (node.Parent() && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (99:12): [True: 16.4k, False: 17.4k]
  |  Branch (99:12): [True: 15.7k, False: 18.2k]
  |  Branch (99:30): [True: 13.1k, False: 3.34k]
  |  Branch (99:46): [True: 2.56k, False: 788]
  ------------------
  100|  15.7k|        node = node.Parent();
  101|  15.7k|        if (auto const& result = node[name]) {
  ------------------
  |  Branch (101:25): [True: 1.93k, False: 13.7k]
  ------------------
  102|  1.93k|            return {result};
  103|  1.93k|        }
  104|  15.7k|    }
  105|  18.2k|    return acroform ? from_AcroForm(name) : null_oh;
  ------------------
  |  Branch (105:12): [True: 0, False: 18.2k]
  ------------------
  106|  20.1k|}
_ZNK4qpdf4impl8FormNode18inheritable_stringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  116|  9.29k|{
  117|  9.29k|    if (auto fv = inheritable_value<String>(name)) {
  ------------------
  |  Branch (117:14): [True: 1.05k, False: 8.24k]
  ------------------
  118|  1.05k|        return fv.utf8_value();
  119|  1.05k|    }
  120|  8.24k|    return {};
  121|  9.29k|}
_ZN25QPDFFormFieldObjectHelper12getFieldTypeEv:
  134|  12.0k|{
  135|  12.0k|    if (auto ft = m->FT()) {
  ------------------
  |  Branch (135:14): [True: 10.9k, False: 1.05k]
  ------------------
  136|  10.9k|        return ft;
  137|  10.9k|    }
  138|  1.05k|    return {};
  139|  12.0k|}
_ZNK4qpdf4impl8FormNode20fully_qualified_nameEv:
  149|  9.16k|{
  150|  9.16k|    std::string result;
  151|  9.16k|    auto node = *this;
  152|  9.16k|    QPDFObjGen::set seen;
  153|  9.16k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
  154|  47.3k|    while (node && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (154:12): [True: 39.9k, False: 7.47k]
  |  Branch (154:21): [True: 33.3k, False: 6.59k]
  |  Branch (154:37): [True: 4.91k, False: 1.68k]
  ------------------
  155|  38.2k|        if (auto T = node.T()) {
  ------------------
  |  Branch (155:18): [True: 35.4k, False: 2.78k]
  ------------------
  156|  35.4k|            if (!result.empty()) {
  ------------------
  |  Branch (156:17): [True: 26.2k, False: 9.22k]
  ------------------
  157|  26.2k|                result.insert(0, 1, '.');
  158|  26.2k|            }
  159|  35.4k|            result.insert(0, T.utf8_value());
  160|  35.4k|        }
  161|  38.2k|        node = node.Parent();
  162|  38.2k|    }
  163|  9.16k|    return result;
  164|  9.16k|}
_ZN25QPDFFormFieldObjectHelper8getValueEv:
  213|    670|{
  214|    670|    return Null::if_null(m->V<QPDFObjectHandle>());
  215|    670|}
_ZNK4qpdf4impl8FormNode5valueEv:
  225|  9.29k|{
  226|  9.29k|    return inheritable_string("/V");
  227|  9.29k|}
_ZN25QPDFFormFieldObjectHelper19getDefaultResourcesEv:
  249|  9.29k|{
  250|  9.29k|    return Null::if_null(m->getDefaultResources());
  251|  9.29k|}
_ZN4qpdf4impl8FormNode19getDefaultResourcesEv:
  255|  15.1k|{
  256|  15.1k|    return from_AcroForm("/DR");
  257|  15.1k|}
_ZNK4qpdf4impl8FormNode18default_appearanceEv:
  267|  9.29k|{
  268|  9.29k|    if (auto DA = inheritable_value<String>("/DA")) {
  ------------------
  |  Branch (268:14): [True: 7.40k, False: 1.89k]
  ------------------
  269|  7.40k|        return DA.utf8_value();
  270|  7.40k|    }
  271|  1.89k|    if (String DA = from_AcroForm("/DA")) {
  ------------------
  |  Branch (271:16): [True: 19, False: 1.87k]
  ------------------
  272|     19|        return DA.utf8_value();
  273|     19|    }
  274|  1.87k|    return {};
  275|  1.89k|}
_ZN4qpdf4impl8FormNode8getFlagsEv:
  307|  4.92k|{
  308|  4.92k|    auto f = inheritable_value<QPDFObjectHandle>("/Ff");
  309|  4.92k|    return f.isInteger() ? f.getIntValueAsInt() : 0;
  ------------------
  |  Branch (309:12): [True: 1.83k, False: 3.08k]
  ------------------
  310|  4.92k|}
_ZN25QPDFFormFieldObjectHelper10isCheckboxEv:
  326|    340|{
  327|    340|    return m->isCheckbox();
  328|    340|}
_ZN4qpdf4impl8FormNode10isCheckboxEv:
  332|  1.01k|{
  333|  1.01k|    return FT() == "/Btn" && (getFlags() & (ff_btn_radio | ff_btn_pushbutton)) == 0;
  ------------------
  |  Branch (333:12): [True: 1.01k, False: 0]
  |  Branch (333:30): [True: 658, False: 352]
  ------------------
  334|  1.01k|}
_ZN25QPDFFormFieldObjectHelper13isRadioButtonEv:
  350|    681|{
  351|    681|    return m->isRadioButton();
  352|    681|}
_ZN4qpdf4impl8FormNode13isRadioButtonEv:
  356|  1.33k|{
  357|  1.33k|    return FT() == "/Btn" && (getFlags() & ff_btn_radio) == ff_btn_radio;
  ------------------
  |  Branch (357:12): [True: 1.30k, False: 25]
  |  Branch (357:30): [True: 965, False: 340]
  ------------------
  358|  1.33k|}
_ZN4qpdf4impl8FormNode8isChoiceEv:
  380|  11.6k|{
  381|  11.6k|    return FT() == "/Ch";
  382|  11.6k|}
_ZN4qpdf4impl8FormNode10getChoicesEv:
  392|  2.34k|{
  393|  2.34k|    if (!isChoice()) {
  ------------------
  |  Branch (393:9): [True: 0, False: 2.34k]
  ------------------
  394|      0|        return {};
  395|      0|    }
  396|  2.34k|    std::vector<std::string> result;
  397|  29.4k|    for (auto const& item: inheritable_value<Array>("/Opt")) {
  ------------------
  |  Branch (397:26): [True: 29.4k, False: 2.34k]
  ------------------
  398|  29.4k|        if (item.isString()) {
  ------------------
  |  Branch (398:13): [True: 19.0k, False: 10.3k]
  ------------------
  399|  19.0k|            result.emplace_back(item.getUTF8Value());
  400|  19.0k|        } else if (item.size() == 2) {
  ------------------
  |  Branch (400:20): [True: 198, False: 10.1k]
  ------------------
  401|    198|            auto display = item.getArrayItem(1);
  402|    198|            if (display.isString()) {
  ------------------
  |  Branch (402:17): [True: 126, False: 72]
  ------------------
  403|    126|                result.emplace_back(display.getUTF8Value());
  404|    126|            }
  405|    198|        }
  406|  29.4k|    }
  407|  2.34k|    return result;
  408|  2.34k|}
_ZN4qpdf4impl8FormNode17setFieldAttributeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKNS_4NameE:
  424|    254|{
  425|    254|    replace(key, value);
  426|    254|}
_ZN25QPDFFormFieldObjectHelper4setVE16QPDFObjectHandleb:
  442|    670|{
  443|    670|    m->setV(value, need_appearances);
  444|    670|}
_ZN4qpdf4impl8FormNode4setVE16QPDFObjectHandleb:
  448|    670|{
  449|    670|    if (FT() == "/Btn") {
  ------------------
  |  Branch (449:9): [True: 670, False: 0]
  ------------------
  450|    670|        Name name = value;
  451|    670|        if (isCheckbox()) {
  ------------------
  |  Branch (451:13): [True: 329, False: 341]
  ------------------
  452|    329|            if (!name) {
  ------------------
  |  Branch (452:17): [True: 75, False: 254]
  ------------------
  453|     75|                warn("ignoring attempt to set a checkbox field to a value whose type is not name");
  454|     75|                return;
  455|     75|            }
  456|       |            // Accept any value other than /Off to mean checked. Files have been seen that use
  457|       |            // /1 or other values.
  458|    254|            setCheckBoxValue(name != "/Off");
  459|    254|            return;
  460|    329|        }
  461|    341|        if (isRadioButton()) {
  ------------------
  |  Branch (461:13): [True: 341, False: 0]
  ------------------
  462|    341|            if (!name) {
  ------------------
  |  Branch (462:17): [True: 33, False: 308]
  ------------------
  463|     33|                warn(
  464|     33|                    "ignoring attempt to set a radio button field to an object that is not a name");
  465|     33|                return;
  466|     33|            }
  467|    308|            setRadioButtonValue(name);
  468|    308|            return;
  469|    341|        }
  470|      0|        if (isPushbutton()) {
  ------------------
  |  Branch (470:13): [True: 0, False: 0]
  ------------------
  471|      0|            warn("ignoring attempt set the value of a pushbutton field");
  472|      0|        }
  473|      0|        return;
  474|    341|    }
  475|      0|    if (value.isString()) {
  ------------------
  |  Branch (475:9): [True: 0, False: 0]
  ------------------
  476|      0|        setFieldAttribute("/V", QPDFObjectHandle::newUnicodeString(value.getUTF8Value()));
  477|      0|    } else {
  478|      0|        setFieldAttribute("/V", value);
  479|      0|    }
  480|      0|    if (need_appearances) {
  ------------------
  |  Branch (480:9): [True: 0, False: 0]
  ------------------
  481|      0|        QPDF& qpdf = oh().getQPDF(
  482|      0|            "QPDFFormFieldObjectHelper::setV called with need_appearances = "
  483|      0|            "true on an object that is not associated with an owning QPDF");
  484|      0|        qpdf.doc().acroform().setNeedAppearances(true);
  485|      0|    }
  486|      0|}
_ZN4qpdf4impl8FormNode19setRadioButtonValueERKNS_4NameE:
  502|    427|{
  503|    427|    qpdf_expect(name);
  ------------------
  |  |   13|    427|#define qpdf_expect assert
  ------------------
  |  Branch (503:5): [True: 427, False: 0]
  ------------------
  504|       |    // Set the value of a radio button field. This has the following specific behavior:
  505|       |    // * If this is a node without /Kids, assume this is a individual radio button widget and call
  506|       |    // itself on the parent
  507|       |    // * If this is a radio button field with children, set /V to the given value. Then, for each
  508|       |    //   child, if the child has the specified value as one of its keys in the /N subdictionary of
  509|       |    //   its /AP (i.e. its normal appearance stream dictionary), set /AS to name; otherwise, if /Off
  510|       |    //   is a member, set /AS to /Off.
  511|    427|    auto kids = Kids();
  512|    427|    if (!kids) {
  ------------------
  |  Branch (512:9): [True: 191, False: 236]
  ------------------
  513|       |        // This is most likely one of the individual buttons. Try calling on the parent.
  514|    191|        auto parent = Parent();
  515|    191|        if (parent.Kids()) {
  ------------------
  |  Branch (515:13): [True: 119, False: 72]
  ------------------
  516|    119|            parent.setRadioButtonValue(name);
  517|    119|            return;
  518|    119|        }
  519|    191|    }
  520|    308|    if (!isRadioButton() || !kids) {
  ------------------
  |  Branch (520:9): [True: 25, False: 283]
  |  Branch (520:29): [True: 72, False: 211]
  ------------------
  521|     97|        warn("don't know how to set the value of this field as a radio button");
  522|     97|        return;
  523|     97|    }
  524|    211|    replace("/V", name);
  525|  4.78k|    for (FormNode kid: kids) {
  ------------------
  |  Branch (525:22): [True: 4.78k, False: 211]
  ------------------
  526|  4.78k|        auto ap = kid.AP();
  527|  4.78k|        QPDFObjectHandle annot;
  528|  4.78k|        if (!ap) {
  ------------------
  |  Branch (528:13): [True: 4.54k, False: 239]
  ------------------
  529|       |            // The widget may be below. If there is more than one, just find the first one.
  530|  28.9k|            for (FormNode grandkid: kid.Kids()) {
  ------------------
  |  Branch (530:35): [True: 28.9k, False: 4.24k]
  ------------------
  531|  28.9k|                ap = grandkid.AP();
  532|  28.9k|                if (ap) {
  ------------------
  |  Branch (532:21): [True: 302, False: 28.6k]
  ------------------
  533|    302|                    annot = grandkid;
  534|    302|                    break;
  535|    302|                }
  536|  28.9k|            }
  537|  4.54k|        } else {
  538|    239|            annot = kid;
  539|    239|        }
  540|  4.78k|        if (!annot) {
  ------------------
  |  Branch (540:13): [True: 4.24k, False: 541]
  ------------------
  541|  4.24k|            warn("unable to set the value of this radio button");
  542|  4.24k|            continue;
  543|  4.24k|        }
  544|    541|        if (ap["/N"].contains(name.value())) {
  ------------------
  |  Branch (544:13): [True: 96, False: 445]
  ------------------
  545|     96|            annot.replace("/AS", name);
  546|    445|        } else {
  547|    445|            annot.replace("/AS", Name("/Off"));
  548|    445|        }
  549|    541|    }
  550|    211|}
_ZN4qpdf4impl8FormNode16setCheckBoxValueEb:
  554|    254|{
  555|    254|    auto ap = AP();
  556|    254|    QPDFObjectHandle annot;
  557|    254|    if (ap) {
  ------------------
  |  Branch (557:9): [True: 149, False: 105]
  ------------------
  558|    149|        annot = oh();
  559|    149|    } else {
  560|       |        // The widget may be below. If there is more than one, just find the first one.
  561|  1.17k|        for (FormNode kid: Kids()) {
  ------------------
  |  Branch (561:26): [True: 1.17k, False: 83]
  ------------------
  562|  1.17k|            ap = kid.AP();
  563|  1.17k|            if (ap) {
  ------------------
  |  Branch (563:17): [True: 22, False: 1.14k]
  ------------------
  564|     22|                annot = kid;
  565|     22|                break;
  566|     22|            }
  567|  1.17k|        }
  568|    105|    }
  569|    254|    std::string on_value;
  570|    254|    if (value) {
  ------------------
  |  Branch (570:9): [True: 198, False: 56]
  ------------------
  571|       |        // Set the "on" value to the first value in the appearance stream's normal state dictionary
  572|       |        // that isn't /Off. If not found, fall back to /Yes.
  573|    198|        if (ap) {
  ------------------
  |  Branch (573:13): [True: 134, False: 64]
  ------------------
  574|    173|            for (auto const& item: Dictionary(ap["/N"])) {
  ------------------
  |  Branch (574:34): [True: 173, False: 35]
  ------------------
  575|    173|                if (item.first != "/Off") {
  ------------------
  |  Branch (575:21): [True: 99, False: 74]
  ------------------
  576|     99|                    on_value = item.first;
  577|     99|                    break;
  578|     99|                }
  579|    173|            }
  580|    134|        }
  581|    198|        if (on_value.empty()) {
  ------------------
  |  Branch (581:13): [True: 99, False: 99]
  ------------------
  582|     99|            on_value = "/Yes";
  583|     99|        }
  584|    198|    }
  585|       |
  586|       |    // Set /AS to the on value or /Off in addition to setting /V.
  587|    254|    auto name = Name(value ? on_value : "/Off");
  ------------------
  |  Branch (587:22): [True: 198, False: 56]
  ------------------
  588|    254|    setFieldAttribute("/V", name);
  589|    254|    if (!annot) {
  ------------------
  |  Branch (589:9): [True: 83, False: 171]
  ------------------
  590|     83|        warn("unable to set the value of this checkbox");
  591|     83|        return;
  592|     83|    }
  593|    171|    annot.replace("/AS", name);
  594|    171|}
_ZN25QPDFFormFieldObjectHelper18generateAppearanceER26QPDFAnnotationObjectHelper:
  598|  11.3k|{
  599|  11.3k|    m->generateAppearance(aoh);
  600|  11.3k|}
_ZN4qpdf4impl8FormNode18generateAppearanceER26QPDFAnnotationObjectHelper:
  604|  11.3k|{
  605|       |    // Ignore field types we don't know how to generate appearances for. Button fields don't really
  606|       |    // need them -- see code in QPDFAcroFormDocumentHelper::generateAppearancesIfNeeded.
  607|  11.3k|    auto ft = FT();
  608|  11.3k|    if (ft == "/Tx" || ft == "/Ch") {
  ------------------
  |  Branch (608:9): [True: 7.49k, False: 3.83k]
  |  Branch (608:24): [True: 2.63k, False: 1.19k]
  ------------------
  609|  10.1k|        generateTextAppearance(aoh);
  610|  10.1k|    }
  611|  11.3k|}
_ZN4qpdf4impl8FormNode22generateTextAppearanceER26QPDFAnnotationObjectHelper:
  881|  10.1k|{
  882|  10.1k|    no_ci_warn_if(
  883|  10.1k|        !Dictionary(aoh), // There is no guarantee that aoh is a dictionary
  884|  10.1k|        "cannot generate appearance for non-dictionary annotation" //
  885|  10.1k|    );
  886|  10.1k|    Stream AS = aoh.getAppearanceStream("/N"); // getAppearanceStream returns a stream or null.
  887|  10.1k|    if (!AS) {
  ------------------
  |  Branch (887:9): [True: 4.39k, False: 5.73k]
  ------------------
  888|  4.39k|        QPDFObjectHandle::Rectangle rect = aoh.getRect(); // may silently be invalid / all zeros
  889|  4.39k|        QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly);
  890|  4.39k|        auto* pdf = qpdf();
  891|  4.39k|        no_ci_stop_damaged_if(!pdf, "unable to get owning QPDF for appearance generation");
  892|  4.39k|        AS = pdf->newStream("/Tx BMC\nEMC\n");
  893|  4.39k|        AS.replaceDict(Dictionary(
  894|  4.39k|            {{"/BBox", QPDFObjectHandle::newFromRectangle(bbox)},
  895|  4.39k|             {"/Resources", Dictionary({{"/ProcSet", Array({Name("/PDF"), Name("/Text")})}})},
  896|  4.39k|             {"/Type", Name("/XObject")},
  897|  4.39k|             {"/Subtype", Name("/Form")}}));
  898|  4.39k|        if (auto ap = AP()) {
  ------------------
  |  Branch (898:18): [True: 1.46k, False: 2.93k]
  ------------------
  899|  1.46k|            ap.replace("/N", AS);
  900|  2.93k|        } else {
  901|  2.93k|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  902|  2.93k|        }
  903|  4.39k|    }
  904|       |
  905|  10.1k|    if (AS.obj_sp().use_count() > 3) {
  ------------------
  |  Branch (905:9): [True: 802, False: 9.32k]
  ------------------
  906|       |        // Ensures that the appearance stream is not shared by copying it if the threshold of 3 is
  907|       |        // exceeded. The threshold is based on the current implementation details:
  908|       |        // - One reference from the local variable AS
  909|       |        // - One reference from the appearance dictionary (/AP)
  910|       |        // - One reference from the object table
  911|       |        // If use_count() is greater than 3, it means the appearance stream is shared elsewhere,
  912|       |        // and updating it could have unintended side effects. This threshold may need to be updated
  913|       |        // if the internal reference counting changes in the future.
  914|       |        //
  915|       |        // There is currently no explicit CI test for this code. It has been manually tested by
  916|       |        // running it through CI with a threshold of 0, unconditionally copying streams.
  917|    802|        auto data = AS.getStreamData(qpdf_dl_all);
  918|    802|        AS = AS.copy();
  919|    802|        AS.replaceStreamData(std::move(data), Null::temp(), Null::temp());
  920|    802|        if (Dictionary AP = aoh.getAppearanceDictionary()) {
  ------------------
  |  Branch (920:24): [True: 411, False: 391]
  ------------------
  921|    411|            AP.replace("/N", AS);
  922|    411|        } else {
  923|    391|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  924|       |            // aoh is a dictionary, so insertion will succeed. No need to check by retrieving it.
  925|    391|        }
  926|    802|    }
  927|  10.1k|    QPDFObjectHandle bbox_obj = AS.getDict()["/BBox"];
  928|  10.1k|    if (!bbox_obj.isRectangle()) {
  ------------------
  |  Branch (928:9): [True: 440, False: 9.68k]
  ------------------
  929|    440|        aoh.warn("unable to get appearance stream bounding box");
  930|    440|        return;
  931|    440|    }
  932|  9.68k|    QPDFObjectHandle::Rectangle bbox = bbox_obj.getArrayAsRectangle();
  933|  9.68k|    std::string DA = default_appearance();
  934|  9.68k|    std::string V = value();
  935|       |
  936|  9.68k|    TfFinder tff;
  937|  9.68k|    Pl_QPDFTokenizer tok("tf", &tff);
  938|  9.68k|    tok.writeString(DA);
  939|  9.68k|    tok.finish();
  940|  9.68k|    double tf = tff.getTf();
  941|  9.68k|    DA = tff.getDA();
  942|       |
  943|  9.68k|    std::string (*encoder)(std::string const&, char) = &QUtil::utf8_to_ascii;
  944|  9.68k|    std::string font_name = tff.getFontName();
  945|  9.68k|    if (!font_name.empty()) {
  ------------------
  |  Branch (945:9): [True: 5.90k, False: 3.78k]
  ------------------
  946|       |        // See if the font is encoded with something we know about.
  947|  5.90k|        Dictionary resources = AS.getDict()["/Resources"];
  948|  5.90k|        Dictionary font = resources["/Font"][font_name];
  949|  5.90k|        if (!font) {
  ------------------
  |  Branch (949:13): [True: 5.86k, False: 36]
  ------------------
  950|  5.86k|            font = getDefaultResources()["/Font"][font_name];
  951|  5.86k|            if (resources) {
  ------------------
  |  Branch (951:17): [True: 3.49k, False: 2.37k]
  ------------------
  952|  3.49k|                if (resources.indirect()) {
  ------------------
  |  Branch (952:21): [True: 340, False: 3.15k]
  ------------------
  953|    340|                    resources = resources.qpdf()->makeIndirectObject(resources.copy());
  954|    340|                    AS.getDict().replace("/Resources", resources);
  955|    340|                }
  956|       |                // Use mergeResources to force /Font to be local
  957|  3.49k|                QPDFObjectHandle res = resources;
  958|  3.49k|                res.mergeResources(Dictionary({{"/Font", Dictionary::empty()}}));
  959|  3.49k|                res.getKey("/Font").replace(font_name, font);
  960|  3.49k|            }
  961|  5.86k|        }
  962|       |
  963|  5.90k|        if (Name Encoding = font["/Encoding"]) {
  ------------------
  |  Branch (963:18): [True: 177, False: 5.72k]
  ------------------
  964|    177|            if (Encoding == "/WinAnsiEncoding") {
  ------------------
  |  Branch (964:17): [True: 54, False: 123]
  ------------------
  965|     54|                encoder = &QUtil::utf8_to_win_ansi;
  966|    123|            } else if (Encoding == "/MacRomanEncoding") {
  ------------------
  |  Branch (966:24): [True: 49, False: 74]
  ------------------
  967|     49|                encoder = &QUtil::utf8_to_mac_roman;
  968|     49|            }
  969|    177|        }
  970|  5.90k|    }
  971|       |
  972|  9.68k|    V = (*encoder)(V, '?');
  973|       |
  974|  9.68k|    std::vector<std::string> opt;
  975|  9.68k|    if (isChoice() && (getFlags() & ff_ch_combo) == 0) {
  ------------------
  |  Branch (975:9): [True: 2.60k, False: 7.08k]
  |  Branch (975:23): [True: 2.34k, False: 262]
  ------------------
  976|  2.34k|        opt = getChoices();
  977|  19.1k|        for (auto& o: opt) {
  ------------------
  |  Branch (977:21): [True: 19.1k, False: 2.34k]
  ------------------
  978|  19.1k|            o = (*encoder)(o, '?');
  979|  19.1k|        }
  980|  2.34k|    }
  981|       |
  982|  9.68k|    std::string result;
  983|  9.68k|    pl::String pl(result);
  984|  9.68k|    ValueSetter vs(DA, V, opt, tf, bbox);
  985|  9.68k|    Pl_QPDFTokenizer vs_tok("", &vs, &pl);
  986|  9.68k|    vs_tok.writeString(AS.getStreamData(qpdf_dl_all));
  987|  9.68k|    vs_tok.finish();
  988|  9.68k|    AS.replaceStreamData(std::move(result), Null::temp(), Null::temp());
  989|  9.68k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderC2Ev:
  800|  9.29k|        TfFinder() = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder11handleTokenERKN13QPDFTokenizer5TokenE:
  805|  1.78M|        {
  806|  1.78M|            auto ttype = token.getType();
  807|  1.78M|            auto const& value = token.getValue();
  808|  1.78M|            DA.emplace_back(token.getRawValue());
  809|  1.78M|            switch (ttype) {
  810|  57.7k|            case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (810:13): [True: 57.7k, False: 1.73M]
  ------------------
  811|  71.4k|            case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (811:13): [True: 13.6k, False: 1.77M]
  ------------------
  812|  71.4k|                last_num = strtod(value.c_str(), nullptr);
  813|  71.4k|                last_num_idx = QIntC::to_int(DA.size() - 1);
  814|  71.4k|                break;
  815|       |
  816|  62.5k|            case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (816:13): [True: 62.5k, False: 1.72M]
  ------------------
  817|  62.5k|                last_name = value;
  818|  62.5k|                break;
  819|       |
  820|  69.3k|            case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (820:13): [True: 69.3k, False: 1.72M]
  ------------------
  821|  69.3k|                if (token.isWord("Tf")) {
  ------------------
  |  Branch (821:21): [True: 9.72k, False: 59.6k]
  ------------------
  822|  9.72k|                    if ((last_num > 1.0) && (last_num < 1000.0)) {
  ------------------
  |  Branch (822:25): [True: 9.02k, False: 703]
  |  Branch (822:45): [True: 8.72k, False: 295]
  ------------------
  823|       |                        // These ranges are arbitrary but keep us from doing insane things or
  824|       |                        // suffering from over/underflow
  825|  8.72k|                        tf = last_num;
  826|  8.72k|                    }
  827|  9.72k|                    tf_idx = last_num_idx;
  828|  9.72k|                    font_name = last_name;
  829|  9.72k|                }
  830|  69.3k|                break;
  831|       |
  832|  1.58M|            default:
  ------------------
  |  Branch (832:13): [True: 1.58M, False: 203k]
  ------------------
  833|  1.58M|                break;
  834|  1.78M|            }
  835|  1.78M|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder5getTfEv:
  839|  9.29k|        {
  840|  9.29k|            return tf;
  841|  9.29k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder5getDAEv:
  850|  9.29k|        {
  851|  9.29k|            std::string result;
  852|  9.29k|            int i = -1;
  853|  1.78M|            for (auto const& cur: DA) {
  ------------------
  |  Branch (853:33): [True: 1.78M, False: 9.29k]
  ------------------
  854|  1.78M|                if (++i == tf_idx) {
  ------------------
  |  Branch (854:21): [True: 5.99k, False: 1.78M]
  ------------------
  855|  5.99k|                    double delta = strtod(cur.c_str(), nullptr) - tf;
  856|  5.99k|                    if (delta > 0.001 || delta < -0.001) {
  ------------------
  |  Branch (856:25): [True: 63, False: 5.93k]
  |  Branch (856:42): [True: 438, False: 5.49k]
  ------------------
  857|       |                        // tf doesn't match the font size passed to Tf, so substitute.
  858|    501|                        QTC::TC("qpdf", "QPDFFormFieldObjectHelper fallback Tf");
  859|    501|                        result += QUtil::double_to_string(tf);
  860|    501|                        continue;
  861|    501|                    }
  862|  5.99k|                }
  863|  1.78M|                result += cur;
  864|  1.78M|            }
  865|  9.29k|            return result;
  866|  9.29k|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder11getFontNameEv:
  844|  9.29k|        {
  845|  9.29k|            return font_name;
  846|  9.29k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS1_6vectorIS7_NS5_IS7_EEEEdRKN16QPDFObjectHandle9RectangleE:
  646|  9.29k|    DA(DA),
  647|  9.29k|    V(V),
  648|  9.29k|    opt(opt),
  649|  9.29k|    tf(tf),
  650|  9.29k|    bbox(bbox)
  651|  9.29k|{
  652|  9.29k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter11handleTokenERKN13QPDFTokenizer5TokenE:
  656|   429k|{
  657|   429k|    QPDFTokenizer::token_type_e ttype = token.getType();
  658|   429k|    std::string value = token.getValue();
  659|   429k|    bool do_replace = false;
  660|   429k|    switch (state) {
  ------------------
  |  Branch (660:13): [True: 429k, False: 0]
  ------------------
  661|   173k|    case st_top:
  ------------------
  |  Branch (661:5): [True: 173k, False: 256k]
  ------------------
  662|   173k|        writeToken(token);
  663|   173k|        if (token.isWord("BMC")) {
  ------------------
  |  Branch (663:13): [True: 6.89k, False: 166k]
  ------------------
  664|  6.89k|            state = st_bmc;
  665|  6.89k|        }
  666|   173k|        break;
  667|       |
  668|  13.8k|    case st_bmc:
  ------------------
  |  Branch (668:5): [True: 13.8k, False: 416k]
  ------------------
  669|  13.8k|        if ((ttype == QPDFTokenizer::tt_space) || (ttype == QPDFTokenizer::tt_comment)) {
  ------------------
  |  Branch (669:13): [True: 6.90k, False: 6.90k]
  |  Branch (669:51): [True: 16, False: 6.89k]
  ------------------
  670|  6.92k|            writeToken(token);
  671|  6.92k|        } else {
  672|  6.89k|            state = st_emc;
  673|  6.89k|        }
  674|       |        // fall through to emc
  675|       |
  676|   240k|    case st_emc:
  ------------------
  |  Branch (676:5): [True: 226k, False: 203k]
  ------------------
  677|   240k|        if (token.isWord("EMC")) {
  ------------------
  |  Branch (677:13): [True: 6.82k, False: 233k]
  ------------------
  678|  6.82k|            do_replace = true;
  679|  6.82k|            state = st_end;
  680|  6.82k|        }
  681|   240k|        break;
  682|       |
  683|  16.1k|    case st_end:
  ------------------
  |  Branch (683:5): [True: 16.1k, False: 413k]
  ------------------
  684|  16.1k|        writeToken(token);
  685|  16.1k|        break;
  686|   429k|    }
  687|   429k|    if (do_replace) {
  ------------------
  |  Branch (687:9): [True: 6.82k, False: 423k]
  ------------------
  688|  6.82k|        writeAppearance();
  689|  6.82k|    }
  690|   429k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter15writeAppearanceEv:
  704|  9.13k|{
  705|  9.13k|    replaced = true;
  706|       |
  707|       |    // This code does not take quadding into consideration because doing so requires font metric
  708|       |    // information, which we don't have in many cases.
  709|       |
  710|  9.13k|    double tfh = 1.2 * tf;
  711|  9.13k|    int dx = 1;
  712|       |
  713|       |    // Write one or more lines, centered vertically, possibly with one row highlighted.
  714|       |
  715|  9.13k|    auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
  716|  9.13k|    bool highlight = false;
  717|  9.13k|    size_t highlight_idx = 0;
  718|       |
  719|  9.13k|    std::vector<std::string> lines;
  720|  9.13k|    if (opt.empty() || (max_rows < 2)) {
  ------------------
  |  Branch (720:9): [True: 8.05k, False: 1.07k]
  |  Branch (720:24): [True: 235, False: 842]
  ------------------
  721|  8.29k|        lines.push_back(V);
  722|  8.29k|    } else {
  723|       |        // Figure out what rows to write
  724|    842|        size_t nopt = opt.size();
  725|    842|        size_t found_idx = 0;
  726|    842|        bool found = false;
  727|  12.4k|        for (found_idx = 0; found_idx < nopt; ++found_idx) {
  ------------------
  |  Branch (727:29): [True: 12.0k, False: 382]
  ------------------
  728|  12.0k|            if (opt.at(found_idx) == V) {
  ------------------
  |  Branch (728:17): [True: 460, False: 11.6k]
  ------------------
  729|    460|                found = true;
  730|    460|                break;
  731|    460|            }
  732|  12.0k|        }
  733|    842|        if (found) {
  ------------------
  |  Branch (733:13): [True: 460, False: 382]
  ------------------
  734|       |            // Try to make the found item the second one, but adjust for under/overflow.
  735|    460|            int wanted_first = QIntC::to_int(found_idx) - 1;
  736|    460|            int wanted_last = QIntC::to_int(found_idx + max_rows) - 2;
  737|    460|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list found");
  738|    460|            if (wanted_first < 0) {
  ------------------
  |  Branch (738:17): [True: 207, False: 253]
  ------------------
  739|    207|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list first too low");
  740|    207|                wanted_last -= wanted_first;
  741|    207|                wanted_first = 0;
  742|    207|            }
  743|    460|            if (wanted_last >= QIntC::to_int(nopt)) {
  ------------------
  |  Branch (743:17): [True: 387, False: 73]
  ------------------
  744|    387|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list last too high");
  745|    387|                auto diff = wanted_last - QIntC::to_int(nopt) + 1;
  746|    387|                wanted_first = std::max(0, wanted_first - diff);
  747|    387|                wanted_last -= diff;
  748|    387|            }
  749|    460|            highlight = true;
  750|    460|            highlight_idx = found_idx - QIntC::to_size(wanted_first);
  751|  9.89k|            for (size_t i = QIntC::to_size(wanted_first); i <= QIntC::to_size(wanted_last); ++i) {
  ------------------
  |  Branch (751:59): [True: 9.43k, False: 460]
  ------------------
  752|  9.43k|                lines.push_back(opt.at(i));
  753|  9.43k|            }
  754|    460|        } else {
  755|    382|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list not found");
  756|       |            // include our value and the first n-1 rows
  757|    382|            highlight_idx = 0;
  758|    382|            highlight = true;
  759|    382|            lines.push_back(V);
  760|  2.92k|            for (size_t i = 0; ((i < nopt) && (i < (max_rows - 1))); ++i) {
  ------------------
  |  Branch (760:33): [True: 2.55k, False: 370]
  |  Branch (760:47): [True: 2.54k, False: 12]
  ------------------
  761|  2.54k|                lines.push_back(opt.at(i));
  762|  2.54k|            }
  763|    382|        }
  764|    842|    }
  765|       |
  766|       |    // Write the lines centered vertically, highlighting if needed
  767|  9.13k|    size_t nlines = lines.size();
  768|  9.13k|    double dy = bbox.ury - ((bbox.ury - bbox.lly - (static_cast<double>(nlines) * tfh)) / 2.0);
  769|  9.13k|    if (highlight) {
  ------------------
  |  Branch (769:9): [True: 808, False: 8.32k]
  ------------------
  770|    808|        write(
  771|    808|            "q\n0.85 0.85 0.85 rg\n" + QUtil::double_to_string(bbox.llx) + " " +
  772|    808|            QUtil::double_to_string(
  773|    808|                bbox.lly + dy - (tfh * (static_cast<double>(highlight_idx + 1)))) +
  774|    808|            " " + QUtil::double_to_string(bbox.urx - bbox.llx) + " " +
  775|    808|            QUtil::double_to_string(tfh) + " re f\nQ\n");
  776|    808|    }
  777|  9.13k|    dy -= tf;
  778|  9.13k|    write("q\nBT\n" + DA + "\n");
  779|  29.7k|    for (size_t i = 0; i < nlines; ++i) {
  ------------------
  |  Branch (779:24): [True: 20.6k, False: 9.13k]
  ------------------
  780|       |        // We could adjust Tm to translate to the beginning the first line, set TL to tfh, and use
  781|       |        // T* for each subsequent line, but doing this would require extracting any Tm from DA,
  782|       |        // which doesn't seem really worth the effort.
  783|  20.6k|        if (i == 0) {
  ------------------
  |  Branch (783:13): [True: 9.10k, False: 11.5k]
  ------------------
  784|  9.10k|            write(
  785|  9.10k|                QUtil::double_to_string(bbox.llx + static_cast<double>(dx)) + " " +
  786|  9.10k|                QUtil::double_to_string(bbox.lly + static_cast<double>(dy)) + " Td\n");
  787|  11.5k|        } else {
  788|  11.5k|            write("0 " + QUtil::double_to_string(-tfh) + " Td\n");
  789|  11.5k|        }
  790|  20.6k|        write(QPDFObjectHandle::newString(lines.at(i)).unparse() + " Tj\n");
  791|  20.6k|    }
  792|  9.13k|    write("ET\nQ\nEMC");
  793|  9.13k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter9handleEOFEv:
  694|  9.10k|{
  695|  9.10k|    if (!replaced) {
  ------------------
  |  Branch (695:9): [True: 2.31k, False: 6.79k]
  ------------------
  696|  2.31k|        QTC::TC("qpdf", "QPDFFormFieldObjectHelper replaced BMC at EOF");
  697|  2.31k|        write("/Tx BMC\n");
  698|  2.31k|        writeAppearance();
  699|  2.31k|    }
  700|  9.10k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterD2Ev:
  624|  9.29k|        ~ValueSetter() override = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderD2Ev:
  801|  9.29k|        ~TfFinder() final = default;
_ZN25QPDFFormFieldObjectHelper7MembersC2ERK16QPDFObjectHandle:
   28|  54.0k|        FormNode(oh)
   29|  54.0k|    {
   30|  54.0k|    }

_ZN10QPDFLogger7MembersC2Ev:
   47|      1|    p_discard(new Pl_Discard()),
   48|      1|    p_real_stdout(new Pl_OStream("standard output", std::cout)),
   49|      1|    p_stdout(new Pl_Track("track stdout", p_real_stdout.get())),
   50|      1|    p_stderr(new Pl_OStream("standard error", std::cerr)),
   51|      1|    p_info(p_stdout),
   52|      1|    p_warn(nullptr),
   53|      1|    p_error(p_stderr),
   54|      1|    p_save(nullptr)
   55|      1|{
   56|      1|}
_ZN10QPDFLogger7MembersD2Ev:
   59|      1|{
   60|      1|    p_stdout->finish();
   61|      1|    p_stderr->finish();
   62|      1|}
_ZN10QPDFLoggerC2Ev:
   65|      1|    m(new Members())
   66|      1|{
   67|      1|}
_ZN10QPDFLogger6createEv:
   71|      1|{
   72|      1|    return std::shared_ptr<QPDFLogger>(new QPDFLogger);
   73|      1|}
_ZN10QPDFLogger13defaultLoggerEv:
   77|  47.8k|{
   78|  47.8k|    static auto l = create();
   79|  47.8k|    return l;
   80|  47.8k|}
_ZN10QPDFLogger4warnEPKc:
  102|     21|{
  103|     21|    getWarn(false)->writeCStr(s);
  104|     21|}
_ZN10QPDFLogger7getWarnEb:
  114|  1.02M|{
  115|  1.02M|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 1.02M]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|  1.02M|    return getError(null_okay);
  119|  1.02M|}
_ZN10QPDFLogger8getErrorEb:
  135|  1.04M|{
  136|  1.04M|    return throwIfNull(m->p_error, null_okay);
  137|  1.04M|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|  1.04M|{
  255|  1.04M|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 1.04M]
  |  Branch (255:24): [True: 1.04M, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|  1.04M|    return p;
  259|  1.04M|}
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_TrackC2EPKcP8Pipeline:
   15|      1|            Pipeline(identifier, next)
   16|      1|        {
   17|      1|            if (!next) {
  ------------------
  |  Branch (17:17): [True: 0, False: 1]
  ------------------
   18|      0|                throw std::logic_error("Attempt to create Pl_Track with nullptr as next");
   19|      0|            }
   20|      1|        }
QPDFLogger.cc:_ZN12_GLOBAL__N_18Pl_Track6finishEv:
   31|      1|        {
   32|      1|            next()->finish();
   33|      1|        }

_ZN10QPDFMatrixC2Ev:
    7|  13.3k|    a(1.0),
    8|  13.3k|    b(0.0),
    9|  13.3k|    c(0.0),
   10|  13.3k|    d(1.0),
   11|  13.3k|    e(0.0),
   12|  13.3k|    f(0.0)
   13|  13.3k|{
   14|  13.3k|}
_ZN10QPDFMatrixC2Edddddd:
   17|  19.8k|    a(a),
   18|  19.8k|    b(b),
   19|  19.8k|    c(c),
   20|  19.8k|    d(d),
   21|  19.8k|    e(e),
   22|  19.8k|    f(f)
   23|  19.8k|{
   24|  19.8k|}
_ZN10QPDFMatrixC2ERKN16QPDFObjectHandle6MatrixE:
   27|    459|    a(m.a),
   28|    459|    b(m.b),
   29|    459|    c(m.c),
   30|    459|    d(m.d),
   31|    459|    e(m.e),
   32|    459|    f(m.f)
   33|    459|{
   34|    459|}
_ZNK10QPDFMatrix7unparseEv:
   47|  6.55k|{
   48|  6.55k|    return (
   49|  6.55k|        QUtil::double_to_string(fix_rounding(a), 5) + " " +
   50|  6.55k|        QUtil::double_to_string(fix_rounding(b), 5) + " " +
   51|  6.55k|        QUtil::double_to_string(fix_rounding(c), 5) + " " +
   52|  6.55k|        QUtil::double_to_string(fix_rounding(d), 5) + " " +
   53|  6.55k|        QUtil::double_to_string(fix_rounding(e), 5) + " " +
   54|  6.55k|        QUtil::double_to_string(fix_rounding(f), 5));
   55|  6.55k|}
_ZN10QPDFMatrix6concatERKS_:
   65|  19.9k|{
   66|  19.9k|    double ap = (this->a * other.a) + (this->c * other.b);
   67|  19.9k|    double bp = (this->b * other.a) + (this->d * other.b);
   68|  19.9k|    double cp = (this->a * other.c) + (this->c * other.d);
   69|  19.9k|    double dp = (this->b * other.c) + (this->d * other.d);
   70|  19.9k|    double ep = (this->a * other.e) + (this->c * other.f) + this->e;
   71|  19.9k|    double fp = (this->b * other.e) + (this->d * other.f) + this->f;
   72|  19.9k|    this->a = ap;
   73|  19.9k|    this->b = bp;
   74|  19.9k|    this->c = cp;
   75|  19.9k|    this->d = dp;
   76|  19.9k|    this->e = ep;
   77|  19.9k|    this->f = fp;
   78|  19.9k|}
_ZN10QPDFMatrix5scaleEdd:
   82|  6.55k|{
   83|  6.55k|    concat(QPDFMatrix(sx, 0, 0, sy, 0, 0));
   84|  6.55k|}
_ZN10QPDFMatrix9translateEdd:
   88|  13.1k|{
   89|  13.1k|    concat(QPDFMatrix(1, 0, 0, 1, tx, ty));
   90|  13.1k|}
_ZN10QPDFMatrix9rotatex90Ei:
   94|    195|{
   95|    195|    switch (angle) {
   96|     13|    case 90:
  ------------------
  |  Branch (96:5): [True: 13, False: 182]
  ------------------
   97|     13|        concat(QPDFMatrix(0, 1, -1, 0, 0, 0));
   98|     13|        break;
   99|     20|    case 180:
  ------------------
  |  Branch (99:5): [True: 20, False: 175]
  ------------------
  100|     20|        concat(QPDFMatrix(-1, 0, 0, -1, 0, 0));
  101|     20|        break;
  102|    128|    case 270:
  ------------------
  |  Branch (102:5): [True: 128, False: 67]
  ------------------
  103|    128|        concat(QPDFMatrix(0, -1, 1, 0, 0, 0));
  104|    128|        break;
  105|     34|    default:
  ------------------
  |  Branch (105:5): [True: 34, False: 161]
  ------------------
  106|       |        // ignore
  107|     34|        break;
  108|    195|    }
  109|    195|}
_ZNK10QPDFMatrix9transformEddRdS0_:
  113|  26.5k|{
  114|  26.5k|    xp = (this->a * x) + (this->c * y) + this->e;
  115|  26.5k|    yp = (this->b * x) + (this->d * y) + this->f;
  116|  26.5k|}
_ZNK10QPDFMatrix18transformRectangleEN16QPDFObjectHandle9RectangleE:
  120|  6.64k|{
  121|  6.64k|    std::vector<double> tx(4);
  122|  6.64k|    std::vector<double> ty(4);
  123|  6.64k|    transform(r.llx, r.lly, tx.at(0), ty.at(0));
  124|  6.64k|    transform(r.llx, r.ury, tx.at(1), ty.at(1));
  125|  6.64k|    transform(r.urx, r.lly, tx.at(2), ty.at(2));
  126|  6.64k|    transform(r.urx, r.ury, tx.at(3), ty.at(3));
  127|  6.64k|    return {
  128|  6.64k|        *std::min_element(tx.begin(), tx.end()),
  129|  6.64k|        *std::min_element(ty.begin(), ty.end()),
  130|  6.64k|        *std::max_element(tx.begin(), tx.end()),
  131|  6.64k|        *std::max_element(ty.begin(), ty.end())};
  132|  6.64k|}
QPDFMatrix.cc:_ZL12fix_roundingd:
   38|  39.3k|{
   39|  39.3k|    if ((d > -0.00001) && (d < 0.00001)) {
  ------------------
  |  Branch (39:9): [True: 38.5k, False: 815]
  |  Branch (39:27): [True: 13.4k, False: 25.0k]
  ------------------
   40|  13.4k|        d = 0.0;
   41|  13.4k|    }
   42|  39.3k|    return d;
   43|  39.3k|}

_ZN10QPDFObject14getDescriptionEv:
    5|   202k|{
    6|   202k|    qpdf_offset_t shift = (getTypeCode() == ::ot_dictionary) ? 2
  ------------------
  |  Branch (6:27): [True: 93.7k, False: 109k]
  ------------------
    7|   202k|        : (getTypeCode() == ::ot_array)                      ? 1
  ------------------
  |  Branch (7:11): [True: 89, False: 108k]
  ------------------
    8|   109k|                                                             : 0;
    9|       |
   10|   202k|    if (object_description) {
  ------------------
  |  Branch (10:9): [True: 149k, False: 53.7k]
  ------------------
   11|   149k|        switch (object_description->index()) {
  ------------------
  |  Branch (11:17): [True: 149k, False: 0]
  ------------------
   12|   145k|        case 0:
  ------------------
  |  Branch (12:9): [True: 145k, False: 3.91k]
  ------------------
   13|   145k|            {
   14|       |                // Simple template string
   15|   145k|                auto description = std::get<0>(*object_description);
   16|       |
   17|   145k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (17:57): [True: 0, False: 145k]
  ------------------
   18|      0|                    description.replace(pos, 3, og.unparse(' '));
   19|      0|                }
   20|   145k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (20:57): [True: 124k, False: 20.6k]
  ------------------
   21|   124k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   22|   124k|                }
   23|   145k|                return description;
   24|      0|            }
   25|      0|        case 1:
  ------------------
  |  Branch (25:9): [True: 0, False: 149k]
  ------------------
   26|      0|            {
   27|       |                // QPDF::JSONReactor generated description
   28|      0|                auto j_descr = std::get<1>(*object_description);
   29|      0|                return (
   30|      0|                    *j_descr.input + (j_descr.object.empty() ? "" : ", " + j_descr.object) +
  ------------------
  |  Branch (30:39): [True: 0, False: 0]
  ------------------
   31|      0|                    " at offset " + std::to_string(parsed_offset));
   32|      0|            }
   33|  3.50k|        case 2:
  ------------------
  |  Branch (33:9): [True: 3.50k, False: 145k]
  ------------------
   34|  3.50k|            {
   35|       |                // Child object description
   36|  3.50k|                auto j_descr = std::get<2>(*object_description);
   37|  3.50k|                std::string result;
   38|  3.50k|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (38:26): [True: 3.50k, False: 0]
  ------------------
   39|  3.50k|                    result = p->getDescription();
   40|  3.50k|                }
   41|  3.50k|                result += j_descr.static_descr;
   42|  3.50k|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (42:52): [True: 3.50k, False: 0]
  ------------------
   43|  3.50k|                    result.replace(pos, 3, j_descr.var_descr);
   44|  3.50k|                }
   45|  3.50k|                return result;
   46|      0|            }
   47|    408|        case 3:
  ------------------
  |  Branch (47:9): [True: 408, False: 148k]
  ------------------
   48|    408|            auto [stream_id, obj_id] = std::get<3>(*object_description);
   49|    408|            std::string result = qpdf ? qpdf->getFilename() : "";
  ------------------
  |  Branch (49:34): [True: 408, False: 0]
  ------------------
   50|    408|            result += " object stream " + std::to_string(stream_id) + ", object " +
   51|    408|                std::to_string(obj_id) + " 0 at offset " + std::to_string(parsed_offset + shift);
   52|    408|            return result;
   53|   149k|        }
   54|       |
   55|   149k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (55:16): [True: 53.6k, False: 154]
  ------------------
   56|  53.6k|        return "object " + og.unparse(' ');
   57|  53.6k|    }
   58|    154|    return {};
   59|   202k|}

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   374k|{
   35|   374k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 373k, False: 276]
  ------------------
   36|   374k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  30.5k|    supports_retry(supports_retry)
   47|  30.5k|{
   48|  30.5k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  30.5k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  30.5k|}
_ZN16QPDFObjectHandle18StreamDataProvider13supportsRetryEv:
   85|  4.63k|{
   86|  4.63k|    return supports_retry;
   87|  4.63k|}
_ZN16QPDFObjectHandle11TokenFilter9handleEOFEv:
  119|  9.29k|{
  120|  9.29k|}
_ZN16QPDFObjectHandle11TokenFilter11setPipelineEP8Pipeline:
  124|  36.9k|{
  125|  36.9k|    pipeline = p;
  126|  36.9k|}
_ZN16QPDFObjectHandle11TokenFilter5writeEPKcm:
  130|   259k|{
  131|   259k|    if (!pipeline) {
  ------------------
  |  Branch (131:9): [True: 0, False: 259k]
  ------------------
  132|      0|        return;
  133|      0|    }
  134|   259k|    if (len) {
  ------------------
  |  Branch (134:9): [True: 250k, False: 9.03k]
  ------------------
  135|   250k|        pipeline->write(data, len);
  136|   250k|    }
  137|   259k|}
_ZN16QPDFObjectHandle11TokenFilter5writeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  141|  62.6k|{
  142|  62.6k|    write(str.c_str(), str.length());
  143|  62.6k|}
_ZN16QPDFObjectHandle11TokenFilter10writeTokenERKN13QPDFTokenizer5TokenE:
  147|   196k|{
  148|   196k|    std::string const& value = token.getRawValue();
  149|   196k|    write(value.c_str(), value.length());
  150|   196k|}
_ZN4qpdf4Name19analyzeJSONEncodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  180|   516k|{
  181|   516k|    int tail = 0;       // Number of continuation characters expected.
  182|   516k|    bool tail2 = false; // Potential overlong 3 octet utf-8.
  183|   516k|    bool tail3 = false; // potential overlong 4 octet
  184|   516k|    bool needs_escaping = false;
  185|  5.75M|    for (auto const& it: name) {
  ------------------
  |  Branch (185:24): [True: 5.75M, False: 496k]
  ------------------
  186|  5.75M|        auto c = static_cast<unsigned char>(it);
  187|  5.75M|        if (tail) {
  ------------------
  |  Branch (187:13): [True: 10.6k, False: 5.74M]
  ------------------
  188|  10.6k|            if ((c & 0xc0) != 0x80) {
  ------------------
  |  Branch (188:17): [True: 5.29k, False: 5.32k]
  ------------------
  189|  5.29k|                return {false, false};
  190|  5.29k|            }
  191|  5.32k|            if (tail2) {
  ------------------
  |  Branch (191:17): [True: 537, False: 4.78k]
  ------------------
  192|    537|                if ((c & 0xe0) == 0x80) {
  ------------------
  |  Branch (192:21): [True: 216, False: 321]
  ------------------
  193|    216|                    return {false, false};
  194|    216|                }
  195|    321|                tail2 = false;
  196|  4.78k|            } else if (tail3) {
  ------------------
  |  Branch (196:24): [True: 146, False: 4.63k]
  ------------------
  197|    146|                if ((c & 0xf0) == 0x80) {
  ------------------
  |  Branch (197:21): [True: 74, False: 72]
  ------------------
  198|     74|                    return {false, false};
  199|     74|                }
  200|     72|                tail3 = false;
  201|     72|            }
  202|  5.03k|            tail--;
  203|  5.74M|        } else if (c < 0x80) {
  ------------------
  |  Branch (203:20): [True: 5.71M, False: 25.0k]
  ------------------
  204|  5.71M|            if (!needs_escaping) {
  ------------------
  |  Branch (204:17): [True: 3.73M, False: 1.97M]
  ------------------
  205|  3.73M|                needs_escaping = !((c > 34 && c != '\\') || c == ' ' || c == 33);
  ------------------
  |  Branch (205:37): [True: 3.72M, False: 11.3k]
  |  Branch (205:47): [True: 3.72M, False: 1.28k]
  |  Branch (205:61): [True: 72, False: 12.5k]
  |  Branch (205:73): [True: 634, False: 11.9k]
  ------------------
  206|  3.73M|            }
  207|  5.71M|        } else if ((c & 0xe0) == 0xc0) {
  ------------------
  |  Branch (207:20): [True: 4.47k, False: 20.5k]
  ------------------
  208|  4.47k|            if ((c & 0xfe) == 0xc0) {
  ------------------
  |  Branch (208:17): [True: 280, False: 4.19k]
  ------------------
  209|    280|                return {false, false};
  210|    280|            }
  211|  4.19k|            tail = 1;
  212|  20.5k|        } else if ((c & 0xf0) == 0xe0) {
  ------------------
  |  Branch (212:20): [True: 3.74k, False: 16.8k]
  ------------------
  213|  3.74k|            tail2 = (c == 0xe0);
  214|  3.74k|            tail = 2;
  215|  16.8k|        } else if ((c & 0xf8) == 0xf0) {
  ------------------
  |  Branch (215:20): [True: 1.77k, False: 15.0k]
  ------------------
  216|  1.77k|            tail3 = (c == 0xf0);
  217|  1.77k|            tail = 3;
  218|  15.0k|        } else {
  219|  15.0k|            return {false, false};
  220|  15.0k|        }
  221|  5.75M|    }
  222|   496k|    return {tail == 0, !needs_escaping};
  223|   516k|}
_ZN4qpdf4Name9normalizeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  227|  75.1k|{
  228|  75.1k|    if (name.empty()) {
  ------------------
  |  Branch (228:9): [True: 0, False: 75.1k]
  ------------------
  229|      0|        return name;
  230|      0|    }
  231|  75.1k|    std::string result;
  232|  75.1k|    result += name.at(0);
  233|   130M|    for (size_t i = 1; i < name.length(); ++i) {
  ------------------
  |  Branch (233:24): [True: 130M, False: 75.1k]
  ------------------
  234|   130M|        char ch = name.at(i);
  235|       |        // Don't use locale/ctype here; follow PDF spec guidelines.
  236|   130M|        if (ch == '\0') {
  ------------------
  |  Branch (236:13): [True: 4.26M, False: 126M]
  ------------------
  237|       |            // QPDFTokenizer embeds a null character to encode an invalid #.
  238|  4.26M|            result += "#";
  239|   126M|        } else if (
  240|   126M|            ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (240:13): [True: 123M, False: 2.64M]
  |  Branch (240:24): [True: 202, False: 2.64M]
  |  Branch (240:37): [True: 202, False: 2.64M]
  |  Branch (240:50): [True: 414, False: 2.64M]
  |  Branch (240:63): [True: 260, False: 2.64M]
  |  Branch (240:76): [True: 194, False: 2.64M]
  |  Branch (240:89): [True: 194, False: 2.64M]
  ------------------
  241|   125M|            ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch > 126) {
  ------------------
  |  Branch (241:13): [True: 222, False: 2.64M]
  |  Branch (241:26): [True: 588, False: 2.64M]
  |  Branch (241:39): [True: 203, False: 2.64M]
  |  Branch (241:52): [True: 876, False: 2.64M]
  |  Branch (241:65): [True: 322, False: 2.64M]
  |  Branch (241:78): [True: 2.08M, False: 558k]
  ------------------
  242|   125M|            result += util::hex_encode_char(ch);
  243|   125M|        } else {
  244|   558k|            result += ch;
  245|   558k|        }
  246|   130M|    }
  247|  75.1k|    return result;
  248|  75.1k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|   634k|{
  253|   634k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 634k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 634k]
  ------------------
  255|      0|        throw std::logic_error("QPDFObjectHandle: attempting to copy an uninitialized object");
  256|      0|        return {}; // does not return
  257|      0|    case ::ot_reserved:
  ------------------
  |  Branch (257:5): [True: 0, False: 634k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|  63.0k|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 63.0k, False: 571k]
  ------------------
  260|  63.0k|        return QPDFObject::create<QPDF_Null>();
  261|  1.25k|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 1.25k, False: 633k]
  ------------------
  262|  1.25k|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|   114k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 114k, False: 519k]
  ------------------
  264|   114k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|  50.7k|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 50.7k, False: 583k]
  ------------------
  266|  50.7k|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|   122k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 122k, False: 511k]
  ------------------
  268|   122k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|   195k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 195k, False: 438k]
  ------------------
  270|   195k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|  34.9k|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 34.9k, False: 599k]
  ------------------
  272|  34.9k|        {
  273|  34.9k|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|  34.9k|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 34.9k]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|  34.9k|            } else {
  277|  34.9k|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 471, False: 34.4k]
  ------------------
  278|  34.9k|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 471, False: 34.4k]
  ------------------
  279|    471|                    QPDF_Array result;
  280|    471|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|    471|                    result.sp->size = a.sp->size;
  282|  6.79k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 6.79k, False: 471]
  ------------------
  283|  6.79k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 1.06k, False: 5.73k]
  ------------------
  284|  6.79k|                    }
  285|    471|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|  34.4k|                } else {
  287|  34.4k|                    std::vector<QPDFObjectHandle> result;
  288|  34.4k|                    result.reserve(a.elements.size());
  289|   947k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 947k, False: 34.4k]
  ------------------
  290|   947k|                        result.emplace_back(
  291|   947k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 947k, False: 0]
  |  Branch (291:40): [True: 573k, False: 373k]
  ------------------
  292|   947k|                    }
  293|  34.4k|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|  34.4k|                }
  295|  34.9k|            }
  296|  34.9k|        }
  297|  51.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 51.5k, False: 582k]
  ------------------
  298|  51.5k|        {
  299|  51.5k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|  51.5k|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 51.5k]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|  51.5k|            } else {
  303|  51.5k|                std::map<std::string, QPDFObjectHandle> new_items;
  304|   260k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 260k, False: 51.5k]
  ------------------
  305|   260k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 47.9k, False: 212k]
  ------------------
  306|   260k|                }
  307|  51.5k|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|  51.5k|            }
  309|  51.5k|        }
  310|     11|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 11, False: 634k]
  ------------------
  311|     11|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|     11|        throw std::runtime_error("stream objects cannot be cloned");
  313|      0|        return {}; // does not return
  314|      0|    case ::ot_operator:
  ------------------
  |  Branch (314:5): [True: 0, False: 634k]
  ------------------
  315|      0|        return QPDFObject::create<QPDF_Operator>(std::get<QPDF_Operator>(obj->value).val);
  316|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (316:5): [True: 0, False: 634k]
  ------------------
  317|      0|        return QPDFObject::create<QPDF_InlineImage>(std::get<QPDF_InlineImage>(obj->value).val);
  318|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (318:5): [True: 0, False: 634k]
  ------------------
  319|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  320|      0|        return {}; // does not return
  321|      0|    case ::ot_destroyed:
  ------------------
  |  Branch (321:5): [True: 0, False: 634k]
  ------------------
  322|      0|        throw std::logic_error("attempted to shallow copy QPDFObjectHandle from destroyed QPDF");
  323|      0|        return {}; // does not return
  324|      0|    case ::ot_reference:
  ------------------
  |  Branch (324:5): [True: 0, False: 634k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|   634k|    }
  327|      0|    return {}; // unreachable
  328|   634k|}
_ZNK4qpdf10BaseHandle7unparseEv:
  474|   129k|{
  475|   129k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (475:13): [True: 129k, False: 0]
  ------------------
  476|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (476:5): [True: 0, False: 129k]
  ------------------
  477|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse an uninitialized object");
  478|      0|        return ""; // does not return
  479|      0|    case ::ot_reserved:
  ------------------
  |  Branch (479:5): [True: 0, False: 129k]
  ------------------
  480|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  481|      0|        return ""; // does not return
  482|  21.8k|    case ::ot_null:
  ------------------
  |  Branch (482:5): [True: 21.8k, False: 107k]
  ------------------
  483|  21.8k|        return "null";
  484|    282|    case ::ot_boolean:
  ------------------
  |  Branch (484:5): [True: 282, False: 129k]
  ------------------
  485|    282|        return std::get<QPDF_Bool>(obj->value).val ? "true" : "false";
  ------------------
  |  Branch (485:16): [True: 235, False: 47]
  ------------------
  486|  6.15k|    case ::ot_integer:
  ------------------
  |  Branch (486:5): [True: 6.15k, False: 123k]
  ------------------
  487|  6.15k|        return std::to_string(std::get<QPDF_Integer>(obj->value).val);
  488|  1.73k|    case ::ot_real:
  ------------------
  |  Branch (488:5): [True: 1.73k, False: 127k]
  ------------------
  489|  1.73k|        return std::get<QPDF_Real>(obj->value).val;
  490|  47.0k|    case ::ot_string:
  ------------------
  |  Branch (490:5): [True: 47.0k, False: 82.4k]
  ------------------
  491|  47.0k|        return std::get<QPDF_String>(obj->value).unparse(false);
  492|  52.4k|    case ::ot_name:
  ------------------
  |  Branch (492:5): [True: 52.4k, False: 77.0k]
  ------------------
  493|  52.4k|        return Name::normalize(std::get<QPDF_Name>(obj->value).name);
  494|      0|    case ::ot_array:
  ------------------
  |  Branch (494:5): [True: 0, False: 129k]
  ------------------
  495|      0|        {
  496|      0|            auto const& a = std::get<QPDF_Array>(obj->value);
  497|      0|            std::string result = "[ ";
  498|      0|            if (a.sp) {
  ------------------
  |  Branch (498:17): [True: 0, False: 0]
  ------------------
  499|      0|                size_t next = 0;
  500|      0|                for (auto& [key, value]: a.sp->elements) {
  ------------------
  |  Branch (500:40): [True: 0, False: 0]
  ------------------
  501|      0|                    for (size_t j = next; j < key; ++j) {
  ------------------
  |  Branch (501:43): [True: 0, False: 0]
  ------------------
  502|      0|                        result += "null ";
  503|      0|                    }
  504|      0|                    result += value.unparse() + " ";
  505|      0|                    next = key + 1;
  506|      0|                }
  507|      0|                for (size_t j = next; j < a.sp->size; ++j) {
  ------------------
  |  Branch (507:39): [True: 0, False: 0]
  ------------------
  508|      0|                    result += "null ";
  509|      0|                }
  510|      0|            } else {
  511|      0|                for (auto const& item: a.elements) {
  ------------------
  |  Branch (511:38): [True: 0, False: 0]
  ------------------
  512|      0|                    result += item.unparse() + " ";
  513|      0|                }
  514|      0|            }
  515|      0|            result += "]";
  516|      0|            return result;
  517|      0|        }
  518|      0|    case ::ot_dictionary:
  ------------------
  |  Branch (518:5): [True: 0, False: 129k]
  ------------------
  519|      0|        {
  520|      0|            auto const& items = std::get<QPDF_Dictionary>(obj->value).items;
  521|      0|            std::string result = "<< ";
  522|      0|            for (auto& iter: items) {
  ------------------
  |  Branch (522:28): [True: 0, False: 0]
  ------------------
  523|      0|                if (!iter.second.null()) {
  ------------------
  |  Branch (523:21): [True: 0, False: 0]
  ------------------
  524|      0|                    result += Name::normalize(iter.first) + " " + iter.second.unparse() + " ";
  525|      0|                }
  526|      0|            }
  527|      0|            result += ">>";
  528|      0|            return result;
  529|      0|        }
  530|      0|    case ::ot_stream:
  ------------------
  |  Branch (530:5): [True: 0, False: 129k]
  ------------------
  531|      0|        return obj->og.unparse(' ') + " R";
  532|      0|    case ::ot_operator:
  ------------------
  |  Branch (532:5): [True: 0, False: 129k]
  ------------------
  533|      0|        return std::get<QPDF_Operator>(obj->value).val;
  534|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (534:5): [True: 0, False: 129k]
  ------------------
  535|      0|        return std::get<QPDF_InlineImage>(obj->value).val;
  536|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (536:5): [True: 0, False: 129k]
  ------------------
  537|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a unresolved object");
  538|      0|        return ""; // does not return
  539|      0|    case ::ot_destroyed:
  ------------------
  |  Branch (539:5): [True: 0, False: 129k]
  ------------------
  540|      0|        throw std::logic_error("attempted to unparse a QPDFObjectHandle from a destroyed QPDF");
  541|      0|        return ""; // does not return
  542|      0|    case ::ot_reference:
  ------------------
  |  Branch (542:5): [True: 0, False: 129k]
  ------------------
  543|      0|        return obj->og.unparse(' ') + " R";
  544|   129k|    }
  545|      0|    return {}; // unreachable
  546|   129k|}
_ZNK4qpdf10BaseHandle10write_jsonEiRN4JSON6WriterE:
  550|   655k|{
  551|   655k|    switch (resolved_type_code()) {
  552|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (552:5): [True: 0, False: 655k]
  ------------------
  553|      0|        throw std::logic_error(
  554|      0|            "QPDFObjectHandle: attempting to get JSON from a uninitialized object");
  555|      0|        break; // unreachable
  556|  15.8k|    case ::ot_null:
  ------------------
  |  Branch (556:5): [True: 15.8k, False: 640k]
  ------------------
  557|  15.8k|    case ::ot_operator:
  ------------------
  |  Branch (557:5): [True: 0, False: 655k]
  ------------------
  558|  15.8k|    case ::ot_inlineimage:
  ------------------
  |  Branch (558:5): [True: 0, False: 655k]
  ------------------
  559|  15.8k|        p << "null";
  560|  15.8k|        break;
  561|  3.51k|    case ::ot_boolean:
  ------------------
  |  Branch (561:5): [True: 3.51k, False: 652k]
  ------------------
  562|  3.51k|        p << std::get<QPDF_Bool>(obj->value).val;
  563|  3.51k|        break;
  564|   123k|    case ::ot_integer:
  ------------------
  |  Branch (564:5): [True: 123k, False: 532k]
  ------------------
  565|   123k|        p << std::to_string(std::get<QPDF_Integer>(obj->value).val);
  566|   123k|        break;
  567|  74.7k|    case ::ot_real:
  ------------------
  |  Branch (567:5): [True: 74.7k, False: 581k]
  ------------------
  568|  74.7k|        {
  569|  74.7k|            auto const& val = std::get<QPDF_Real>(obj->value).val;
  570|  74.7k|            if (val.empty()) {
  ------------------
  |  Branch (570:17): [True: 0, False: 74.7k]
  ------------------
  571|       |                // Can't really happen...
  572|      0|                p << "0";
  573|  74.7k|            } else if (val.at(0) == '.') {
  ------------------
  |  Branch (573:24): [True: 892, False: 73.8k]
  ------------------
  574|    892|                p << "0" << val;
  575|  73.8k|            } else if (val.length() >= 2 && val.at(0) == '-' && val.at(1) == '.') {
  ------------------
  |  Branch (575:24): [True: 40.1k, False: 33.7k]
  |  Branch (575:45): [True: 608, False: 39.5k]
  |  Branch (575:65): [True: 340, False: 268]
  ------------------
  576|    340|                p << "-0." << val.substr(2);
  577|  73.5k|            } else {
  578|  73.5k|                p << val;
  579|  73.5k|            }
  580|  74.7k|            if (val.back() == '.') {
  ------------------
  |  Branch (580:17): [True: 1.54k, False: 73.2k]
  ------------------
  581|  1.54k|                p << "0";
  582|  1.54k|            }
  583|  74.7k|        }
  584|  74.7k|        break;
  585|   110k|    case ::ot_string:
  ------------------
  |  Branch (585:5): [True: 110k, False: 545k]
  ------------------
  586|   110k|        std::get<QPDF_String>(obj->value).writeJSON(json_version, p);
  587|   110k|        break;
  588|   193k|    case ::ot_name:
  ------------------
  |  Branch (588:5): [True: 193k, False: 462k]
  ------------------
  589|   193k|        {
  590|   193k|            auto const& n = std::get<QPDF_Name>(obj->value);
  591|       |            // For performance reasons this code is duplicated in QPDF_Dictionary::writeJSON. When
  592|       |            // updating this method make sure QPDF_Dictionary is also update.
  593|   193k|            if (json_version == 1) {
  ------------------
  |  Branch (593:17): [True: 0, False: 193k]
  ------------------
  594|      0|                p << "\"" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  595|   193k|            } else {
  596|   193k|                if (auto res = Name::analyzeJSONEncoding(n.name); res.first) {
  ------------------
  |  Branch (596:67): [True: 182k, False: 10.4k]
  ------------------
  597|   182k|                    if (res.second) {
  ------------------
  |  Branch (597:25): [True: 178k, False: 4.36k]
  ------------------
  598|   178k|                        p << "\"" << n.name << "\"";
  599|   178k|                    } else {
  600|  4.36k|                        p << "\"" << JSON::Writer::encode_string(n.name) << "\"";
  601|  4.36k|                    }
  602|   182k|                } else {
  603|  10.4k|                    p << "\"n:" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  604|  10.4k|                }
  605|   193k|            }
  606|   193k|        }
  607|   193k|        break;
  608|  53.6k|    case ::ot_array:
  ------------------
  |  Branch (608:5): [True: 53.6k, False: 602k]
  ------------------
  609|  53.6k|        {
  610|  53.6k|            auto const& a = std::get<QPDF_Array>(obj->value);
  611|  53.6k|            p.writeStart('[');
  612|  53.6k|            if (a.sp) {
  ------------------
  |  Branch (612:17): [True: 321, False: 53.3k]
  ------------------
  613|    321|                size_t next = 0;
  614|  4.30k|                for (auto& [key, value]: a.sp->elements) {
  ------------------
  |  Branch (614:40): [True: 4.30k, False: 321]
  ------------------
  615|  31.5k|                    for (size_t j = next; j < key; ++j) {
  ------------------
  |  Branch (615:43): [True: 27.2k, False: 4.30k]
  ------------------
  616|  27.2k|                        p.writeNext() << "null";
  617|  27.2k|                    }
  618|  4.30k|                    p.writeNext();
  619|  4.30k|                    auto item_og = value.id_gen();
  620|  4.30k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (620:25): [True: 1.03k, False: 3.26k]
  ------------------
  621|  1.03k|                        p << "\"" << item_og.unparse(' ') << " R\"";
  622|  3.26k|                    } else {
  623|  3.26k|                        value.write_json(json_version, p);
  624|  3.26k|                    }
  625|  4.30k|                    next = key + 1;
  626|  4.30k|                }
  627|  6.13k|                for (size_t j = next; j < a.sp->size; ++j) {
  ------------------
  |  Branch (627:39): [True: 5.81k, False: 321]
  ------------------
  628|  5.81k|                    p.writeNext() << "null";
  629|  5.81k|                }
  630|  53.3k|            } else {
  631|  1.07M|                for (auto const& item: a.elements) {
  ------------------
  |  Branch (631:38): [True: 1.07M, False: 53.3k]
  ------------------
  632|  1.07M|                    p.writeNext();
  633|  1.07M|                    auto item_og = item.id_gen();
  634|  1.07M|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (634:25): [True: 738k, False: 339k]
  ------------------
  635|   738k|                        p << "\"" << item_og.unparse(' ') << " R\"";
  636|   738k|                    } else {
  637|   339k|                        item.write_json(json_version, p);
  638|   339k|                    }
  639|  1.07M|                }
  640|  53.3k|            }
  641|  53.6k|            p.writeEnd(']');
  642|  53.6k|        }
  643|  53.6k|        break;
  644|  80.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (644:5): [True: 80.5k, False: 575k]
  ------------------
  645|  80.5k|        {
  646|  80.5k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  647|  80.5k|            p.writeStart('{');
  648|   360k|            for (auto& iter: d.items) {
  ------------------
  |  Branch (648:28): [True: 360k, False: 80.5k]
  ------------------
  649|   360k|                if (!iter.second.null()) {
  ------------------
  |  Branch (649:21): [True: 323k, False: 37.1k]
  ------------------
  650|   323k|                    p.writeNext();
  651|   323k|                    if (json_version == 1) {
  ------------------
  |  Branch (651:25): [True: 0, False: 323k]
  ------------------
  652|      0|                        p << "\"" << JSON::Writer::encode_string(Name::normalize(iter.first))
  653|      0|                          << "\": ";
  654|   323k|                    } else if (auto res = Name::analyzeJSONEncoding(iter.first); res.first) {
  ------------------
  |  Branch (654:82): [True: 311k, False: 12.2k]
  ------------------
  655|   311k|                        if (res.second) {
  ------------------
  |  Branch (655:29): [True: 307k, False: 3.78k]
  ------------------
  656|   307k|                            p << "\"" << iter.first << "\": ";
  657|   307k|                        } else {
  658|  3.78k|                            p << "\"" << JSON::Writer::encode_string(iter.first) << "\": ";
  659|  3.78k|                        }
  660|   311k|                    } else {
  661|  12.2k|                        p << "\"n:" << JSON::Writer::encode_string(Name::normalize(iter.first))
  662|  12.2k|                          << "\": ";
  663|  12.2k|                    }
  664|   323k|                    iter.second.writeJSON(json_version, p);
  665|   323k|                }
  666|   360k|            }
  667|  80.5k|            p.writeEnd('}');
  668|  80.5k|        }
  669|  80.5k|        break;
  670|      0|    case ::ot_stream:
  ------------------
  |  Branch (670:5): [True: 0, False: 655k]
  ------------------
  671|      0|        std::get<QPDF_Stream>(obj->value).m->stream_dict.writeJSON(json_version, p);
  672|      0|        break;
  673|      0|    case ::ot_reference:
  ------------------
  |  Branch (673:5): [True: 0, False: 655k]
  ------------------
  674|      0|        p << "\"" << obj->og.unparse(' ') << " R\"";
  675|      0|        break;
  676|      0|    default:
  ------------------
  |  Branch (676:5): [True: 0, False: 655k]
  ------------------
  677|      0|        throw std::logic_error("attempted to write an unsuitable object as JSON");
  678|   655k|    }
  679|   655k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  683|  3.68M|{
  684|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  685|  3.68M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (685:9): [True: 3.28M, False: 400k]
  |  Branch (685:24): [True: 454k, False: 2.82M]
  ------------------
  686|   454k|        return;
  687|   454k|    }
  688|       |
  689|  3.22M|    switch (raw_type_code()) {
  690|   167k|    case ::ot_array:
  ------------------
  |  Branch (690:5): [True: 167k, False: 3.06M]
  ------------------
  691|   167k|        {
  692|   167k|            auto& a = std::get<QPDF_Array>(obj->value);
  693|   167k|            if (a.sp) {
  ------------------
  |  Branch (693:17): [True: 716, False: 166k]
  ------------------
  694|  16.3k|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (694:32): [True: 16.3k, False: 716]
  ------------------
  695|  16.3k|                    item.second.disconnect();
  696|  16.3k|                }
  697|   166k|            } else {
  698|  2.04M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (698:30): [True: 2.04M, False: 166k]
  ------------------
  699|  2.04M|                    oh.disconnect();
  700|  2.04M|                }
  701|   166k|            }
  702|   167k|        }
  703|   167k|        break;
  704|   281k|    case ::ot_dictionary:
  ------------------
  |  Branch (704:5): [True: 281k, False: 2.94M]
  ------------------
  705|  1.17M|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (705:24): [True: 1.17M, False: 281k]
  ------------------
  706|  1.17M|            iter.second.disconnect();
  707|  1.17M|        }
  708|   281k|        break;
  709|  45.3k|    case ::ot_stream:
  ------------------
  |  Branch (709:5): [True: 45.3k, False: 3.18M]
  ------------------
  710|  45.3k|        {
  711|  45.3k|            auto& s = std::get<QPDF_Stream>(obj->value);
  712|  45.3k|            s.m->stream_provider = nullptr;
  713|  45.3k|            s.m->stream_dict.disconnect();
  714|  45.3k|        }
  715|  45.3k|        break;
  716|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (716:5): [True: 0, False: 3.22M]
  ------------------
  717|      0|        return;
  718|  2.73M|    default:
  ------------------
  |  Branch (718:5): [True: 2.73M, False: 493k]
  ------------------
  719|  2.73M|        break;
  720|  3.22M|    }
  721|  3.22M|    obj->qpdf = nullptr;
  722|  3.22M|    obj->og = QPDFObjGen();
  723|  3.22M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  727|  7.52k|{
  728|  7.52k|    return obj == rhs.obj;
  729|  7.52k|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  739|  13.2k|{
  740|  13.2k|    static constexpr std::array<char const*, 16> tn{
  741|  13.2k|        "uninitialized",
  742|  13.2k|        "reserved",
  743|  13.2k|        "null",
  744|  13.2k|        "boolean",
  745|  13.2k|        "integer",
  746|  13.2k|        "real",
  747|  13.2k|        "string",
  748|  13.2k|        "name",
  749|  13.2k|        "array",
  750|  13.2k|        "dictionary",
  751|  13.2k|        "stream",
  752|  13.2k|        "operator",
  753|  13.2k|        "inline-image",
  754|  13.2k|        "unresolved",
  755|  13.2k|        "destroyed",
  756|  13.2k|        "reference"};
  757|  13.2k|    return tn[type_code()];
  758|  13.2k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  774|   130k|{
  775|   130k|    return type_code() == ::ot_boolean;
  776|   130k|}
_ZNK16QPDFObjectHandle6isNullEv:
  788|  77.1k|{
  789|  77.1k|    return type_code() == ::ot_null;
  790|  77.1k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  794|   626k|{
  795|   626k|    return type_code() == ::ot_integer;
  796|   626k|}
_ZNK16QPDFObjectHandle6isRealEv:
  800|   335k|{
  801|   335k|    return type_code() == ::ot_real;
  802|   335k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  806|   279k|{
  807|   279k|    return (isInteger() || isReal());
  ------------------
  |  Branch (807:13): [True: 62.7k, False: 216k]
  |  Branch (807:28): [True: 214k, False: 1.82k]
  ------------------
  808|   279k|}
_ZNK16QPDFObjectHandle15getNumericValueEv:
  812|   104k|{
  813|   104k|    if (isInteger()) {
  ------------------
  |  Branch (813:9): [True: 17.4k, False: 87.2k]
  ------------------
  814|  17.4k|        return static_cast<double>(getIntValue());
  815|  87.2k|    } else if (isReal()) {
  ------------------
  |  Branch (815:16): [True: 87.2k, False: 0]
  ------------------
  816|  87.2k|        return atof(getRealValue().c_str());
  817|  87.2k|    } else {
  818|      0|        typeWarning("number", "returning 0");
  819|      0|        QTC::TC("qpdf", "QPDFObjectHandle numeric non-numeric");
  820|      0|        return 0;
  821|      0|    }
  822|   104k|}
_ZNK16QPDFObjectHandle16getValueAsNumberERd:
  826|   104k|{
  827|   104k|    if (!isNumber()) {
  ------------------
  |  Branch (827:9): [True: 181, False: 104k]
  ------------------
  828|    181|        return false;
  829|    181|    }
  830|   104k|    value = getNumericValue();
  831|   104k|    return true;
  832|   104k|}
_ZNK16QPDFObjectHandle6isNameEv:
  836|   132k|{
  837|   132k|    return type_code() == ::ot_name;
  838|   132k|}
_ZNK16QPDFObjectHandle8isStringEv:
  842|  69.3k|{
  843|  69.3k|    return type_code() == ::ot_string;
  844|  69.3k|}
_ZNK16QPDFObjectHandle10isOperatorEv:
  848|  16.8M|{
  849|  16.8M|    return type_code() == ::ot_operator;
  850|  16.8M|}
_ZNK16QPDFObjectHandle7isArrayEv:
  860|   112k|{
  861|   112k|    return type_code() == ::ot_array;
  862|   112k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  866|  1.66M|{
  867|  1.66M|    return type_code() == ::ot_dictionary;
  868|  1.66M|}
_ZNK16QPDFObjectHandle8isStreamEv:
  872|   185k|{
  873|   185k|    return type_code() == ::ot_stream;
  874|   185k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  884|   115k|{
  885|   115k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (885:12): [True: 284, False: 115k]
  |  Branch (885:24): [True: 7.15k, False: 107k]
  |  Branch (885:39): [True: 52.5k, False: 55.4k]
  |  Branch (885:51): [True: 23.8k, False: 31.5k]
  |  Branch (885:63): [True: 1.73k, False: 29.8k]
  |  Branch (885:75): [True: 26.4k, False: 3.41k]
  ------------------
  886|   115k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  890|  8.30k|{
  891|  8.30k|    return Name(*this) == name;
  892|  8.30k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  896|   688k|{
  897|   688k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (897:12): [True: 242k, False: 446k]
  |  Branch (897:31): [True: 90.2k, False: 151k]
  |  Branch (897:47): [True: 30.6k, False: 121k]
  ------------------
  898|   120k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (898:10): [True: 47.9k, False: 72.9k]
  |  Branch (898:29): [True: 65.7k, False: 7.19k]
  ------------------
  899|   688k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  903|   213k|{
  904|   213k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (904:14): [True: 39.3k, False: 173k]
  ------------------
  905|  39.3k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (905:16): [True: 39.3k, False: 0]
  |  Branch (905:27): [True: 7.42k, False: 31.9k]
  |  Branch (905:43): [True: 15.3k, False: 16.5k]
  ------------------
  906|  22.8k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (906:14): [True: 15.3k, False: 7.42k]
  |  Branch (906:33): [True: 512, False: 6.90k]
  ------------------
  907|  39.3k|    }
  908|   173k|    return false;
  909|   213k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  915|  3.16k|{
  916|  3.16k|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (916:14): [True: 3.16k, False: 0]
  ------------------
  917|  3.16k|        return boolean->val;
  918|  3.16k|    } else {
  919|      0|        typeWarning("boolean", "returning false");
  920|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  921|      0|        return false;
  922|      0|    }
  923|  3.16k|}
_ZN4qpdf7IntegerC2Ex:
  938|  28.5k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  939|  28.5k|{
  940|  28.5k|}
_ZN16QPDFObjectHandle10newIntegerEx:
  944|  3.86k|{
  945|  3.86k|    return {QPDFObject::create<QPDF_Integer>(value)};
  946|  3.86k|}
_ZNK4qpdf7Integer5valueEv:
  950|   173k|{
  951|   173k|    auto* i = as<QPDF_Integer>();
  952|   173k|    if (!i) {
  ------------------
  |  Branch (952:9): [True: 1.24k, False: 172k]
  ------------------
  953|  1.24k|        throw invalid_error("Integer");
  954|  1.24k|    }
  955|   172k|    return i->val;
  956|   173k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  960|  57.7k|{
  961|  57.7k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (961:20): [True: 57.7k, False: 0]
  ------------------
  962|  57.7k|        return integer;
  963|  57.7k|    } else {
  964|      0|        typeWarning("integer", "returning 0");
  965|      0|        return 0;
  966|      0|    }
  967|  57.7k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  971|  8.49k|{
  972|  8.49k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (972:20): [True: 8.40k, False: 90]
  ------------------
  973|  8.40k|        value = integer;
  974|  8.40k|        return true;
  975|  8.40k|    }
  976|     90|    return false;
  977|  8.49k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  981|  49.9k|{
  982|  49.9k|    try {
  983|  49.9k|        return Integer(*this).value<int>();
  984|  49.9k|    } catch (std::invalid_argument&) {
  985|     12|        typeWarning("integer", "returning 0");
  986|     12|        return 0;
  987|     12|    }
  988|  49.9k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
  992|  1.20k|{
  993|  1.20k|    if (!isInteger()) {
  ------------------
  |  Branch (993:9): [True: 23, False: 1.17k]
  ------------------
  994|     23|        return false;
  995|     23|    }
  996|  1.17k|    value = getIntValueAsInt();
  997|  1.17k|    return true;
  998|  1.20k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1002|  28.5k|{
 1003|  28.5k|    try {
 1004|  28.5k|        return Integer(*this).value<unsigned long long>();
 1005|  28.5k|    } catch (std::invalid_argument&) {
 1006|    801|        typeWarning("integer", "returning 0");
 1007|    801|        return 0;
 1008|    801|    }
 1009|  28.5k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1023|  7.62k|{
 1024|  7.62k|    try {
 1025|  7.62k|        return Integer(*this).value<unsigned int>();
 1026|  7.62k|    } catch (std::invalid_argument&) {
 1027|    428|        typeWarning("integer", "returning 0");
 1028|    428|        return 0;
 1029|    428|    }
 1030|  7.62k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1034|  1.32k|{
 1035|  1.32k|    if (!isInteger()) {
  ------------------
  |  Branch (1035:9): [True: 122, False: 1.20k]
  ------------------
 1036|    122|        return false;
 1037|    122|    }
 1038|  1.20k|    value = getUIntValueAsUInt();
 1039|  1.20k|    return true;
 1040|  1.32k|}
_ZNK16QPDFObjectHandle12getRealValueEv:
 1046|  87.2k|{
 1047|  87.2k|    if (auto* real = as<QPDF_Real>()) {
  ------------------
  |  Branch (1047:15): [True: 87.2k, False: 0]
  ------------------
 1048|  87.2k|        return real->val;
 1049|  87.2k|    }
 1050|      0|    typeWarning("real", "returning 0.0");
 1051|      0|    return "0.0";
 1052|  87.2k|}
_ZN16QPDFObjectHandle7newNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1068|  6.55k|{
 1069|  6.55k|    return {QPDFObject::create<QPDF_Name>(name)};
 1070|  6.55k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1078|  41.5k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1079|  41.5k|{
 1080|  41.5k|}
_ZNK4qpdf4Name5valueEv:
 1084|   300k|{
 1085|   300k|    auto* n = as<QPDF_Name>();
 1086|   300k|    if (!n) {
  ------------------
  |  Branch (1086:9): [True: 0, False: 300k]
  ------------------
 1087|      0|        throw invalid_error("Name");
 1088|      0|    }
 1089|   300k|    return n->name;
 1090|   300k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1094|  31.8k|{
 1095|  31.8k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1095:15): [True: 29.5k, False: 2.26k]
  ------------------
 1096|  29.5k|        return name->name;
 1097|  29.5k|    }
 1098|  2.26k|    typeWarning("name", "returning dummy name");
 1099|  2.26k|    return "/QPDFFakeName";
 1100|  31.8k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1116|  20.6k|{
 1117|  20.6k|    return {QPDFObject::create<QPDF_String>(str)};
 1118|  20.6k|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1122|  1.38k|{
 1123|  1.38k|    return {String::utf16(utf8_str).obj_sp()};
 1124|  1.38k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1127|    803|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1128|    803|{
 1129|    803|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1132|    580|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1133|    580|{
 1134|    580|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1138|  1.38k|{
 1139|  1.38k|    std::string result;
 1140|  1.38k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1140:9): [True: 803, False: 580]
  ------------------
 1141|    803|        return String(result);
 1142|    803|    }
 1143|    580|    return String(QUtil::utf8_to_utf16(utf8_str));
 1144|  1.38k|}
_ZNK4qpdf6String5valueEv:
 1148|  5.37k|{
 1149|  5.37k|    auto* s = as<QPDF_String>();
 1150|  5.37k|    if (!s) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 5.37k]
  ------------------
 1151|      0|        throw invalid_error("String");
 1152|      0|    }
 1153|  5.37k|    return s->val;
 1154|  5.37k|}
_ZNK4qpdf6String10utf8_valueEv:
 1158|   469k|{
 1159|   469k|    auto* s = as<QPDF_String>();
 1160|   469k|    if (!s) {
  ------------------
  |  Branch (1160:9): [True: 0, False: 469k]
  ------------------
 1161|      0|        throw invalid_error("String");
 1162|      0|    }
 1163|   469k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1163:9): [True: 35.6k, False: 433k]
  ------------------
 1164|  35.6k|        return QUtil::utf16_to_utf8(s->val);
 1165|  35.6k|    }
 1166|   433k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1166:9): [True: 2.12k, False: 431k]
  ------------------
 1167|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1168|       |        // of U+FEFF.
 1169|  2.12k|        return s->val.substr(3);
 1170|  2.12k|    }
 1171|   431k|    return QUtil::pdf_doc_to_utf8(s->val);
 1172|   433k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1176|  5.37k|{
 1177|  5.37k|    try {
 1178|  5.37k|        return String(obj).value();
 1179|  5.37k|    } catch (std::invalid_argument&) {
 1180|      0|        typeWarning("string", "returning empty string");
 1181|      0|        return {};
 1182|      0|    }
 1183|  5.37k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1198|   425k|{
 1199|   425k|    try {
 1200|   425k|        return String(obj).utf8_value();
 1201|   425k|    } catch (std::invalid_argument&) {
 1202|      0|        typeWarning("string", "returning empty string");
 1203|      0|        return {};
 1204|      0|    }
 1205|   425k|}
_ZNK16QPDFObjectHandle16getOperatorValueEv:
 1222|  16.7M|{
 1223|  16.7M|    if (auto* op = as<QPDF_Operator>()) {
  ------------------
  |  Branch (1223:15): [True: 16.7M, False: 0]
  ------------------
 1224|  16.7M|        return op->val;
 1225|  16.7M|    }
 1226|      0|    typeWarning("operator", "returning fake value");
 1227|      0|    return "QPDFFAKE";
 1228|  16.7M|}
_ZN16QPDFObjectHandle6aitemsEv:
 1264|  5.19k|{
 1265|  5.19k|    return *this;
 1266|  5.19k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1280|  4.00k|{
 1281|  4.00k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1281:9): [True: 1.94k, False: 2.05k]
  ------------------
 1282|  1.94k|        return true;
 1283|  2.05k|    } else if (isArray()) {
  ------------------
  |  Branch (1283:16): [True: 794, False: 1.26k]
  ------------------
 1284|  4.24k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1284:24): [True: 4.24k, False: 778]
  ------------------
 1285|  4.24k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1285:17): [True: 16, False: 4.22k]
  ------------------
 1286|     16|                return true;
 1287|     16|            }
 1288|  4.24k|        }
 1289|    794|    }
 1290|  2.04k|    return false;
 1291|  4.00k|}
_ZN16QPDFObjectHandle14mergeResourcesES_PNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_S7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEES9_NS5_INSA_ISB_SE_EEEEEE:
 1308|  19.3k|{
 1309|  19.3k|    if (!(isDictionary() && other.isDictionary())) {
  ------------------
  |  Branch (1309:11): [True: 16.1k, False: 3.22k]
  |  Branch (1309:29): [True: 13.4k, False: 2.62k]
  ------------------
 1310|  5.85k|        QTC::TC("qpdf", "QPDFObjectHandle merge top type mismatch");
 1311|  5.85k|        return;
 1312|  5.85k|    }
 1313|       |
 1314|  13.4k|    auto make_og_to_name = [](QPDFObjectHandle& dict,
 1315|  13.4k|                              std::map<QPDFObjGen, std::string>& og_to_name) {
 1316|  13.4k|        for (auto const& [key, value]: dict.as_dictionary()) {
 1317|  13.4k|            if (!value.null() && value.isIndirect()) {
 1318|  13.4k|                og_to_name.insert_or_assign(value.getObjGen(), key);
 1319|  13.4k|            }
 1320|  13.4k|        }
 1321|  13.4k|    };
 1322|       |
 1323|       |    // This algorithm is described in comments in QPDFObjectHandle.hh
 1324|       |    // above the declaration of mergeResources.
 1325|  29.1k|    for (auto const& [rtype, value1]: other.as_dictionary()) {
  ------------------
  |  Branch (1325:37): [True: 29.1k, False: 13.4k]
  ------------------
 1326|  29.1k|        auto other_val = value1;
 1327|  29.1k|        if (hasKey(rtype)) {
  ------------------
  |  Branch (1327:13): [True: 15.1k, False: 13.9k]
  ------------------
 1328|  15.1k|            QPDFObjectHandle this_val = getKey(rtype);
 1329|  15.1k|            if (this_val.isDictionary() && other_val.isDictionary()) {
  ------------------
  |  Branch (1329:17): [True: 9.85k, False: 5.34k]
  |  Branch (1329:44): [True: 8.82k, False: 1.03k]
  ------------------
 1330|  8.82k|                if (this_val.isIndirect()) {
  ------------------
  |  Branch (1330:21): [True: 1.40k, False: 7.41k]
  ------------------
 1331|       |                    // Do this even if there are no keys. Various places in the code call
 1332|       |                    // mergeResources with resource dictionaries that contain empty subdictionaries
 1333|       |                    // just to get this shallow copy functionality.
 1334|  1.40k|                    QTC::TC("qpdf", "QPDFObjectHandle replace with copy");
 1335|  1.40k|                    this_val = replaceKeyAndGetNew(rtype, this_val.shallowCopy());
 1336|  1.40k|                }
 1337|  8.82k|                std::map<QPDFObjGen, std::string> og_to_name;
 1338|  8.82k|                std::set<std::string> rnames;
 1339|  8.82k|                int min_suffix = 1;
 1340|  8.82k|                bool initialized_maps = false;
 1341|  34.3k|                for (auto const& [key, value2]: other_val.as_dictionary()) {
  ------------------
  |  Branch (1341:47): [True: 34.3k, False: 8.82k]
  ------------------
 1342|  34.3k|                    QPDFObjectHandle rval = value2;
 1343|  34.3k|                    if (!this_val.hasKey(key)) {
  ------------------
  |  Branch (1343:25): [True: 21.4k, False: 12.8k]
  ------------------
 1344|  21.4k|                        if (!rval.isIndirect()) {
  ------------------
  |  Branch (1344:29): [True: 11.3k, False: 10.1k]
  ------------------
 1345|  11.3k|                            QTC::TC("qpdf", "QPDFObjectHandle merge shallow copy");
 1346|  11.3k|                            rval = rval.shallowCopy();
 1347|  11.3k|                        }
 1348|  21.4k|                        this_val.replaceKey(key, rval);
 1349|  21.4k|                    } else if (conflicts) {
  ------------------
  |  Branch (1349:32): [True: 0, False: 12.8k]
  ------------------
 1350|      0|                        if (!initialized_maps) {
  ------------------
  |  Branch (1350:29): [True: 0, False: 0]
  ------------------
 1351|      0|                            make_og_to_name(this_val, og_to_name);
 1352|      0|                            rnames = this_val.getResourceNames();
 1353|      0|                            initialized_maps = true;
 1354|      0|                        }
 1355|      0|                        auto rval_og = rval.getObjGen();
 1356|      0|                        if (rval.isIndirect() && og_to_name.contains(rval_og)) {
  ------------------
  |  Branch (1356:29): [True: 0, False: 0]
  |  Branch (1356:50): [True: 0, False: 0]
  ------------------
 1357|      0|                            QTC::TC("qpdf", "QPDFObjectHandle merge reuse");
 1358|      0|                            auto new_key = og_to_name[rval_og];
 1359|      0|                            if (new_key != key) {
  ------------------
  |  Branch (1359:33): [True: 0, False: 0]
  ------------------
 1360|      0|                                (*conflicts)[rtype][key] = new_key;
 1361|      0|                            }
 1362|      0|                        } else {
 1363|      0|                            QTC::TC("qpdf", "QPDFObjectHandle merge generate");
 1364|      0|                            std::string new_key =
 1365|      0|                                getUniqueResourceName(key + "_", min_suffix, &rnames);
 1366|      0|                            (*conflicts)[rtype][key] = new_key;
 1367|      0|                            this_val.replaceKey(new_key, rval);
 1368|      0|                        }
 1369|      0|                    }
 1370|  34.3k|                }
 1371|  8.82k|            } else if (this_val.isArray() && other_val.isArray()) {
  ------------------
  |  Branch (1371:24): [True: 2.69k, False: 3.68k]
  |  Branch (1371:46): [True: 2.59k, False: 97]
  ------------------
 1372|  2.59k|                std::set<std::string> scalars;
 1373|  67.9k|                for (auto this_item: this_val.aitems()) {
  ------------------
  |  Branch (1373:36): [True: 67.9k, False: 2.59k]
  ------------------
 1374|  67.9k|                    if (this_item.isScalar()) {
  ------------------
  |  Branch (1374:25): [True: 66.9k, False: 1.02k]
  ------------------
 1375|  66.9k|                        scalars.insert(this_item.unparse());
 1376|  66.9k|                    }
 1377|  67.9k|                }
 1378|  45.6k|                for (auto other_item: other_val.aitems()) {
  ------------------
  |  Branch (1378:37): [True: 45.6k, False: 2.59k]
  ------------------
 1379|  45.6k|                    if (other_item.isScalar()) {
  ------------------
  |  Branch (1379:25): [True: 43.9k, False: 1.67k]
  ------------------
 1380|  43.9k|                        if (!scalars.contains(other_item.unparse())) {
  ------------------
  |  Branch (1380:29): [True: 10.6k, False: 33.3k]
  ------------------
 1381|  10.6k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array");
 1382|  10.6k|                            this_val.appendItem(other_item);
 1383|  33.3k|                        } else {
 1384|  33.3k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array dup");
 1385|  33.3k|                        }
 1386|  43.9k|                    }
 1387|  45.6k|                }
 1388|  2.59k|            }
 1389|  15.1k|        } else {
 1390|  13.9k|            QTC::TC("qpdf", "QPDFObjectHandle merge copy from other");
 1391|  13.9k|            replaceKey(rtype, other_val.shallowCopy());
 1392|  13.9k|        }
 1393|  29.1k|    }
 1394|  13.4k|}
_ZNK16QPDFObjectHandle16getResourceNamesEv:
 1398|  10.5k|{
 1399|       |    // Return second-level dictionary keys
 1400|  10.5k|    std::set<std::string> result;
 1401|  27.2k|    for (auto const& item: as_dictionary(strict)) {
  ------------------
  |  Branch (1401:26): [True: 27.2k, False: 10.5k]
  ------------------
 1402|   140k|        for (auto const& [key2, val2]: item.second.as_dictionary(strict)) {
  ------------------
  |  Branch (1402:38): [True: 140k, False: 27.2k]
  ------------------
 1403|   140k|            if (!val2.null()) {
  ------------------
  |  Branch (1403:17): [True: 108k, False: 32.0k]
  ------------------
 1404|   108k|                result.insert(key2);
 1405|   108k|            }
 1406|   140k|        }
 1407|  27.2k|    }
 1408|  10.5k|    return result;
 1409|  10.5k|}
_ZNK16QPDFObjectHandle21getUniqueResourceNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiPNS0_3setIS6_NS0_4lessIS6_EENS4_IS6_EEEE:
 1414|  10.5k|{
 1415|  10.5k|    std::set<std::string> names = (namesp ? *namesp : getResourceNames());
  ------------------
  |  Branch (1415:36): [True: 0, False: 10.5k]
  ------------------
 1416|  10.5k|    int max_suffix = min_suffix + QIntC::to_int(names.size());
 1417|  10.5k|    while (min_suffix <= max_suffix) {
  ------------------
  |  Branch (1417:12): [True: 10.5k, False: 0]
  ------------------
 1418|  10.5k|        std::string candidate = prefix + std::to_string(min_suffix);
 1419|  10.5k|        if (!names.contains(candidate)) {
  ------------------
  |  Branch (1419:13): [True: 10.5k, False: 10]
  ------------------
 1420|  10.5k|            return candidate;
 1421|  10.5k|        }
 1422|       |        // Increment after return; min_suffix should be the value
 1423|       |        // used, not the next value.
 1424|     10|        ++min_suffix;
 1425|     10|    }
 1426|       |    // This could only happen if there is a coding error.
 1427|       |    // The number of candidates we test is more than the
 1428|       |    // number of keys we're checking against.
 1429|      0|    throw std::logic_error(
 1430|      0|        "unable to find unconflicting name in QPDFObjectHandle::getUniqueResourceName");
 1431|  10.5k|}
_ZN16QPDFObjectHandle26arrayOrStreamToStreamArrayERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_:
 1446|  33.4k|{
 1447|  33.4k|    all_description = description;
 1448|  33.4k|    std::vector<QPDFObjectHandle> result;
 1449|  33.4k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (1449:14): [True: 7.93k, False: 25.4k]
  ------------------
 1450|  7.93k|        int n_items = static_cast<int>(array.size());
 1451|  69.5k|        for (int i = 0; i < n_items; ++i) {
  ------------------
  |  Branch (1451:25): [True: 61.6k, False: 7.93k]
  ------------------
 1452|  61.6k|            QPDFObjectHandle item = array[i];
 1453|  61.6k|            if (item.isStream()) {
  ------------------
  |  Branch (1453:17): [True: 24.7k, False: 36.8k]
  ------------------
 1454|  24.7k|                result.emplace_back(item);
 1455|  36.8k|            } else {
 1456|  36.8k|                item.warn(
 1457|  36.8k|                    {qpdf_e_damaged_pdf,
 1458|  36.8k|                     "",
 1459|  36.8k|                     description + ": item index " + std::to_string(i) + " (from 0)",
 1460|  36.8k|                     0,
 1461|  36.8k|                     "ignoring non-stream in an array of streams"});
 1462|  36.8k|            }
 1463|  61.6k|        }
 1464|  25.4k|    } else if (isStream()) {
  ------------------
  |  Branch (1464:16): [True: 6.99k, False: 18.4k]
  ------------------
 1465|  6.99k|        result.emplace_back(*this);
 1466|  18.4k|    } else if (!null()) {
  ------------------
  |  Branch (1466:16): [True: 665, False: 17.8k]
  ------------------
 1467|    665|        warn(
 1468|    665|            {qpdf_e_damaged_pdf,
 1469|    665|             "",
 1470|    665|             description,
 1471|    665|             0,
 1472|    665|             " object is supposed to be a stream or an array of streams but is neither"});
 1473|    665|    }
 1474|       |
 1475|  33.4k|    bool first = true;
 1476|  33.4k|    for (auto const& item: result) {
  ------------------
  |  Branch (1476:26): [True: 31.7k, False: 33.4k]
  ------------------
 1477|  31.7k|        if (first) {
  ------------------
  |  Branch (1477:13): [True: 13.9k, False: 17.8k]
  ------------------
 1478|  13.9k|            first = false;
 1479|  17.8k|        } else {
 1480|  17.8k|            all_description += ",";
 1481|  17.8k|        }
 1482|  31.7k|        all_description += " stream " + item.getObjGen().unparse(' ');
 1483|  31.7k|    }
 1484|       |
 1485|  33.4k|    return result;
 1486|  33.4k|}
_ZN16QPDFObjectHandle15getPageContentsEv:
 1490|  6.52k|{
 1491|  6.52k|    std::string description = "page object " + getObjGen().unparse(' ');
 1492|  6.52k|    std::string all_description;
 1493|  6.52k|    return getKey("/Contents").arrayOrStreamToStreamArray(description, all_description);
 1494|  6.52k|}
_ZN16QPDFObjectHandle15addPageContentsES_b:
 1498|  6.52k|{
 1499|  6.52k|    new_contents.assertStream();
 1500|       |
 1501|  6.52k|    std::vector<QPDFObjectHandle> content_streams;
 1502|  6.52k|    if (first) {
  ------------------
  |  Branch (1502:9): [True: 3.26k, False: 3.25k]
  ------------------
 1503|  3.26k|        QTC::TC("qpdf", "QPDFObjectHandle prepend page contents");
 1504|  3.26k|        content_streams.push_back(new_contents);
 1505|  3.26k|    }
 1506|  6.52k|    for (auto const& iter: getPageContents()) {
  ------------------
  |  Branch (1506:26): [True: 3.93k, False: 6.52k]
  ------------------
 1507|  3.93k|        QTC::TC("qpdf", "QPDFObjectHandle append page contents");
 1508|  3.93k|        content_streams.push_back(iter);
 1509|  3.93k|    }
 1510|  6.52k|    if (!first) {
  ------------------
  |  Branch (1510:9): [True: 3.25k, False: 3.26k]
  ------------------
 1511|  3.25k|        content_streams.push_back(new_contents);
 1512|  3.25k|    }
 1513|       |
 1514|  6.52k|    replaceKey("/Contents", newArray(content_streams));
 1515|  6.52k|}
_ZN16QPDFObjectHandle22coalesceContentStreamsEv:
 1552|  22.2k|{
 1553|  22.2k|    QPDFObjectHandle contents = getKey("/Contents");
 1554|  22.2k|    if (contents.isStream()) {
  ------------------
  |  Branch (1554:9): [True: 2.28k, False: 19.9k]
  ------------------
 1555|  2.28k|        QTC::TC("qpdf", "QPDFObjectHandle coalesce called on stream");
 1556|  2.28k|        return;
 1557|  19.9k|    } else if (!contents.isArray()) {
  ------------------
  |  Branch (1557:16): [True: 15.3k, False: 4.63k]
  ------------------
 1558|       |        // /Contents is optional for pages, and some very damaged files may have pages that are
 1559|       |        // invalid in other ways.
 1560|  15.3k|        return;
 1561|  15.3k|    }
 1562|       |    // Should not be possible for a page object to not have an owning PDF unless it was manually
 1563|       |    // constructed in some incorrect way. However, it can happen in a PDF file whose page structure
 1564|       |    // is direct, which is against spec but still possible to hand construct, as in fuzz issue
 1565|       |    // 27393.
 1566|  4.63k|    QPDF& qpdf = getQPDF("coalesceContentStreams called on object  with no associated PDF file");
 1567|       |
 1568|  4.63k|    QPDFObjectHandle new_contents = newStream(&qpdf);
 1569|  4.63k|    replaceKey("/Contents", new_contents);
 1570|       |
 1571|  4.63k|    auto provider = std::shared_ptr<StreamDataProvider>(new CoalesceProvider(*this, contents));
 1572|  4.63k|    new_contents.replaceStreamData(provider, newNull(), newNull());
 1573|  4.63k|}
_ZNK16QPDFObjectHandle7unparseEv:
 1577|   131k|{
 1578|   131k|    if (isIndirect()) {
  ------------------
  |  Branch (1578:9): [True: 2.06k, False: 129k]
  ------------------
 1579|  2.06k|        return getObjGen().unparse(' ') + " R";
 1580|   129k|    } else {
 1581|   129k|        return unparseResolved();
 1582|   129k|    }
 1583|   131k|}
_ZNK16QPDFObjectHandle15unparseResolvedEv:
 1587|   129k|{
 1588|   129k|    if (!obj) {
  ------------------
  |  Branch (1588:9): [True: 0, False: 129k]
  ------------------
 1589|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1590|      0|    }
 1591|   129k|    return BaseHandle::unparse();
 1592|   129k|}
_ZNK16QPDFObjectHandle7getJSONEib:
 1606|  19.6k|{
 1607|  19.6k|    if ((!dereference_indirect) && isIndirect()) {
  ------------------
  |  Branch (1607:9): [True: 0, False: 19.6k]
  |  Branch (1607:36): [True: 0, False: 0]
  ------------------
 1608|      0|        return JSON::makeString(unparse());
 1609|  19.6k|    } else if (!obj) {
  ------------------
  |  Branch (1609:16): [True: 0, False: 19.6k]
  ------------------
 1610|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1611|  19.6k|    } else {
 1612|  19.6k|        Pl_Buffer p{"json"};
 1613|  19.6k|        JSON::Writer jw{&p, 0};
 1614|  19.6k|        writeJSON(json_version, jw, dereference_indirect);
 1615|  19.6k|        p.finish();
 1616|  19.6k|        return JSON::parse(p.getString());
 1617|  19.6k|    }
 1618|  19.6k|}
_ZNK16QPDFObjectHandle9writeJSONEiRN4JSON6WriterEb:
 1622|   343k|{
 1623|   343k|    if (!dereference_indirect && isIndirect()) {
  ------------------
  |  Branch (1623:9): [True: 323k, False: 19.6k]
  |  Branch (1623:34): [True: 30.3k, False: 293k]
  ------------------
 1624|  30.3k|        p << "\"" << getObjGen().unparse(' ') << " R\"";
 1625|   312k|    } else if (!obj) {
  ------------------
  |  Branch (1625:16): [True: 0, False: 312k]
  ------------------
 1626|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1627|   312k|    } else {
 1628|   312k|        write_json(json_version, p);
 1629|   312k|    }
 1630|   343k|}
_ZN16QPDFObjectHandle18pipeContentStreamsEP8PipelineRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERS8_:
 1690|  26.8k|{
 1691|  26.8k|    bool need_newline = false;
 1692|  26.8k|    std::string buffer;
 1693|  26.8k|    pl::String buf(buffer);
 1694|  27.1k|    for (auto stream: arrayOrStreamToStreamArray(description, all_description)) {
  ------------------
  |  Branch (1694:21): [True: 27.1k, False: 26.0k]
  ------------------
 1695|  27.1k|        if (need_newline) {
  ------------------
  |  Branch (1695:13): [True: 7.83k, False: 19.3k]
  ------------------
 1696|  7.83k|            buf.writeCStr("\n");
 1697|  7.83k|        }
 1698|  27.1k|        if (!stream.pipeStreamData(&buf, 0, qpdf_dl_specialized)) {
  ------------------
  |  Branch (1698:13): [True: 799, False: 26.3k]
  ------------------
 1699|    799|            QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent");
 1700|    799|            throw QPDFExc(
 1701|    799|                qpdf_e_damaged_pdf,
 1702|    799|                "content stream",
 1703|    799|                "content stream object " + stream.getObjGen().unparse(' '),
 1704|    799|                0,
 1705|    799|                "errors while decoding content stream");
 1706|    799|        }
 1707|  26.3k|        need_newline = buffer.empty() || buffer.back() != '\n';
  ------------------
  |  Branch (1707:24): [True: 3.83k, False: 22.5k]
  |  Branch (1707:42): [True: 6.33k, False: 16.1k]
  ------------------
 1708|  26.3k|        QTC::TC("qpdf", "QPDFObjectHandle need_newline", need_newline ? 0 : 1);
  ------------------
  |  Branch (1708:58): [True: 9.44k, False: 16.9k]
  ------------------
 1709|  26.3k|        p->writeString(buffer);
 1710|  26.3k|        buffer.clear();
 1711|  26.3k|    }
 1712|  26.0k|    p->finish();
 1713|  26.0k|}
_ZN16QPDFObjectHandle17parsePageContentsEPNS_15ParserCallbacksE:
 1717|  22.2k|{
 1718|  22.2k|    std::string description = "page object " + getObjGen().unparse(' ');
 1719|  22.2k|    getKey("/Contents").parseContentStream_internal(description, callbacks);
 1720|  22.2k|}
_ZN16QPDFObjectHandle27parseContentStream_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_15ParserCallbacksE:
 1754|  22.2k|{
 1755|  22.2k|    std::string stream_data;
 1756|  22.2k|    pl::String buf(stream_data);
 1757|  22.2k|    std::string all_description;
 1758|  22.2k|    pipeContentStreams(&buf, description, all_description);
 1759|  22.2k|    if (callbacks) {
  ------------------
  |  Branch (1759:9): [True: 0, False: 22.2k]
  ------------------
 1760|      0|        callbacks->contentSize(stream_data.size());
 1761|      0|    }
 1762|  22.2k|    try {
 1763|  22.2k|        parseContentStream_data(stream_data, all_description, callbacks, getOwningQPDF());
 1764|  22.2k|    } catch (TerminateParsing&) {
 1765|      0|        return;
 1766|      0|    }
 1767|  20.6k|    if (callbacks) {
  ------------------
  |  Branch (1767:9): [True: 0, False: 20.6k]
  ------------------
 1768|      0|        callbacks->handleEOF();
 1769|      0|    }
 1770|  20.6k|}
_ZN16QPDFObjectHandle23parseContentStream_dataENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERKNS0_12basic_stringIcS3_NS0_9allocatorIcEEEEPNS_15ParserCallbacksEP4QPDF:
 1778|  20.6k|{
 1779|  20.6k|    size_t stream_length = stream_data.size();
 1780|  20.6k|    auto input = is::OffsetBuffer(description, stream_data);
 1781|  20.6k|    Tokenizer tokenizer;
 1782|  20.6k|    tokenizer.allowEOF();
 1783|  20.6k|    auto max_bad_count = Limits::parser_max_errors();
 1784|  20.6k|    auto sp_description = Parser::make_description(description, "content");
 1785|  16.8M|    while (QIntC::to_size(input.tell()) < stream_length) {
  ------------------
  |  Branch (1785:12): [True: 16.8M, False: 16.3k]
  ------------------
 1786|       |        // Read a token and seek to the beginning. The offset we get from this process is the
 1787|       |        // beginning of the next non-ignorable (space, comment) token. This way, the offset and
 1788|       |        // don't including ignorable content.
 1789|  16.8M|        tokenizer.nextToken(input, "content", true);
 1790|  16.8M|        qpdf_offset_t offset = input.getLastOffset();
 1791|  16.8M|        input.seek(offset, SEEK_SET);
 1792|  16.8M|        auto [obj, empty] = Parser::parse_content(input, sp_description, tokenizer, context);
 1793|  16.8M|        if (empty) {
  ------------------
  |  Branch (1793:13): [True: 4.14k, False: 16.8M]
  ------------------
 1794|       |            // EOF
 1795|  4.14k|            return;
 1796|  4.14k|        }
 1797|  16.8M|        if (!obj) {
  ------------------
  |  Branch (1797:13): [True: 4.71k, False: 16.8M]
  ------------------
 1798|  4.71k|            if (max_bad_count && --max_bad_count == 0) {
  ------------------
  |  Branch (1798:17): [True: 4.71k, False: 0]
  |  Branch (1798:34): [True: 171, False: 4.54k]
  ------------------
 1799|    171|                Limits::error();
 1800|    171|                warn(
 1801|    171|                    context,
 1802|    171|                    {qpdf_e_damaged_pdf,
 1803|    171|                     description,
 1804|    171|                     "stream data",
 1805|    171|                     input.tell(),
 1806|    171|                     "limits error(parser-max-errors): too many errors during content stream "
 1807|    171|                     "parsing"});
 1808|    171|                return;
 1809|    171|            }
 1810|  4.54k|            obj = newNull();
 1811|  4.54k|        }
 1812|  16.8M|        size_t length = QIntC::to_size(input.tell() - offset);
 1813|  16.8M|        if (callbacks) {
  ------------------
  |  Branch (1813:13): [True: 0, False: 16.8M]
  ------------------
 1814|      0|            callbacks->handleObject(obj, QIntC::to_size(offset), length);
 1815|      0|        }
 1816|  16.8M|        if (obj.isOperator() && obj.getOperatorValue() == "ID") {
  ------------------
  |  Branch (1816:13): [True: 16.7M, False: 171k]
  |  Branch (1816:13): [True: 1.91k, False: 16.8M]
  |  Branch (1816:33): [True: 1.91k, False: 16.7M]
  ------------------
 1817|       |            // Discard next character; it is the space after ID that terminated the token.  Read
 1818|       |            // until end of inline image.
 1819|  1.91k|            char ch;
 1820|  1.91k|            input.read(&ch, 1);
 1821|  1.91k|            tokenizer.expectInlineImage(input);
 1822|  1.91k|            tokenizer.nextToken(input, description);
 1823|  1.91k|            offset = input.getLastOffset();
 1824|  1.91k|            length = QIntC::to_size(input.tell() - offset);
 1825|  1.91k|            if (tokenizer.getType() == QPDFTokenizer::tt_bad) {
  ------------------
  |  Branch (1825:17): [True: 94, False: 1.82k]
  ------------------
 1826|     94|                QTC::TC("qpdf", "QPDFObjectHandle EOF in inline image");
 1827|     94|                warn(
 1828|     94|                    context,
 1829|     94|                    {qpdf_e_damaged_pdf,
 1830|     94|                     description,
 1831|     94|                     "stream data",
 1832|     94|                     input.tell(),
 1833|     94|                     "EOF found while reading inline image"});
 1834|  1.82k|            } else {
 1835|  1.82k|                QTC::TC("qpdf", "QPDFObjectHandle inline image token");
 1836|  1.82k|                if (callbacks) {
  ------------------
  |  Branch (1836:21): [True: 0, False: 1.82k]
  ------------------
 1837|      0|                    callbacks->handleObject(
 1838|      0|                        QPDFObjectHandle::newInlineImage(tokenizer.getValue()),
 1839|      0|                        QIntC::to_size(offset),
 1840|      0|                        length);
 1841|      0|                }
 1842|  1.82k|            }
 1843|  1.91k|        }
 1844|  16.8M|    }
 1845|  20.6k|}
_ZN16QPDFObjectHandle7newNullEv:
 1886|  65.6k|{
 1887|  65.6k|    return {QPDFObject::create<QPDF_Null>()};
 1888|  65.6k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1898|  58.4k|{
 1899|  58.4k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1900|  58.4k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1922|  21.6k|{
 1923|  21.6k|    return {QPDFObject::create<QPDF_Array>(items)};
 1924|  21.6k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1928|  14.6k|{
 1929|  14.6k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1930|  14.6k|}
_ZN16QPDFObjectHandle16newFromRectangleERKNS_9RectangleE:
 1958|  4.39k|{
 1959|  4.39k|    return newArray(rect);
 1960|  4.39k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1976|  17.4k|{
 1977|  17.4k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1978|  17.4k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1982|  17.4k|{
 1983|  17.4k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1984|  17.4k|}
_ZN16QPDFObjectHandle9newStreamEP4QPDF:
 1988|  4.63k|{
 1989|  4.63k|    if (qpdf == nullptr) {
  ------------------
  |  Branch (1989:9): [True: 0, False: 4.63k]
  ------------------
 1990|      0|        throw std::runtime_error("attempt to create stream in null qpdf object");
 1991|      0|    }
 1992|  4.63k|    QTC::TC("qpdf", "QPDFObjectHandle newStream");
 1993|  4.63k|    return qpdf->newStream();
 1994|  4.63k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2027|   178k|{
 2028|   178k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2028:12): [True: 178k, False: 0]
  ------------------
 2029|   178k|}
_ZN16QPDFObjectHandle20setObjectDescriptionEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2033|  20.3k|{
 2034|  20.3k|    if (obj) {
  ------------------
  |  Branch (2034:9): [True: 20.3k, False: 0]
  ------------------
 2035|  20.3k|        auto descr = std::make_shared<QPDFObject::Description>(object_description);
 2036|  20.3k|        obj->setDescription(owning_qpdf, descr);
 2037|  20.3k|    }
 2038|  20.3k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2042|  57.0k|{
 2043|  57.0k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2043:12): [True: 57.0k, False: 0]
  |  Branch (2043:19): [True: 36.6k, False: 20.3k]
  ------------------
 2044|  57.0k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2048|  41.8k|{
 2049|  41.8k|    if (!obj) {
  ------------------
  |  Branch (2049:9): [True: 0, False: 41.8k]
  ------------------
 2050|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2051|      0|    }
 2052|  41.8k|    return {copy()};
 2053|  41.8k|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2128|  1.24k|{
 2129|  1.24k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2130|  1.24k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2140|  13.2k|{
 2141|  13.2k|    return {
 2142|  13.2k|        qpdf_e_object,
 2143|  13.2k|        "",
 2144|  13.2k|        description(),
 2145|  13.2k|        0,
 2146|  13.2k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2147|  13.2k|            message};
 2148|  13.2k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2152|  13.2k|{
 2153|  13.2k|    if (!obj) {
  ------------------
  |  Branch (2153:9): [True: 0, False: 13.2k]
  ------------------
 2154|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2155|      0|    }
 2156|  13.2k|    warn(type_error(expected_type, message));
 2157|  13.2k|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2173|  6.52k|{
 2174|  6.52k|    if (!istype) {
  ------------------
  |  Branch (2174:9): [True: 0, False: 6.52k]
  ------------------
 2175|      0|        throw type_error(type_name);
 2176|      0|    }
 2177|  6.52k|}
_ZNK16QPDFObjectHandle12assertStreamEv:
 2241|  6.52k|{
 2242|  6.52k|    assertType("stream", isStream());
 2243|  6.52k|}
_ZNK16QPDFObjectHandle13isFormXObjectEv:
 2296|  85.9k|{
 2297|  85.9k|    return isStreamOfType("", "/Form");
 2298|  85.9k|}
_ZNK16QPDFObjectHandle7isImageEb:
 2302|  10.5k|{
 2303|  10.5k|    return (
 2304|  10.5k|        isStreamOfType("", "/Image") &&
  ------------------
  |  Branch (2304:9): [True: 512, False: 10.0k]
  ------------------
 2305|    512|        ((!exclude_imagemask) ||
  ------------------
  |  Branch (2305:10): [True: 0, False: 512]
  ------------------
 2306|    512|         (!(getDict().getKey("/ImageMask").isBool() &&
  ------------------
  |  Branch (2306:13): [True: 66, False: 446]
  ------------------
 2307|     66|            getDict().getKey("/ImageMask").getBoolValue()))));
  ------------------
  |  Branch (2307:13): [True: 66, False: 0]
  ------------------
 2308|  10.5k|}
_ZN4qpdf10BaseHandle4warnEP4QPDFO7QPDFExc:
 2320|    265|{
 2321|    265|    if (!qpdf) {
  ------------------
  |  Branch (2321:9): [True: 0, False: 265]
  ------------------
 2322|      0|        throw std::move(e);
 2323|      0|    }
 2324|    265|    qpdf->warn(std::move(e));
 2325|    265|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2329|   216k|{
 2330|   216k|    if (!qpdf()) {
  ------------------
  |  Branch (2330:9): [True: 912, False: 215k]
  ------------------
 2331|    912|        throw std::move(e);
 2332|    912|    }
 2333|   215k|    qpdf()->warn(std::move(e));
 2334|   215k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2338|   187k|{
 2339|   187k|    if (qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 165k, False: 21.9k]
  ------------------
 2340|   165k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2341|   165k|    } else {
 2342|  21.9k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2343|  21.9k|    }
 2344|   187k|}
_ZN16QPDFObjectHandle14QPDFArrayItemsC2ERKS_:
 2432|  5.19k|    oh(oh)
 2433|  5.19k|{
 2434|  5.19k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorppEv:
 2438|   113k|{
 2439|   113k|    if (!m->is_end) {
  ------------------
  |  Branch (2439:9): [True: 113k, False: 0]
  ------------------
 2440|   113k|        ++m->item_number;
 2441|   113k|        updateIValue();
 2442|   113k|    }
 2443|   113k|    return *this;
 2444|   113k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratordeEv:
 2458|   113k|{
 2459|   113k|    updateIValue();
 2460|   113k|    return ivalue;
 2461|   113k|}
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratoreqERKS1_:
 2472|   118k|{
 2473|   118k|    return (m->item_number == other.m->item_number);
 2474|   118k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorC2ERS_b:
 2477|  10.3k|    m(new Members(oh, for_begin))
 2478|  10.3k|{
 2479|  10.3k|    updateIValue();
 2480|  10.3k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator12updateIValueEv:
 2484|   237k|{
 2485|   237k|    m->is_end = (m->item_number >= m->oh.getArrayNItems());
 2486|   237k|    if (m->is_end) {
  ------------------
  |  Branch (2486:9): [True: 10.3k, False: 227k]
  ------------------
 2487|  10.3k|        ivalue = QPDFObjectHandle();
 2488|   227k|    } else {
 2489|   227k|        ivalue = m->oh.getArrayItem(m->item_number);
 2490|   227k|    }
 2491|   237k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator7MembersC2ERS_b:
 2494|  10.3k|    oh(oh)
 2495|  10.3k|{
 2496|  10.3k|    item_number = for_begin ? 0 : oh.getArrayNItems();
  ------------------
  |  Branch (2496:19): [True: 5.19k, False: 5.19k]
  ------------------
 2497|  10.3k|}
_ZN16QPDFObjectHandle14QPDFArrayItems5beginEv:
 2501|  5.19k|{
 2502|  5.19k|    return {oh, true};
 2503|  5.19k|}
_ZN16QPDFObjectHandle14QPDFArrayItems3endEv:
 2507|  5.19k|{
 2508|  5.19k|    return {oh, false};
 2509|  5.19k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2513|   754k|{
 2514|   754k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2514:12): [True: 754k, False: 0]
  ------------------
 2515|   754k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2519|   561k|{
 2520|   561k|    return getObjGen().getObj();
 2521|   561k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2531|   551k|{
 2532|   551k|    return getObjectID() != 0;
 2533|   551k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2538|   387k|{
 2539|   387k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2539:12): [True: 387k, False: 0]
  ------------------
 2540|   387k|}
_ZNK16QPDFObjectHandle7getQPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2544|  4.63k|{
 2545|  4.63k|    if (auto result = obj ? obj->getQPDF() : nullptr) {
  ------------------
  |  Branch (2545:14): [True: 4.63k, False: 0]
  ------------------
 2546|  4.63k|        return *result;
 2547|  4.63k|    }
 2548|      0|    throw std::runtime_error(error_msg.empty() ? "attempt to use a null qpdf object" : error_msg);
  ------------------
  |  Branch (2548:30): [True: 0, False: 0]
  ------------------
 2549|  4.63k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2553|     15|{
 2554|     15|    if (obj) {
  ------------------
  |  Branch (2554:9): [True: 15, False: 0]
  ------------------
 2555|     15|        obj->setParsedOffset(offset);
 2556|     15|    }
 2557|     15|}
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderC2E16QPDFObjectHandleS1_:
   95|  4.63k|            containing_page(containing_page),
   96|  4.63k|            old_contents(old_contents)
   97|  4.63k|        {
   98|  4.63k|        }
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderD2Ev:
   99|  4.63k|        ~CoalesceProvider() override = default;
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProvider17provideStreamDataERK10QPDFObjGenP8Pipeline:
  110|  4.63k|{
  111|  4.63k|    QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data");
  112|  4.63k|    std::string description = "page object " + containing_page.getObjGen().unparse(' ');
  113|  4.63k|    std::string all_description;
  114|  4.63k|    old_contents.pipeContentStreams(p, description, all_description);
  115|  4.63k|}

_ZN16QPDFObjectHelperD2Ev:
    4|   421k|QPDFObjectHelper::~QPDFObjectHelper() = default;

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  4.93k|{
   24|  4.93k|    return !dh.m->seen.add(og);
   25|  4.93k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  9.75k|    QPDFDocumentHelper(qpdf),
   29|  9.75k|    m(std::make_shared<Members>())
   30|  9.75k|{
   31|  9.75k|    validate();
   32|  9.75k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  9.75k|{
   43|  9.75k|    m->outlines.clear();
   44|  9.75k|    m->names_dest = nullptr;
   45|       |
   46|  9.75k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  9.75k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 8.87k, False: 874]
  ------------------
   48|  8.87k|        return;
   49|  8.87k|    }
   50|    874|    auto outlines = root.getKey("/Outlines");
   51|    874|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 29, False: 845]
  |  Branch (51:11): [True: 859, False: 15]
  |  Branch (51:38): [True: 845, False: 14]
  ------------------
   52|     29|        return;
   53|     29|    }
   54|    845|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|    845|    QPDFObjGen::set seen;
   56|  2.47k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 1.74k, False: 726]
  ------------------
   57|  1.74k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 119, False: 1.62k]
  ------------------
   58|    119|            cur.warn("Loop detected loop in /Outlines tree");
   59|    119|            return;
   60|    119|        }
   61|  1.62k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  1.62k|        cur = cur.getKey("/Next");
   63|  1.62k|    }
   64|    845|}
_ZN25QPDFOutlineDocumentHelper16initializeByPageEv:
   80|  19.3k|{
   81|  19.3k|    std::list<QPDFOutlineObjectHelper> queue;
   82|  19.3k|    queue.insert(queue.end(), m->outlines.begin(), m->outlines.end());
   83|       |
   84|  24.6k|    while (!queue.empty()) {
  ------------------
  |  Branch (84:12): [True: 5.35k, False: 19.3k]
  ------------------
   85|  5.35k|        QPDFOutlineObjectHelper oh = queue.front();
   86|  5.35k|        queue.pop_front();
   87|  5.35k|        m->by_page[oh.getDestPage().getObjGen()].push_back(oh);
   88|  5.35k|        std::vector<QPDFOutlineObjectHelper> kids = oh.getKids();
   89|  5.35k|        queue.insert(queue.end(), kids.begin(), kids.end());
   90|  5.35k|    }
   91|  19.3k|}
_ZN25QPDFOutlineDocumentHelper18getOutlinesForPageE10QPDFObjGen:
   95|  19.6k|{
   96|  19.6k|    if (m->by_page.empty()) {
  ------------------
  |  Branch (96:9): [True: 19.3k, False: 309]
  ------------------
   97|  19.3k|        initializeByPage();
   98|  19.3k|    }
   99|  19.6k|    if (m->by_page.contains(og)) {
  ------------------
  |  Branch (99:9): [True: 94, False: 19.5k]
  ------------------
  100|     94|        return m->by_page[og];
  101|     94|    }
  102|  19.5k|    return {};
  103|  19.6k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  1.95k|{
  108|  1.95k|    QPDFObjectHandle result;
  109|  1.95k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 184, False: 1.77k]
  ------------------
  110|    184|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 84, False: 100]
  ------------------
  111|     84|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     84|        }
  113|    184|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  1.77k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 1.77k, False: 0]
  ------------------
  115|  1.77k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 843, False: 930]
  ------------------
  116|    843|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|    843|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 624, False: 219]
  ------------------
  118|    624|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|    624|                    dests,
  120|    624|                    qpdf,
  121|    624|                    [](QPDFObjectHandle const& o) -> bool {
  122|    624|                        return o.isArray() || o.contains("/D");
  123|    624|                    },
  124|    624|                    true);
  125|    624|                m->names_dest->validate();
  126|    624|            }
  127|    843|        }
  128|  1.77k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 1.38k, False: 390]
  ------------------
  129|  1.38k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 117, False: 1.26k]
  ------------------
  130|    117|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    117|            }
  132|  1.38k|        }
  133|  1.77k|    }
  134|  1.95k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 1.00k, False: 955]
  ------------------
  135|  1.00k|        return QPDFObjectHandle::newNull();
  136|  1.00k|    }
  137|    955|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 107, False: 848]
  ------------------
  138|    107|        return result.getKey("/D");
  139|    107|    }
  140|    848|    return result;
  141|    955|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  9.75k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  9.75k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|  64.7k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  64.7k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 60.3k, False: 4.41k]
  |  Branch (122:47): [True: 3.42k, False: 996]
  ------------------
  123|  64.7k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  4.93k|    dh(dh)
    9|  4.93k|{
   10|  4.93k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  4.93k|    QPDFObjectHelper(a_oh),
   15|  4.93k|    m(new Members(dh))
   16|  4.93k|{
   17|  4.93k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 4.93k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  4.93k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 2.47k, False: 2.46k]
  ------------------
   23|  2.47k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  2.47k|        return;
   25|  2.47k|    }
   26|       |
   27|  2.46k|    QPDFObjGen::set children;
   28|  2.46k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  5.77k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 3.59k, False: 2.17k]
  |  Branch (29:27): [True: 3.53k, False: 65]
  ------------------
   30|  3.53k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 225, False: 3.30k]
  ------------------
   31|    225|            cur.warn("Loop detected loop in /Outlines tree");
   32|    225|            break;
   33|    225|        }
   34|  3.30k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  3.30k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  3.30k|        m->kids.emplace_back(new_ooh);
   37|  3.30k|        cur = cur.getKey("/Next");
   38|  3.30k|    }
   39|  2.46k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  4.70k|{
   50|  4.70k|    return m->kids;
   51|  4.70k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  5.35k|{
   56|  5.35k|    auto dest = get("/Dest");
   57|  5.35k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 4.10k, False: 1.25k]
  ------------------
   58|  4.10k|        auto const& A = get("/A");
   59|  4.10k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 1.64k, False: 2.45k]
  ------------------
   60|  1.64k|            dest = A["/D"];
   61|  1.64k|        }
   62|  4.10k|    }
   63|  5.35k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 2.49k, False: 2.85k]
  ------------------
   64|  2.49k|        return QPDFObjectHandle::newNull();
   65|  2.49k|    }
   66|  2.85k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 184, False: 2.67k]
  |  Branch (66:26): [True: 1.77k, False: 901]
  ------------------
   67|  1.95k|        return m->dh.resolveNamedDest(dest);
   68|  1.95k|    }
   69|    901|    return dest;
   70|  2.85k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  5.35k|{
   75|  5.35k|    QPDFObjectHandle dest = getDest();
   76|  5.35k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.02k, False: 4.33k]
  |  Branch (76:26): [True: 974, False: 52]
  ------------------
   77|    974|        return dest.getArrayItem(0);
   78|    974|    }
   79|  4.38k|    return QPDFObjectHandle::newNull();
   80|  5.35k|}

_ZN27QPDFPageLabelDocumentHelperC2ER4QPDF:
   20|  9.83k|    QPDFDocumentHelper(qpdf),
   21|  9.83k|    m(std::make_shared<Members>())
   22|  9.83k|{
   23|  9.83k|    validate();
   24|  9.83k|}
_ZN27QPDFPageLabelDocumentHelper8validateEb:
   34|  9.83k|{
   35|  9.83k|    m->labels = nullptr;
   36|  9.83k|    if (Dictionary labels = qpdf.getRoot()["/PageLabels"]) {
  ------------------
  |  Branch (36:20): [True: 788, False: 9.04k]
  ------------------
   37|    788|        m->labels = std::make_unique<QPDFNumberTreeObjectHelper>(
   38|    788|            labels, qpdf, [](QPDFObjectHandle const& o) -> bool { return o.isDictionary(); }, true);
   39|    788|        m->labels->validate(repair);
   40|    788|    }
   41|  9.83k|}
_ZN27QPDFPageLabelDocumentHelper13hasPageLabelsEv:
   45|  20.6k|{
   46|  20.6k|    return m->labels != nullptr;
   47|  20.6k|}
_ZN27QPDFPageLabelDocumentHelper15getLabelForPageEx:
   51|  20.6k|{
   52|  20.6k|    if (!hasPageLabels()) {
  ------------------
  |  Branch (52:9): [True: 17.8k, False: 2.86k]
  ------------------
   53|  17.8k|        return QPDFObjectHandle::newNull();
   54|  17.8k|    }
   55|  2.86k|    QPDFNumberTreeObjectHelper::numtree_number offset = 0;
   56|  2.86k|    QPDFObjectHandle label;
   57|  2.86k|    if (!m->labels->findObjectAtOrBelow(page_idx, label, offset)) {
  ------------------
  |  Branch (57:9): [True: 823, False: 2.04k]
  ------------------
   58|    823|        return QPDFObjectHandle::newNull();
   59|    823|    }
   60|  2.04k|    QPDFObjectHandle S = label.getKey("/S");   // type (D, R, r, A, a)
   61|  2.04k|    QPDFObjectHandle P = label.getKey("/P");   // prefix
   62|  2.04k|    QPDFObjectHandle St = label.getKey("/St"); // starting number
   63|  2.04k|    long long start = 1;
   64|  2.04k|    if (St.isInteger()) {
  ------------------
  |  Branch (64:9): [True: 258, False: 1.78k]
  ------------------
   65|    258|        start = St.getIntValue();
   66|    258|    }
   67|  2.04k|    QIntC::range_check(start, offset);
   68|  2.04k|    start += offset;
   69|  2.04k|    auto result = QPDFObjectHandle::newDictionary();
   70|  2.04k|    result.replaceKey("/S", S);
   71|  2.04k|    result.replaceKey("/P", P);
   72|  2.04k|    result.replaceKey("/St", QPDFObjectHandle::newInteger(start));
   73|  2.04k|    return result;
   74|  2.86k|}
_ZN27QPDFPageLabelDocumentHelper7MembersC2Ev:
   12|  9.83k|    Members() = default;
_ZN27QPDFPageLabelDocumentHelper7MembersD2Ev:
   14|  9.83k|    ~Members() = default;
QPDFPageLabelDocumentHelper.cc:_ZZN27QPDFPageLabelDocumentHelper8validateEbENK3$_0clERK16QPDFObjectHandle:
   38|  12.1k|            labels, qpdf, [](QPDFObjectHandle const& o) -> bool { return o.isDictionary(); }, true);

_ZN20QPDFPageObjectHelperC2E16QPDFObjectHandle:
  219|  56.1k|    QPDFObjectHelper(oh)
  220|  56.1k|{
  221|  56.1k|}
_ZN20QPDFPageObjectHelper12getAttributeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  225|  42.9k|{
  226|  42.9k|    return getAttribute(name, copy_if_shared, nullptr, false);
  227|  42.9k|}
_ZN20QPDFPageObjectHelper12getAttributeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEbNS0_8functionIF16QPDFObjectHandlevEEEb:
  235|  42.9k|{
  236|  42.9k|    const bool is_form_xobject = oh().isFormXObject();
  237|  42.9k|    bool inherited = false;
  238|  42.9k|    auto dict = is_form_xobject ? oh().getDict() : oh();
  ------------------
  |  Branch (238:17): [True: 0, False: 42.9k]
  ------------------
  239|  42.9k|    auto result = dict.getKey(name);
  240|       |
  241|  42.9k|    if (!is_form_xobject && result.null() &&
  ------------------
  |  Branch (241:9): [True: 42.9k, False: 1]
  |  Branch (241:29): [True: 963, False: 42.0k]
  ------------------
  242|    963|        (name == "/MediaBox" || name == "/CropBox" || name == "/Resources" || name == "/Rotate")) {
  ------------------
  |  Branch (242:10): [True: 0, False: 963]
  |  Branch (242:33): [True: 0, False: 963]
  |  Branch (242:55): [True: 963, False: 0]
  |  Branch (242:79): [True: 0, False: 0]
  ------------------
  243|    963|        QPDFObjectHandle node = dict;
  244|    963|        QPDFObjGen::set seen{};
  245|  1.51k|        while (seen.add(node) && node.hasKey("/Parent")) {
  ------------------
  |  Branch (245:16): [True: 1.45k, False: 63]
  |  Branch (245:16): [True: 739, False: 776]
  |  Branch (245:34): [True: 739, False: 713]
  ------------------
  246|    739|            node = node.getKey("/Parent");
  247|    739|            result = node.getKey(name);
  248|    739|            if (!result.null()) {
  ------------------
  |  Branch (248:17): [True: 187, False: 552]
  ------------------
  249|    187|                inherited = true;
  250|    187|                break;
  251|    187|            }
  252|    739|        }
  253|    963|    }
  254|  42.9k|    if (copy_if_shared && (inherited || result.isIndirect())) {
  ------------------
  |  Branch (254:9): [True: 22.2k, False: 20.6k]
  |  Branch (254:28): [True: 187, False: 22.0k]
  |  Branch (254:41): [True: 6.95k, False: 15.1k]
  ------------------
  255|  7.14k|        QTC::TC("qpdf", "QPDFPageObjectHelper copy shared attribute", is_form_xobject ? 0 : 1);
  ------------------
  |  Branch (255:71): [True: 0, False: 7.14k]
  ------------------
  256|  7.14k|        result = dict.replaceKeyAndGetNew(name, result.shallowCopy());
  257|  7.14k|    }
  258|  42.9k|    if (result.null() && get_fallback) {
  ------------------
  |  Branch (258:9): [True: 776, False: 42.1k]
  |  Branch (258:26): [True: 0, False: 776]
  ------------------
  259|      0|        result = get_fallback();
  260|      0|        if (copy_if_fallback && !result.null()) {
  ------------------
  |  Branch (260:13): [True: 0, False: 0]
  |  Branch (260:33): [True: 0, False: 0]
  ------------------
  261|      0|            result = dict.replaceKeyAndGetNew(name, result.shallowCopy());
  262|      0|        } else {
  263|      0|            QTC::TC("qpdf", "QPDFPageObjectHelper used fallback without copying");
  264|      0|        }
  265|      0|    }
  266|  42.9k|    return result;
  267|  42.9k|}
_ZN20QPDFPageObjectHelper14forEachXObjectEbNSt3__18functionIFvR16QPDFObjectHandleS3_RKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEENS1_IFbS2_EEE:
  327|  20.6k|{
  328|  20.6k|    QTC::TC(
  329|  20.6k|        "qpdf",
  330|  20.6k|        "QPDFPageObjectHelper::forEachXObject",
  331|  20.6k|        recursive ? (oh().isFormXObject() ? 0 : 1) : (oh().isFormXObject() ? 2 : 3));
  ------------------
  |  Branch (331:9): [True: 0, False: 20.6k]
  |  Branch (331:22): [True: 0, False: 0]
  |  Branch (331:55): [True: 0, False: 20.6k]
  ------------------
  332|  20.6k|    QPDFObjGen::set seen;
  333|  20.6k|    std::list<QPDFPageObjectHelper> queue;
  334|  20.6k|    queue.emplace_back(*this);
  335|  41.3k|    while (!queue.empty()) {
  ------------------
  |  Branch (335:12): [True: 20.6k, False: 20.6k]
  ------------------
  336|  20.6k|        auto& ph = queue.front();
  337|  20.6k|        if (seen.add(ph)) {
  ------------------
  |  Branch (337:13): [True: 20.6k, False: 0]
  ------------------
  338|  20.6k|            auto xobj_dict = ph.getAttribute("/Resources", false).getKeyIfDict("/XObject");
  339|  22.1k|            for (auto const& [key, value]: xobj_dict.as_dictionary()) {
  ------------------
  |  Branch (339:42): [True: 22.1k, False: 20.6k]
  ------------------
  340|  22.1k|                if (value.null()) {
  ------------------
  |  Branch (340:21): [True: 11.5k, False: 10.5k]
  ------------------
  341|  11.5k|                    continue;
  342|  11.5k|                }
  343|  10.5k|                auto obj = value;
  344|  10.5k|                if ((!selector) || selector(obj)) {
  ------------------
  |  Branch (344:21): [True: 0, False: 10.5k]
  |  Branch (344:21): [True: 446, False: 10.1k]
  |  Branch (344:36): [True: 446, False: 10.1k]
  ------------------
  345|    446|                    action(obj, xobj_dict, key);
  346|    446|                }
  347|  10.5k|                if (recursive && obj.isFormXObject()) {
  ------------------
  |  Branch (347:21): [True: 0, False: 10.5k]
  |  Branch (347:34): [True: 0, False: 0]
  ------------------
  348|      0|                    queue.emplace_back(obj);
  349|      0|                }
  350|  10.5k|            }
  351|  20.6k|        }
  352|  20.6k|        queue.pop_front();
  353|  20.6k|    }
  354|  20.6k|}
_ZN20QPDFPageObjectHelper12forEachImageEbNSt3__18functionIFvR16QPDFObjectHandleS3_RKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEE:
  361|  20.6k|{
  362|  20.6k|    forEachXObject(recursive, action, [](QPDFObjectHandle obj) { return obj.isImage(); });
  363|  20.6k|}
_ZN20QPDFPageObjectHelper9getImagesEv:
  382|  20.6k|{
  383|  20.6k|    std::map<std::string, QPDFObjectHandle> result;
  384|  20.6k|    forEachImage(
  385|  20.6k|        false, [&result](QPDFObjectHandle& obj, QPDFObjectHandle&, std::string const& key) {
  386|  20.6k|            result[key] = obj;
  387|  20.6k|        });
  388|  20.6k|    return result;
  389|  20.6k|}
_ZN20QPDFPageObjectHelper14getAnnotationsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  444|  52.8k|{
  445|  52.8k|    std::vector<QPDFAnnotationObjectHelper> result;
  446|   283k|    for (auto const& annot: oh().getKey("/Annots").as_array()) {
  ------------------
  |  Branch (446:27): [True: 283k, False: 52.8k]
  ------------------
  447|   283k|        if (annot.isDictionaryOfType("", only_subtype)) {
  ------------------
  |  Branch (447:13): [True: 59.5k, False: 223k]
  ------------------
  448|  59.5k|            result.emplace_back(annot);
  449|  59.5k|        }
  450|   283k|    }
  451|  52.8k|    return result;
  452|  52.8k|}
_ZN20QPDFPageObjectHelper15addPageContentsE16QPDFObjectHandleb:
  462|  6.52k|{
  463|  6.52k|    oh().addPageContents(contents, first);
  464|  6.52k|}
_ZN20QPDFPageObjectHelper22coalesceContentStreamsEv:
  474|  22.2k|{
  475|  22.2k|    oh().coalesceContentStreams();
  476|  22.2k|}
_ZN20QPDFPageObjectHelper13parseContentsEPN16QPDFObjectHandle15ParserCallbacksE:
  486|  22.2k|{
  487|  22.2k|    if (oh().isFormXObject()) {
  ------------------
  |  Branch (487:9): [True: 0, False: 22.2k]
  ------------------
  488|      0|        oh().parseAsContents(callbacks);
  489|  22.2k|    } else {
  490|  22.2k|        oh().parsePageContents(callbacks);
  491|  22.2k|    }
  492|  22.2k|}
QPDFPageObjectHelper.cc:_ZZN20QPDFPageObjectHelper12forEachImageEbNSt3__18functionIFvR16QPDFObjectHandleS3_RKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEEENK3$_0clES2_:
  362|  10.5k|    forEachXObject(recursive, action, [](QPDFObjectHandle obj) { return obj.isImage(); });
QPDFPageObjectHelper.cc:_ZZN20QPDFPageObjectHelper9getImagesEvENK3$_0clER16QPDFObjectHandleS2_RKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  385|    446|        false, [&result](QPDFObjectHandle& obj, QPDFObjectHandle&, std::string const& key) {
  386|    446|            result[key] = obj;
  387|    446|        });

_ZN4qpdf4impl6Parser13parse_contentER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERNS_9TokenizerEP4QPDF:
   75|  16.8M|{
   76|  16.8M|    static const std::string content("content"); // GCC12 - make constexpr
   77|  16.8M|    auto p = Parser(
   78|  16.8M|        input,
   79|  16.8M|        std::move(sp_description),
   80|  16.8M|        content,
   81|  16.8M|        tokenizer,
   82|  16.8M|        nullptr,
   83|  16.8M|        context,
   84|  16.8M|        true,
   85|  16.8M|        0,
   86|  16.8M|        0,
   87|  16.8M|        context && context->doc().reconstructed_xref());
  ------------------
  |  Branch (87:9): [True: 16.8M, False: 0]
  |  Branch (87:20): [True: 16.8M, False: 3.71k]
  ------------------
   88|  16.8M|    if (auto result = p.parse(true)) {
  ------------------
  |  Branch (88:14): [True: 16.8M, False: 8.86k]
  ------------------
   89|  16.8M|        return {result, false};
   90|  16.8M|    }
   91|  8.86k|    return {{}, p.empty_};
   92|  16.8M|}
_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   173k|{
  130|   173k|    return Parser(
  131|   173k|               input,
  132|   173k|               make_description(input.getName(), object_description),
  133|   173k|               object_description,
  134|   173k|               tokenizer,
  135|   173k|               decrypter,
  136|   173k|               &context,
  137|   173k|               true,
  138|   173k|               0,
  139|   173k|               0,
  140|   173k|               sanity_checks)
  141|   173k|        .parse();
  142|   173k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  20.8k|{
  148|  20.8k|    return Parser(
  149|  20.8k|               input,
  150|  20.8k|               std::make_shared<QPDFObject::Description>(
  151|  20.8k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  20.8k|               "",
  153|  20.8k|               tokenizer,
  154|  20.8k|               nullptr,
  155|  20.8k|               &context,
  156|  20.8k|               true,
  157|  20.8k|               stream_id,
  158|  20.8k|               obj_id)
  159|  20.8k|        .parse();
  160|  20.8k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|  17.0M|{
  165|  17.0M|    try {
  166|  17.0M|        return parse_first(content_stream);
  167|  17.0M|    } catch (Error&) {
  168|  10.6k|        return {};
  169|  10.6k|    } catch (QPDFExc& e) {
  170|  5.03k|        throw e;
  171|  5.03k|    } catch (std::logic_error& e) {
  172|      3|        throw e;
  173|  1.74k|    } catch (std::exception& e) {
  174|  1.74k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.74k|        return {};
  176|  1.74k|    }
  177|  17.0M|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|  17.0M|{
  182|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  183|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  184|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  185|       |    // logic error to be thrown from QPDF::inParse().
  186|       |
  187|  17.0M|    QPDF::Doc::ParseGuard pg(context_);
  188|  17.0M|    start_ = input_.tell();
  189|  17.0M|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 4.43k, False: 17.0M]
  ------------------
  190|  4.43k|        warn(tokenizer_.getErrorMessage());
  191|  4.43k|    }
  192|       |
  193|  17.0M|    switch (tokenizer_.getType()) {
  194|  4.56k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 4.56k, False: 17.0M]
  ------------------
  195|  4.56k|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 4.14k, False: 418]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|  4.14k|            empty_ = true;
  198|  4.14k|            return {};
  199|  4.14k|        }
  200|    418|        warn("unexpected EOF");
  201|    418|        return {};
  202|       |
  203|  4.26k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 4.26k, False: 17.0M]
  ------------------
  204|  4.26k|        return {};
  205|       |
  206|    318|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 318, False: 17.0M]
  ------------------
  207|    631|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 313, False: 17.0M]
  ------------------
  208|    631|        warn("treating unexpected brace token as null");
  209|    631|        return {};
  210|       |
  211|    901|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 901, False: 17.0M]
  ------------------
  212|    901|        warn("treating unexpected array close token as null");
  213|    901|        return {};
  214|       |
  215|    675|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 675, False: 17.0M]
  ------------------
  216|    675|        warn("unexpected dictionary close token");
  217|    675|        return {};
  218|       |
  219|  16.0k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 16.0k, False: 17.0M]
  ------------------
  220|   177k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 161k, False: 16.9M]
  ------------------
  221|   177k|        stack_.clear();
  222|   177k|        stack_.emplace_back(
  223|   177k|            input_,
  224|   177k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 16.0k, False: 161k]
  ------------------
  225|   177k|        frame_ = &stack_.back();
  226|   177k|        return parse_remainder(content_stream);
  227|       |
  228|  2.01k|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 2.01k, False: 17.0M]
  ------------------
  229|  2.01k|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    622|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 622, False: 17.0M]
  ------------------
  232|    622|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  97.3k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 97.3k, False: 16.9M]
  ------------------
  235|  97.3k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|  41.5k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 41.5k, False: 17.0M]
  ------------------
  238|  41.5k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  29.9k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 29.9k, False: 17.0M]
  ------------------
  241|  29.9k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  16.7M|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 16.7M, False: 363k]
  ------------------
  244|  16.7M|        {
  245|  16.7M|            auto const& value = tokenizer_.getValue();
  246|  16.7M|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 16.7M, False: 7.21k]
  ------------------
  247|  16.7M|                return with_description<QPDF_Operator>(value);
  248|  16.7M|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 151, False: 7.06k]
  ------------------
  249|       |                // We just saw endobj without having read anything. Nothing in the PDF spec appears
  250|       |                // to allow empty objects, but they have been encountered in actual PDF files and
  251|       |                // Adobe Reader appears to ignore them. Treat this as a null and do not move the
  252|       |                // input source's offset.
  253|    151|                empty_ = true;
  254|    151|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    151|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 151, False: 0]
  ------------------
  256|    151|                    warn("empty object treated as null");
  257|    151|                }
  258|    151|                return {};
  259|  7.06k|            } else {
  260|  7.06k|                warn("unknown token while reading object; treating as string");
  261|  7.06k|                return with_description<QPDF_String>(value);
  262|  7.06k|            }
  263|  16.7M|        }
  264|       |
  265|  3.06k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 3.06k, False: 17.0M]
  ------------------
  266|  3.06k|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 188, False: 2.87k]
  ------------------
  267|    188|            std::string s{tokenizer_.getValue()};
  268|    188|            decrypter_->decryptString(s);
  269|    188|            return with_description<QPDF_String>(s);
  270|  2.87k|        } else {
  271|  2.87k|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|  2.87k|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 17.0M]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|  17.0M|    }
  278|  17.0M|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   177k|{
  283|       |    // This method must take care not to resolve any objects. Don't check the type of any object
  284|       |    // without first ensuring that it is a direct object. Otherwise, doing so may have the side
  285|       |    // effect of reading the object and changing the file pointer. If you do this, it will cause a
  286|       |    // logic error to be thrown from QPDF::inParse().
  287|       |
  288|   177k|    bad_count_ = 0;
  289|   177k|    bool b_contents = false;
  290|       |
  291|  9.58M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 9.57M, Folded]
  ------------------
  292|  9.57M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 54.9k, False: 9.52M]
  ------------------
  293|  54.9k|            warn(tokenizer_.getErrorMessage());
  294|  54.9k|        }
  295|  9.57M|        ++good_count_; // optimistically
  296|       |
  297|  9.57M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 3.49M, False: 6.08M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  3.49M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 2.65M, False: 839k]
  ------------------
  301|  2.65M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 2.06M, False: 588k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  2.06M|                    add_int(int_count_);
  304|  2.06M|                }
  305|  2.65M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  2.65M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  2.65M|                continue;
  308|       |
  309|  2.65M|            } else if (
  310|   839k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 588k, False: 251k]
  |  Branch (310:36): [True: 527k, False: 60.6k]
  ------------------
  311|   527k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 501k, False: 25.5k]
  ------------------
  312|   501k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 501k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   501k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   501k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   501k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 2.43k, False: 499k]
  |  Branch (319:33): [True: 332, False: 499k]
  |  Branch (319:44): [True: 347, False: 498k]
  ------------------
  320|   498k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   498k|                } else {
  322|  3.11k|                    add_bad_null(
  323|  3.11k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  3.11k|                        std::to_string(gen) + " R) as null");
  325|  3.11k|                }
  326|   501k|                int_count_ = 0;
  327|   501k|                continue;
  328|       |
  329|   501k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 337k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   337k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 86.1k, False: 251k]
  ------------------
  332|  86.1k|                    add_int(int_count_ - 1);
  333|  86.1k|                }
  334|   337k|                add_int(int_count_);
  335|   337k|                int_count_ = 0;
  336|   337k|            }
  337|  3.49M|        }
  338|       |
  339|  6.41M|        switch (tokenizer_.getType()) {
  340|  7.97k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.97k, False: 6.41M]
  ------------------
  341|  7.97k|            warn("parse error while reading object");
  342|  7.97k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 226, False: 7.75k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|    226|                return {};
  345|    226|            }
  346|  7.75k|            warn("unexpected EOF");
  347|  7.75k|            return {};
  348|       |
  349|  46.3k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 46.3k, False: 6.37M]
  ------------------
  350|  46.3k|            check_too_many_bad_tokens();
  351|  46.3k|            add_null();
  352|  46.3k|            continue;
  353|       |
  354|  2.42k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 2.42k, False: 6.41M]
  ------------------
  355|  5.86k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 3.43k, False: 6.41M]
  ------------------
  356|  5.86k|            add_bad_null("treating unexpected brace token as null");
  357|  5.86k|            continue;
  358|       |
  359|   148k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 148k, False: 6.27M]
  ------------------
  360|   148k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 145k, False: 2.92k]
  ------------------
  361|   145k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 412, False: 145k]
  ------------------
  362|   145k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|   145k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|   145k|                set_description(object, frame_->offset - 1);
  365|       |                // The `offset` points to the next of "[".  Set the rewind offset to point to the
  366|       |                // beginning of "[". This has been explicitly tested with whitespace surrounding the
  367|       |                // array start delimiter. getLastOffset points to the array end token and therefore
  368|       |                // can't be used here.
  369|   145k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 7.02k, False: 138k]
  ------------------
  370|  7.02k|                    return object;
  371|  7.02k|                }
  372|   138k|                stack_.pop_back();
  373|   138k|                frame_ = &stack_.back();
  374|   138k|                add(std::move(object));
  375|   138k|            } else {
  376|  2.92k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 2.05k, False: 863]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  2.05k|                    warn("unexpected array close token; giving up on reading object");
  380|  2.05k|                    return {};
  381|  2.05k|                }
  382|    863|                add_bad_null("treating unexpected array close token as null");
  383|    863|            }
  384|   139k|            continue;
  385|       |
  386|   235k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 235k, False: 6.18M]
  ------------------
  387|   235k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 232k, False: 2.99k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   232k|                auto& dict = frame_->dict;
  390|       |
  391|   232k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 14.4k, False: 217k]
  ------------------
  392|  14.4k|                    warn(
  393|  14.4k|                        frame_->offset,
  394|  14.4k|                        "dictionary ended prematurely; using null as value for last key");
  395|  14.4k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  14.4k|                }
  397|   232k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 71.4k, False: 160k]
  ------------------
  398|  71.4k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 65.2k, False: 6.18k]
  ------------------
  399|  65.2k|                        warn(
  400|  65.2k|                            frame_->offset,
  401|  65.2k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  65.2k|                    } else {
  403|  6.18k|                        fix_missing_keys();
  404|  6.18k|                    }
  405|  71.4k|                }
  406|       |
  407|   232k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 92, False: 232k]
  |  Branch (407:21): [True: 15, False: 232k]
  |  Branch (407:57): [True: 57, False: 35]
  ------------------
  408|     57|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 25, False: 32]
  |  Branch (408:62): [True: 15, False: 10]
  ------------------
  409|     15|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 15, False: 0]
  |  Branch (409:51): [True: 15, False: 0]
  ------------------
  410|     15|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     15|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     15|                }
  413|   232k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   232k|                set_description(object, frame_->offset - 2);
  415|       |                // The `offset` points to the next of "<<". Set the rewind offset to point to the
  416|       |                // beginning of "<<". This has been explicitly tested with whitespace surrounding
  417|       |                // the dictionary start delimiter. getLastOffset points to the dictionary end token
  418|       |                // and therefore can't be used here.
  419|   232k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 139k, False: 93.1k]
  ------------------
  420|   139k|                    return object;
  421|   139k|                }
  422|  93.1k|                stack_.pop_back();
  423|  93.1k|                frame_ = &stack_.back();
  424|  93.1k|                add(std::move(object));
  425|  93.1k|            } else {
  426|  2.99k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 2.55k, False: 434]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|  2.55k|                    warn("unexpected dictionary close token; giving up on reading object");
  430|  2.55k|                    return {};
  431|  2.55k|                }
  432|    434|                add_bad_null("unexpected dictionary close token");
  433|    434|            }
  434|  93.6k|            continue;
  435|       |
  436|   225k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 225k, False: 6.19M]
  ------------------
  437|   349k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 123k, False: 6.29M]
  ------------------
  438|   349k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 87, False: 349k]
  ------------------
  439|     87|                limits_error(
  440|     87|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     87|            }
  442|   349k|            b_contents = false;
  443|   349k|            stack_.emplace_back(
  444|   349k|                input_,
  445|   349k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 225k, False: 123k]
  ------------------
  446|   349k|                                                                       : st_dictionary_key);
  447|   349k|            frame_ = &stack_.back();
  448|   349k|            continue;
  449|       |
  450|  17.8k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 17.8k, False: 6.40M]
  ------------------
  451|  17.8k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  17.8k|            continue;
  453|       |
  454|  55.7k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 55.7k, False: 6.36M]
  ------------------
  455|  55.7k|            add_null();
  456|  55.7k|            continue;
  457|       |
  458|  1.06M|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 1.06M, False: 5.35M]
  ------------------
  459|  1.06M|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 840k, False: 229k]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   840k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   840k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   840k|                int_count_ = 1;
  464|   840k|            } else {
  465|   229k|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|   229k|            }
  467|  1.06M|            continue;
  468|       |
  469|   193k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 193k, False: 6.22M]
  ------------------
  470|   193k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|   193k|            continue;
  472|       |
  473|  2.97M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 2.97M, False: 3.44M]
  ------------------
  474|  2.97M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 974k, False: 1.99M]
  ------------------
  475|   974k|                frame_->key = tokenizer_.getValue();
  476|   974k|                frame_->state = st_dictionary_value;
  477|   974k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 36.5k, False: 937k]
  |  Branch (477:44): [True: 792, False: 35.7k]
  ------------------
  478|   974k|                continue;
  479|  1.99M|            } else {
  480|  1.99M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  1.99M|            }
  482|  1.99M|            continue;
  483|       |
  484|  1.99M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 999k, False: 5.41M]
  ------------------
  485|   999k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 721k, False: 277k]
  ------------------
  486|   721k|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|   721k|                continue;
  488|   721k|            }
  489|       |
  490|   277k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 266k, False: 11.5k]
  ------------------
  491|   266k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 2.75k, False: 263k]
  |  Branch (491:58): [True: 868, False: 262k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  3.62k|                    warn(
  495|  3.62k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  3.62k|                        "reading object");
  497|  3.62k|                    return {};
  498|  3.62k|                }
  499|       |
  500|   262k|                add_bad_null("unknown token while reading object; treating as null");
  501|   262k|                continue;
  502|   266k|            }
  503|       |
  504|  11.5k|            warn("unknown token while reading object; treating as string");
  505|  11.5k|            check_too_many_bad_tokens();
  506|  11.5k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  11.5k|            continue;
  509|       |
  510|   316k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 316k, False: 6.10M]
  ------------------
  511|   316k|            {
  512|   316k|                auto const& val = tokenizer_.getValue();
  513|   316k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 10.9k, False: 305k]
  ------------------
  514|  10.9k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 289, False: 10.6k]
  ------------------
  515|    289|                        frame_->contents_string = val;
  516|    289|                        frame_->contents_offset = input_.getLastOffset();
  517|    289|                        b_contents = false;
  518|    289|                    }
  519|  10.9k|                    std::string s{val};
  520|  10.9k|                    decrypter_->decryptString(s);
  521|  10.9k|                    add_scalar<QPDF_String>(s);
  522|   305k|                } else {
  523|   305k|                    add_scalar<QPDF_String>(val);
  524|   305k|                }
  525|   316k|            }
  526|   316k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 6.41M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  6.41M|        }
  531|  6.41M|    }
  532|   177k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  6.70M|{
  537|  6.70M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 5.80M, False: 905k]
  ------------------
  538|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  539|       |        // processing once the tt_dict_close token has been found.
  540|  5.80M|        frame_->olist.emplace_back(std::move(obj));
  541|  5.80M|    } else {
  542|   905k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 9.88k, False: 895k]
  ------------------
  543|  9.88k|            warn_duplicate_key();
  544|  9.88k|        }
  545|   905k|        frame_->state = st_dictionary_key;
  546|   905k|    }
  547|  6.70M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   362k|{
  552|   362k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   362k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 320k, False: 42.2k]
  ------------------
  555|       |        // If state is st_dictionary_key then there is a missing key. Push onto olist for
  556|       |        // processing once the tt_dict_close token has been found.
  557|   320k|        frame_->olist.emplace_back(null_obj);
  558|   320k|    } else {
  559|  42.2k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 1.91k, False: 40.3k]
  ------------------
  560|  1.91k|            warn_duplicate_key();
  561|  1.91k|        }
  562|  42.2k|        frame_->state = st_dictionary_key;
  563|  42.2k|    }
  564|   362k|    ++frame_->null_count;
  565|   362k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   272k|{
  570|   272k|    warn(msg);
  571|   272k|    check_too_many_bad_tokens();
  572|   272k|    add_null();
  573|   272k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  2.48M|{
  578|  2.48M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  2.48M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  2.48M|    add(std::move(obj));
  581|  2.48M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   377k|{
  611|   377k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 377k, False: 0]
  ------------------
  612|   377k|        obj->setDescription(context_, description_, parsed_offset);
  613|   377k|    }
  614|   377k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  6.18k|{
  619|  6.18k|    std::set<std::string> names;
  620|  15.4k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 15.4k, False: 6.18k]
  ------------------
  621|  15.4k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 274, False: 15.2k]
  ------------------
  622|    274|            names.insert(obj.getName());
  623|    274|        }
  624|  15.4k|    }
  625|  6.18k|    int next_fake_key = 1;
  626|  15.4k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 15.4k, False: 6.18k]
  ------------------
  627|  15.4k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 15.4k, Folded]
  ------------------
  628|  15.4k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  15.4k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 15.4k, False: 27]
  |  Branch (629:68): [True: 15.4k, False: 1]
  ------------------
  630|  15.4k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 15.4k, False: 28]
  ------------------
  631|  15.4k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 15.4k, False: 28]
  ------------------
  632|  15.4k|                warn(
  633|  15.4k|                    frame_->offset,
  634|  15.4k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  15.4k|                frame_->dict[key] = item;
  636|  15.4k|                break;
  637|  15.4k|            }
  638|  15.4k|        }
  639|  15.4k|    }
  640|  6.18k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   339k|{
  645|   339k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 255k, False: 83.7k]
  |  Branch (645:66): [True: 80.6k, False: 3.15k]
  ------------------
  646|   339k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 466, False: 339k]
  |  Branch (646:42): [True: 0, False: 339k]
  ------------------
  647|    466|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 312, False: 154]
  ------------------
  648|    312|            limits_error(
  649|    312|                "parser-max-container-size-damaged",
  650|    312|                "encountered errors while parsing an array or dictionary with more than " +
  651|    312|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    312|        }
  653|    466|        limits_error(
  654|    466|            "parser-max-container-size",
  655|    466|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    466|                " elements during xref recovery; giving up on reading object");
  657|    466|    }
  658|   339k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 339k, False: 466]
  |  Branch (658:27): [True: 1.86k, False: 337k]
  ------------------
  659|  1.86k|        limits_error(
  660|  1.86k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.86k|    }
  662|   339k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 126k, False: 212k]
  ------------------
  663|   126k|        good_count_ = 0;
  664|   126k|        bad_count_ = 1;
  665|   126k|        return;
  666|   126k|    }
  667|   212k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 7.27k, False: 205k]
  ------------------
  668|   205k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 126k, False: 79.2k]
  |  Branch (668:39): [True: 3.29k, False: 123k]
  ------------------
  669|       |        // Give up after 5 errors in close proximity or if the number of missing dictionary keys
  670|       |        // exceeds the remaining number of allowable total errors.
  671|  8.24k|        warn("too many errors; giving up on reading object");
  672|  8.24k|        throw Error();
  673|  8.24k|    }
  674|   204k|    good_count_ = 0;
  675|   204k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.41k|{
  680|  2.41k|    Limits::error();
  681|  2.41k|    warn("limits error("s + limit + "): " + msg);
  682|  2.41k|    throw Error();
  683|  2.41k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   496k|{
  688|       |    // If parsing on behalf of a QPDF object and want to give a warning, we can warn through the
  689|       |    // object. If parsing for some other reason, such as an explicit creation of an object from a
  690|       |    // string, then just throw the exception.
  691|   496k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 496k, False: 0]
  ------------------
  692|   496k|        context_->warn(e);
  693|   496k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   496k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  11.7k|{
  701|  11.7k|    warn(
  702|  11.7k|        frame_->offset,
  703|  11.7k|        "dictionary has duplicated key " + frame_->key +
  704|  11.7k|            "; last occurrence overrides earlier ones");
  705|  11.7k|    check_too_many_bad_tokens();
  706|  11.7k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   496k|{
  711|   496k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 14.4k, False: 481k]
  ------------------
  712|  14.4k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  14.4k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  14.4k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   481k|    } else {
  716|   481k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   481k|    }
  718|   496k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   389k|{
  723|   389k|    warn(input_.getLastOffset(), msg);
  724|   389k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|  17.0M|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 17.0M, False: 0]
  ------------------
   27|  17.0M|    {
   28|  17.0M|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 17.0M, False: 0]
  ------------------
   29|  17.0M|            objects->inParse(true);
   30|  17.0M|        }
   31|  17.0M|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|  17.0M|    {
   41|  17.0M|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 17.0M, False: 0]
  ------------------
   42|  17.0M|            objects->inParse(false);
   43|  17.0M|        }
   44|  17.0M|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   498k|    {
   36|   498k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   498k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|  2.01k|{
  603|  2.01k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  2.01k|    obj->setDescription(context_, description_, start_);
  605|  2.01k|    return {obj};
  606|  2.01k|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  96.4k|{
  603|  96.4k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  96.4k|    obj->setDescription(context_, description_, start_);
  605|  96.4k|    return {obj};
  606|  96.4k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  41.5k|{
  603|  41.5k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  41.5k|    obj->setDescription(context_, description_, start_);
  605|  41.5k|    return {obj};
  606|  41.5k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  29.9k|{
  603|  29.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  29.9k|    obj->setDescription(context_, description_, start_);
  605|  29.9k|    return {obj};
  606|  29.9k|}
_ZN4qpdf4impl6Parser16with_descriptionI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  16.7M|{
  603|  16.7M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  16.7M|    obj->setDescription(context_, description_, start_);
  605|  16.7M|    return {obj};
  606|  16.7M|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  9.41k|{
  603|  9.41k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  9.41k|    obj->setDescription(context_, description_, start_);
  605|  9.41k|    return {obj};
  606|  9.41k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    187|{
  603|    187|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    187|    obj->setDescription(context_, description_, start_);
  605|    187|    return {obj};
  606|    187|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  17.8k|{
  587|  17.8k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 7.80k, False: 10.0k]
  |  Branch (587:66): [True: 8.90k, False: 1.10k]
  ------------------
  588|  17.8k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 56, False: 17.7k]
  |  Branch (588:42): [True: 0, False: 17.7k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     56|        max_bad_count_ = 1;
  592|     56|        check_too_many_bad_tokens(); // always throws Error()
  593|     56|    }
  594|  17.8k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  17.8k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  17.8k|    add(std::move(obj));
  597|  17.8k|}
_ZN4qpdf4impl6Parser10add_scalarI12QPDF_IntegerJxEEEvDpOT0_:
  586|   229k|{
  587|   229k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 7.10k, False: 221k]
  |  Branch (587:66): [True: 221k, False: 523]
  ------------------
  588|   229k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 18, False: 229k]
  |  Branch (588:42): [True: 0, False: 229k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     18|        max_bad_count_ = 1;
  592|     18|        check_too_many_bad_tokens(); // always throws Error()
  593|     18|    }
  594|   229k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   229k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   229k|    add(std::move(obj));
  597|   229k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   193k|{
  587|   193k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 31.6k, False: 161k]
  |  Branch (587:66): [True: 153k, False: 8.55k]
  ------------------
  588|   193k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 86, False: 193k]
  |  Branch (588:42): [True: 0, False: 193k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     86|        max_bad_count_ = 1;
  592|     86|        check_too_many_bad_tokens(); // always throws Error()
  593|     86|    }
  594|   193k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   193k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   193k|    add(std::move(obj));
  597|   193k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  1.99M|{
  587|  1.99M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 1.56M, False: 438k]
  |  Branch (587:66): [True: 404k, False: 33.8k]
  ------------------
  588|  1.99M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 121, False: 1.99M]
  |  Branch (588:42): [True: 0, False: 1.99M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    121|        max_bad_count_ = 1;
  592|    121|        check_too_many_bad_tokens(); // always throws Error()
  593|    121|    }
  594|  1.99M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  1.99M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  1.99M|    add(std::move(obj));
  597|  1.99M|}
_ZN4qpdf4impl6Parser10add_scalarI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   721k|{
  587|   721k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 90.9k, False: 630k]
  |  Branch (587:66): [True: 630k, False: 342]
  ------------------
  588|   721k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 117, False: 721k]
  |  Branch (588:42): [True: 0, False: 721k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    117|        max_bad_count_ = 1;
  592|    117|        check_too_many_bad_tokens(); // always throws Error()
  593|    117|    }
  594|   721k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   721k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   721k|    add(std::move(obj));
  597|   721k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   317k|{
  587|   317k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 122k, False: 194k]
  |  Branch (587:66): [True: 188k, False: 5.61k]
  ------------------
  588|   317k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 48, False: 317k]
  |  Branch (588:42): [True: 0, False: 317k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     48|        max_bad_count_ = 1;
  592|     48|        check_too_many_bad_tokens(); // always throws Error()
  593|     48|    }
  594|   317k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   317k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   317k|    add(std::move(obj));
  597|   317k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  10.9k|{
  587|  10.9k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 7.54k, False: 3.37k]
  |  Branch (587:66): [True: 3.33k, False: 34]
  ------------------
  588|  10.9k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 10, False: 10.9k]
  |  Branch (588:42): [True: 0, False: 10.9k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     10|        max_bad_count_ = 1;
  592|     10|        check_too_many_bad_tokens(); // always throws Error()
  593|     10|    }
  594|  10.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  10.9k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  10.9k|    add(std::move(obj));
  597|  10.9k|}

_ZN16QPDFStreamFilter14setDecodeParmsE16QPDFObjectHandle:
    7|  17.0k|{
    8|  17.0k|    return decode_parms.null();
    9|  17.0k|}
_ZN16QPDFStreamFilter18isLossyCompressionEv:
   19|  44.8k|{
   20|  44.8k|    return false;
   21|  44.8k|}

_ZN4qpdf9Tokenizer5resetEv:
   85|  55.6M|{
   86|  55.6M|    state = st_before_token;
   87|  55.6M|    type = tt::tt_bad;
   88|  55.6M|    val.clear();
   89|  55.6M|    raw_val.clear();
   90|  55.6M|    error_message = "";
   91|  55.6M|    before_token = true;
   92|  55.6M|    in_token = false;
   93|  55.6M|    char_to_unread = '\0';
   94|  55.6M|    inline_image_bytes = 0;
   95|  55.6M|    string_depth = 0;
   96|  55.6M|    bad = false;
   97|  55.6M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  100|  1.20k|    type(type),
  101|  1.20k|    value(value),
  102|  1.20k|    raw_value(value)
  103|  1.20k|{
  104|  1.20k|    if (type == tt_string) {
  ------------------
  |  Branch (104:9): [True: 0, False: 1.20k]
  ------------------
  105|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
  106|  1.20k|    } else if (type == tt_name) {
  ------------------
  |  Branch (106:16): [True: 0, False: 1.20k]
  ------------------
  107|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  108|      0|    }
  109|  1.20k|}
_ZN13QPDFTokenizerC2Ev:
  112|  18.5k|    m(std::make_unique<qpdf::Tokenizer>())
  113|  18.5k|{
  114|  18.5k|}
_ZN13QPDFTokenizerD2Ev:
  116|  18.5k|QPDFTokenizer::~QPDFTokenizer() = default;
_ZN4qpdf9TokenizerC2Ev:
  119|   131k|{
  120|   131k|    reset();
  121|   131k|}
_ZN13QPDFTokenizer8allowEOFEv:
  125|  18.5k|{
  126|  18.5k|    m->allowEOF();
  127|  18.5k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  65.2k|{
  132|  65.2k|    allow_eof = true;
  133|  65.2k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  137|  18.5k|{
  138|  18.5k|    m->includeIgnorable();
  139|  18.5k|}
_ZN4qpdf9Tokenizer16includeIgnorableEv:
  143|  18.5k|{
  144|  18.5k|    include_ignorable = true;
  145|  18.5k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  91.3M|{
  150|  91.3M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 30.7M, False: 60.6M]
  |  Branch (150:27): [True: 11.0M, False: 49.5M]
  ------------------
  151|  91.3M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   362M|{
  156|   362M|    return is_delimiter(ch);
  157|   362M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  27.4k|{
  168|  27.4k|    handleCharacter(ch);
  169|       |
  170|  27.4k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 27.4k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  27.4k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   756M|{
  178|       |    // In some cases, functions called below may call a second handler. This happens whenever you
  179|       |    // have to use a character from the next token to detect the end of the current token.
  180|       |
  181|   756M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 756M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|   618k|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 618k, False: 756M]
  ------------------
  187|   618k|        inSpace(ch);
  188|   618k|        return;
  189|       |
  190|  10.9M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 10.9M, False: 746M]
  ------------------
  191|  10.9M|        inComment(ch);
  192|  10.9M|        return;
  193|       |
  194|   655k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 655k, False: 756M]
  ------------------
  195|   655k|        inLt(ch);
  196|   655k|        return;
  197|       |
  198|   369k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 369k, False: 756M]
  ------------------
  199|   369k|        inGt(ch);
  200|   369k|        return;
  201|       |
  202|   172M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 172M, False: 584M]
  ------------------
  203|   172M|        inString(ch);
  204|   172M|        return;
  205|       |
  206|  94.4M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 94.4M, False: 662M]
  ------------------
  207|  94.4M|        inName(ch);
  208|  94.4M|        return;
  209|       |
  210|  13.1M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 13.1M, False: 743M]
  ------------------
  211|  13.1M|        inNumber(ch);
  212|  13.1M|        return;
  213|       |
  214|  1.04M|    case st_real:
  ------------------
  |  Branch (214:5): [True: 1.04M, False: 755M]
  ------------------
  215|  1.04M|        inReal(ch);
  216|  1.04M|        return;
  217|       |
  218|   402k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 402k, False: 756M]
  ------------------
  219|   402k|        inStringAfterCR(ch);
  220|   402k|        return;
  221|       |
  222|   182k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 182k, False: 756M]
  ------------------
  223|   182k|        inStringEscape(ch);
  224|   182k|        return;
  225|       |
  226|  49.6k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 49.6k, False: 756M]
  ------------------
  227|  49.6k|        inCharCode(ch);
  228|  49.6k|        return;
  229|       |
  230|   260M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 260M, False: 496M]
  ------------------
  231|   260M|        inLiteral(ch);
  232|   260M|        return;
  233|       |
  234|  92.1M|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 92.1M, False: 664M]
  ------------------
  235|  92.1M|        inInlineImage(ch);
  236|  92.1M|        return;
  237|       |
  238|  8.19M|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 8.19M, False: 748M]
  ------------------
  239|  8.19M|        inHexstring(ch);
  240|  8.19M|        return;
  241|       |
  242|  8.18M|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 8.18M, False: 748M]
  ------------------
  243|  8.18M|        inHexstring2nd(ch);
  244|  8.18M|        return;
  245|       |
  246|  2.04M|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 2.04M, False: 754M]
  ------------------
  247|  2.04M|        inNameHex1(ch);
  248|  2.04M|        return;
  249|       |
  250|  16.3k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 16.3k, False: 756M]
  ------------------
  251|  16.3k|        inNameHex2(ch);
  252|  16.3k|        return;
  253|       |
  254|   116k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 116k, False: 756M]
  ------------------
  255|   116k|        inSign(ch);
  256|   116k|        return;
  257|       |
  258|  32.0k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 32.0k, False: 756M]
  ------------------
  259|  32.0k|        inDecimal(ch);
  260|  32.0k|        return;
  261|       |
  262|  90.6M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 90.6M, False: 666M]
  ------------------
  263|  90.6M|        inBeforeToken(ch);
  264|  90.6M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 756M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 756M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   756M|    }
  273|   756M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  90.6M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  90.6M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 41.4M, False: 49.2M]
  ------------------
  287|  41.4M|        before_token = !include_ignorable;
  288|  41.4M|        in_token = include_ignorable;
  289|  41.4M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 328k, False: 41.0M]
  ------------------
  290|   328k|            state = st_in_space;
  291|   328k|        }
  292|  49.2M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 45.5k, False: 49.1M]
  ------------------
  293|  45.5k|        before_token = !include_ignorable;
  294|  45.5k|        in_token = include_ignorable;
  295|  45.5k|        state = st_in_comment;
  296|  49.1M|    } else {
  297|  49.1M|        before_token = false;
  298|  49.1M|        in_token = true;
  299|  49.1M|        inTop(ch);
  300|  49.1M|    }
  301|  90.6M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  49.1M|{
  306|  49.1M|    switch (ch) {
  307|   201k|    case '(':
  ------------------
  |  Branch (307:5): [True: 201k, False: 48.9M]
  ------------------
  308|   201k|        string_depth = 1;
  309|   201k|        state = st_in_string;
  310|   201k|        return;
  311|       |
  312|   658k|    case '<':
  ------------------
  |  Branch (312:5): [True: 658k, False: 48.5M]
  ------------------
  313|   658k|        state = st_lt;
  314|   658k|        return;
  315|       |
  316|   370k|    case '>':
  ------------------
  |  Branch (316:5): [True: 370k, False: 48.8M]
  ------------------
  317|   370k|        state = st_gt;
  318|   370k|        return;
  319|       |
  320|  51.9k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 51.9k, False: 49.1M]
  ------------------
  321|  51.9k|        type = tt::tt_bad;
  322|  51.9k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  51.9k|        error_message = "unexpected )";
  324|  51.9k|        state = st_token_ready;
  325|  51.9k|        return;
  326|       |
  327|   284k|    case '[':
  ------------------
  |  Branch (327:5): [True: 284k, False: 48.8M]
  ------------------
  328|   284k|        type = tt::tt_array_open;
  329|   284k|        state = st_token_ready;
  330|   284k|        return;
  331|       |
  332|   204k|    case ']':
  ------------------
  |  Branch (332:5): [True: 204k, False: 48.9M]
  ------------------
  333|   204k|        type = tt::tt_array_close;
  334|   204k|        state = st_token_ready;
  335|   204k|        return;
  336|       |
  337|  1.39M|    case '{':
  ------------------
  |  Branch (337:5): [True: 1.39M, False: 47.7M]
  ------------------
  338|  1.39M|        type = tt::tt_brace_open;
  339|  1.39M|        state = st_token_ready;
  340|  1.39M|        return;
  341|       |
  342|  6.92k|    case '}':
  ------------------
  |  Branch (342:5): [True: 6.92k, False: 49.1M]
  ------------------
  343|  6.92k|        type = tt::tt_brace_close;
  344|  6.92k|        state = st_token_ready;
  345|  6.92k|        return;
  346|       |
  347|  3.45M|    case '/':
  ------------------
  |  Branch (347:5): [True: 3.45M, False: 45.7M]
  ------------------
  348|  3.45M|        state = st_name;
  349|  3.45M|        val += ch;
  350|  3.45M|        return;
  351|       |
  352|  1.55M|    case '0':
  ------------------
  |  Branch (352:5): [True: 1.55M, False: 47.6M]
  ------------------
  353|  3.13M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.57M, False: 47.5M]
  ------------------
  354|  3.84M|    case '2':
  ------------------
  |  Branch (354:5): [True: 710k, False: 48.4M]
  ------------------
  355|  4.06M|    case '3':
  ------------------
  |  Branch (355:5): [True: 220k, False: 48.9M]
  ------------------
  356|  4.61M|    case '4':
  ------------------
  |  Branch (356:5): [True: 555k, False: 48.6M]
  ------------------
  357|  5.03M|    case '5':
  ------------------
  |  Branch (357:5): [True: 416k, False: 48.7M]
  ------------------
  358|  5.23M|    case '6':
  ------------------
  |  Branch (358:5): [True: 200k, False: 48.9M]
  ------------------
  359|  5.35M|    case '7':
  ------------------
  |  Branch (359:5): [True: 116k, False: 49.0M]
  ------------------
  360|  5.61M|    case '8':
  ------------------
  |  Branch (360:5): [True: 265k, False: 48.9M]
  ------------------
  361|  5.67M|    case '9':
  ------------------
  |  Branch (361:5): [True: 62.2k, False: 49.1M]
  ------------------
  362|  5.67M|        state = st_number;
  363|  5.67M|        return;
  364|       |
  365|  5.31k|    case '+':
  ------------------
  |  Branch (365:5): [True: 5.31k, False: 49.1M]
  ------------------
  366|   119k|    case '-':
  ------------------
  |  Branch (366:5): [True: 114k, False: 49.0M]
  ------------------
  367|   119k|        state = st_sign;
  368|   119k|        return;
  369|       |
  370|  36.0k|    case '.':
  ------------------
  |  Branch (370:5): [True: 36.0k, False: 49.1M]
  ------------------
  371|  36.0k|        state = st_decimal;
  372|  36.0k|        return;
  373|       |
  374|  36.7M|    default:
  ------------------
  |  Branch (374:5): [True: 36.7M, False: 12.4M]
  ------------------
  375|  36.7M|        state = st_literal;
  376|  36.7M|        return;
  377|  49.1M|    }
  378|  49.1M|}
_ZN4qpdf9Tokenizer7inSpaceEc:
  382|   618k|{
  383|       |    // We only enter this state if include_ignorable is true.
  384|   618k|    if (!isSpace(ch)) {
  ------------------
  |  Branch (384:9): [True: 321k, False: 296k]
  ------------------
  385|   321k|        type = tt::tt_space;
  386|   321k|        in_token = false;
  387|   321k|        char_to_unread = ch;
  388|   321k|        state = st_token_ready;
  389|   321k|    }
  390|   618k|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  10.9M|{
  395|  10.9M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 9.53k, False: 10.9M]
  |  Branch (395:25): [True: 34.8k, False: 10.9M]
  ------------------
  396|  44.3k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 1.25k, False: 43.0k]
  ------------------
  397|  1.25k|            type = tt::tt_comment;
  398|  1.25k|            in_token = false;
  399|  1.25k|            char_to_unread = ch;
  400|  1.25k|            state = st_token_ready;
  401|  43.0k|        } else {
  402|  43.0k|            state = st_before_token;
  403|  43.0k|        }
  404|  44.3k|    }
  405|  10.9M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   173M|{
  410|   173M|    switch (ch) {
  411|   182k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 182k, False: 172M]
  ------------------
  412|   182k|        state = st_string_escape;
  413|   182k|        return;
  414|       |
  415|   206k|    case '(':
  ------------------
  |  Branch (415:5): [True: 206k, False: 172M]
  ------------------
  416|   206k|        val += ch;
  417|   206k|        ++string_depth;
  418|   206k|        return;
  419|       |
  420|   318k|    case ')':
  ------------------
  |  Branch (420:5): [True: 318k, False: 172M]
  ------------------
  421|   318k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 191k, False: 126k]
  ------------------
  422|   191k|            type = tt::tt_string;
  423|   191k|            state = st_token_ready;
  424|   191k|            return;
  425|   191k|        }
  426|       |
  427|   126k|        val += ch;
  428|   126k|        return;
  429|       |
  430|   402k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 402k, False: 172M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   402k|        val += '\n';
  433|   402k|        state = st_string_after_cr;
  434|   402k|        return;
  435|       |
  436|   823k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 823k, False: 172M]
  ------------------
  437|   823k|        val += ch;
  438|   823k|        return;
  439|       |
  440|   171M|    default:
  ------------------
  |  Branch (440:5): [True: 171M, False: 1.93M]
  ------------------
  441|   171M|        val += ch;
  442|   171M|        return;
  443|   173M|    }
  444|   173M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  96.4M|{
  449|  96.4M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 3.38M, False: 93.0M]
  ------------------
  450|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  451|       |        // the whitespace character even though it is ignored since it may be the newline after a
  452|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  453|       |        // though not on any files in the test suite as of this
  454|       |        // writing.
  455|       |
  456|  3.38M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 474, False: 3.38M]
  ------------------
  457|  3.38M|        in_token = false;
  458|  3.38M|        char_to_unread = ch;
  459|  3.38M|        state = st_token_ready;
  460|  93.0M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 2.04M, False: 91.0M]
  ------------------
  461|  2.04M|        char_code = 0;
  462|  2.04M|        state = st_name_hex1;
  463|  91.0M|    } else {
  464|  91.0M|        val += ch;
  465|  91.0M|    }
  466|  96.4M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  2.04M|{
  471|  2.04M|    hex_char = ch;
  472|       |
  473|  2.04M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 16.3k, False: 2.02M]
  ------------------
  474|  16.3k|        char_code = int(hval) << 4;
  475|  16.3k|        state = st_name_hex2;
  476|  2.02M|    } else {
  477|  2.02M|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  2.02M|        error_message = "name with stray # will not work with PDF >= 1.2";
  479|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  480|  2.02M|        val += '\0';
  481|  2.02M|        state = st_name;
  482|  2.02M|        inName(ch);
  483|  2.02M|    }
  484|  2.04M|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  16.3k|{
  489|  16.3k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 4.84k, False: 11.4k]
  ------------------
  490|  4.84k|        char_code |= int(hval);
  491|  11.4k|    } else {
  492|  11.4k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  11.4k|        error_message = "name with stray # will not work with PDF >= 1.2";
  494|       |        // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName.
  495|  11.4k|        val += '\0';
  496|  11.4k|        val += hex_char;
  497|  11.4k|        state = st_name;
  498|  11.4k|        inName(ch);
  499|  11.4k|        return;
  500|  11.4k|    }
  501|  4.84k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.21k, False: 3.63k]
  ------------------
  502|  1.21k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.21k|        error_message = "null character not allowed in name token";
  504|  1.21k|        val += "#00";
  505|  1.21k|        state = st_name;
  506|  1.21k|        bad = true;
  507|  3.63k|    } else {
  508|  3.63k|        val += char(char_code);
  509|  3.63k|        state = st_name;
  510|  3.63k|    }
  511|  4.84k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|   116k|{
  516|   116k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 107k, False: 8.61k]
  ------------------
  517|   107k|        state = st_number;
  518|   107k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 398, False: 8.21k]
  ------------------
  519|    398|        state = st_decimal;
  520|  8.21k|    } else {
  521|  8.21k|        state = st_literal;
  522|  8.21k|        inLiteral(ch);
  523|  8.21k|    }
  524|   116k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  32.0k|{
  529|  32.0k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 20.0k, False: 11.9k]
  ------------------
  530|  20.0k|        state = st_real;
  531|  20.0k|    } else {
  532|  11.9k|        state = st_literal;
  533|  11.9k|        inLiteral(ch);
  534|  11.9k|    }
  535|  32.0k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  13.1M|{
  540|  13.1M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 7.53M, False: 5.60M]
  ------------------
  541|  7.53M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 284k, False: 5.32M]
  ------------------
  542|   284k|        state = st_real;
  543|  5.32M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 5.23M, False: 88.9k]
  ------------------
  544|  5.23M|        type = tt::tt_integer;
  545|  5.23M|        state = st_token_ready;
  546|  5.23M|        in_token = false;
  547|  5.23M|        char_to_unread = ch;
  548|  5.23M|    } else {
  549|  88.9k|        state = st_literal;
  550|  88.9k|    }
  551|  13.1M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|  1.04M|{
  556|  1.04M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 742k, False: 304k]
  ------------------
  557|   742k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 295k, False: 8.73k]
  ------------------
  558|   295k|        type = tt::tt_real;
  559|   295k|        state = st_token_ready;
  560|   295k|        in_token = false;
  561|   295k|        char_to_unread = ch;
  562|   295k|    } else {
  563|  8.73k|        state = st_literal;
  564|  8.73k|    }
  565|  1.04M|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|   182k|{
  569|   182k|    state = st_in_string;
  570|   182k|    switch (ch) {
  571|  9.92k|    case '0':
  ------------------
  |  Branch (571:5): [True: 9.92k, False: 172k]
  ------------------
  572|  10.7k|    case '1':
  ------------------
  |  Branch (572:5): [True: 842, False: 181k]
  ------------------
  573|  17.7k|    case '2':
  ------------------
  |  Branch (573:5): [True: 6.95k, False: 175k]
  ------------------
  574|  24.2k|    case '3':
  ------------------
  |  Branch (574:5): [True: 6.55k, False: 176k]
  ------------------
  575|  25.7k|    case '4':
  ------------------
  |  Branch (575:5): [True: 1.45k, False: 181k]
  ------------------
  576|  26.2k|    case '5':
  ------------------
  |  Branch (576:5): [True: 494, False: 182k]
  ------------------
  577|  26.5k|    case '6':
  ------------------
  |  Branch (577:5): [True: 374, False: 182k]
  ------------------
  578|  27.1k|    case '7':
  ------------------
  |  Branch (578:5): [True: 582, False: 182k]
  ------------------
  579|  27.1k|        state = st_char_code;
  580|  27.1k|        char_code = 0;
  581|  27.1k|        digit_count = 0;
  582|  27.1k|        inCharCode(ch);
  583|  27.1k|        return;
  584|       |
  585|  7.05k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 7.05k, False: 175k]
  ------------------
  586|  7.05k|        val += '\n';
  587|  7.05k|        return;
  588|       |
  589|  2.89k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 2.89k, False: 179k]
  ------------------
  590|  2.89k|        val += '\r';
  591|  2.89k|        return;
  592|       |
  593|  54.4k|    case 't':
  ------------------
  |  Branch (593:5): [True: 54.4k, False: 128k]
  ------------------
  594|  54.4k|        val += '\t';
  595|  54.4k|        return;
  596|       |
  597|    964|    case 'b':
  ------------------
  |  Branch (597:5): [True: 964, False: 181k]
  ------------------
  598|    964|        val += '\b';
  599|    964|        return;
  600|       |
  601|  39.8k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 39.8k, False: 142k]
  ------------------
  602|  39.8k|        val += '\f';
  603|  39.8k|        return;
  604|       |
  605|    779|    case '\n':
  ------------------
  |  Branch (605:5): [True: 779, False: 181k]
  ------------------
  606|    779|        return;
  607|       |
  608|    356|    case '\r':
  ------------------
  |  Branch (608:5): [True: 356, False: 182k]
  ------------------
  609|    356|        state = st_string_after_cr;
  610|    356|        return;
  611|       |
  612|  49.2k|    default:
  ------------------
  |  Branch (612:5): [True: 49.2k, False: 133k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  49.2k|        val += ch;
  615|  49.2k|        return;
  616|   182k|    }
  617|   182k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   402k|{
  622|   402k|    state = st_in_string;
  623|   402k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 190k, False: 211k]
  ------------------
  624|   190k|        inString(ch);
  625|   190k|    }
  626|   402k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   655k|{
  631|   655k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 463k, False: 192k]
  ------------------
  632|   463k|        type = tt::tt_dict_open;
  633|   463k|        state = st_token_ready;
  634|   463k|        return;
  635|   463k|    }
  636|       |
  637|   192k|    state = st_in_hexstring;
  638|   192k|    inHexstring(ch);
  639|   192k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   369k|{
  644|   369k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 323k, False: 46.0k]
  ------------------
  645|   323k|        type = tt::tt_dict_close;
  646|   323k|        state = st_token_ready;
  647|   323k|    } else {
  648|  46.0k|        type = tt::tt_bad;
  649|  46.0k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  46.0k|        error_message = "unexpected >";
  651|  46.0k|        in_token = false;
  652|  46.0k|        char_to_unread = ch;
  653|  46.0k|        state = st_token_ready;
  654|  46.0k|    }
  655|   369k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|   260M|{
  660|   260M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 19.9M, False: 240M]
  ------------------
  661|       |        // A C-locale whitespace character or delimiter terminates token.  It is important to unread
  662|       |        // the whitespace character even though it is ignored since it may be the newline after a
  663|       |        // stream keyword.  Removing it here could make the stream-reading code break on some files,
  664|       |        // though not on any files in the test suite as of this writing.
  665|       |
  666|  19.9M|        in_token = false;
  667|  19.9M|        char_to_unread = ch;
  668|  19.9M|        state = st_token_ready;
  669|  19.9M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 18.0k, False: 19.9M]
  |  Branch (669:39): [True: 3.12k, False: 19.9M]
  ------------------
  670|  19.9M|            ? tt::tt_bool
  671|  19.9M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 59.9k, False: 19.8M]
  ------------------
  672|  19.9M|    }
  673|   260M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|  8.38M|{
  678|  8.38M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 8.17M, False: 207k]
  ------------------
  679|  8.17M|        char_code = int(hval) << 4;
  680|  8.17M|        state = st_in_hexstring_2nd;
  681|       |
  682|  8.17M|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 149k, False: 58.0k]
  ------------------
  683|   149k|        type = tt::tt_string;
  684|   149k|        state = st_token_ready;
  685|       |
  686|   149k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 36.4k, False: 21.6k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  36.4k|    } else {
  690|  21.6k|        type = tt::tt_bad;
  691|  21.6k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  21.6k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  21.6k|        state = st_token_ready;
  694|  21.6k|    }
  695|  8.38M|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  8.18M|{
  700|  8.18M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 8.15M, False: 32.0k]
  ------------------
  701|  8.15M|        val += char(char_code) | hval;
  702|  8.15M|        state = st_in_hexstring;
  703|       |
  704|  8.15M|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 7.38k, False: 24.6k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  7.38k|        val += char(char_code);
  707|  7.38k|        type = tt::tt_string;
  708|  7.38k|        state = st_token_ready;
  709|       |
  710|  24.6k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 14.1k, False: 10.5k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  14.1k|    } else {
  714|  10.5k|        type = tt::tt_bad;
  715|  10.5k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  10.5k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  10.5k|        state = st_token_ready;
  718|  10.5k|    }
  719|  8.18M|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  76.8k|{
  724|  76.8k|    bool handled = false;
  725|  76.8k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 73.7k, False: 3.08k]
  |  Branch (725:24): [True: 70.7k, False: 2.97k]
  ------------------
  726|  70.7k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  70.7k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 49.9k, False: 20.7k]
  ------------------
  728|  49.9k|            return;
  729|  49.9k|        }
  730|  20.7k|        handled = true;
  731|  20.7k|    }
  732|       |    // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF
  733|       |    // Spec says to ignore high-order overflow.
  734|  26.8k|    val += char(char_code % 256);
  735|  26.8k|    state = st_in_string;
  736|  26.8k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 6.06k, False: 20.7k]
  ------------------
  737|  6.06k|        inString(ch);
  738|  6.06k|    }
  739|  26.8k|}
_ZN4qpdf9Tokenizer13inInlineImageEc:
  743|  92.1M|{
  744|  92.1M|    if ((raw_val.length() + 1) == inline_image_bytes) {
  ------------------
  |  Branch (744:9): [True: 2.90k, False: 92.1M]
  ------------------
  745|  2.90k|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  746|  2.90k|        type = tt::tt_inline_image;
  747|  2.90k|        inline_image_bytes = 0;
  748|  2.90k|        state = st_token_ready;
  749|  2.90k|    }
  750|  92.1M|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  81.4k|{
  761|  81.4k|    switch (state) {
  762|  2.18k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 2.18k, False: 79.2k]
  ------------------
  763|  2.37k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 187, False: 81.2k]
  ------------------
  764|  2.58k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 210, False: 81.2k]
  ------------------
  765|  10.5k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 8.01k, False: 73.4k]
  ------------------
  766|  10.8k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 290, False: 81.1k]
  ------------------
  767|  11.0k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 185, False: 81.2k]
  ------------------
  768|  11.1k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 122, False: 81.3k]
  ------------------
  769|  27.4k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 16.3k, False: 65.1k]
  ------------------
  770|  27.4k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  27.4k|        presentCharacter('\f');
  773|  27.4k|        in_token = true;
  774|  27.4k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 81.4k]
  ------------------
  777|  42.1k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 42.1k, False: 39.2k]
  ------------------
  778|  42.1k|        type = tt::tt_eof;
  779|  42.1k|        break;
  780|       |
  781|  6.20k|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 6.20k, False: 75.2k]
  ------------------
  782|  6.20k|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 6.20k, False: 0]
  ------------------
  783|  6.20k|        break;
  784|       |
  785|  1.21k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.21k, False: 80.2k]
  ------------------
  786|  1.21k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 65, False: 1.14k]
  ------------------
  787|  1.21k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 81.4k]
  ------------------
  790|      0|        break;
  791|       |
  792|  4.37k|    default:
  ------------------
  |  Branch (792:5): [True: 4.37k, False: 77.0k]
  ------------------
  793|  4.37k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  4.37k|        type = tt::tt_bad;
  795|  4.37k|        error_message = "EOF while reading token";
  796|  81.4k|    }
  797|  81.4k|    state = st_token_ready;
  798|  81.4k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  808|  1.20k|{
  809|  1.20k|    m->expectInlineImage(input);
  810|  1.20k|}
_ZN4qpdf9Tokenizer17expectInlineImageER11InputSource:
  814|  3.12k|{
  815|  3.12k|    if (state == st_token_ready) {
  ------------------
  |  Branch (815:9): [True: 1.91k, False: 1.20k]
  ------------------
  816|  1.91k|        reset();
  817|  1.91k|    } else if (state != st_before_token) {
  ------------------
  |  Branch (817:16): [True: 0, False: 1.20k]
  ------------------
  818|      0|        throw std::logic_error(
  819|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  820|      0|    }
  821|  3.12k|    findEI(input);
  822|  3.12k|    before_token = false;
  823|  3.12k|    in_token = true;
  824|  3.12k|    state = st_inline_image;
  825|  3.12k|}
_ZN4qpdf9Tokenizer6findEIER11InputSource:
  829|  3.12k|{
  830|  3.12k|    qpdf_offset_t last_offset = input.getLastOffset();
  831|  3.12k|    qpdf_offset_t pos = input.tell();
  832|       |
  833|       |    // Use QPDFWordTokenFinder to find EI surrounded by delimiters. Then read the next several
  834|       |    // tokens or up to EOF. If we find any suspicious-looking or tokens, this is probably still part
  835|       |    // of the image data, so keep looking for EI. Stop at the first EI that passes. If we get to the
  836|       |    // end without finding one, return the last EI we found. Store the number of bytes expected in
  837|       |    // the inline image including the EI and use that to break out of inline image, falling back to
  838|       |    // the old method if needed.
  839|       |
  840|  3.12k|    bool okay = false;
  841|  3.12k|    bool first_try = true;
  842|  20.4k|    while (!okay) {
  ------------------
  |  Branch (842:12): [True: 18.1k, False: 2.33k]
  ------------------
  843|  18.1k|        QPDFWordTokenFinder f(input, "EI");
  844|  18.1k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (844:13): [True: 788, False: 17.3k]
  ------------------
  845|    788|            break;
  846|    788|        }
  847|  17.3k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  848|       |
  849|  17.3k|        Tokenizer check;
  850|  17.3k|        bool found_bad = false;
  851|       |        // Look at the next 10 tokens or up to EOF. The next inline image's image data would look
  852|       |        // like bad tokens, but there will always be at least 10 tokens between one inline image's
  853|       |        // EI and the next valid one's ID since width, height, bits per pixel, and color space are
  854|       |        // all required as well as a BI and ID. If we get 10 good tokens in a row or hit EOF, we can
  855|       |        // be pretty sure we've found the actual EI.
  856|  50.6k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (856:25): [True: 48.3k, False: 2.33k]
  ------------------
  857|  48.3k|            check.nextToken(input, "checker");
  858|  48.3k|            auto typ = check.getType();
  859|  48.3k|            if (typ == tt::tt_eof) {
  ------------------
  |  Branch (859:17): [True: 0, False: 48.3k]
  ------------------
  860|      0|                okay = true;
  861|  48.3k|            } else if (typ == tt::tt_bad) {
  ------------------
  |  Branch (861:24): [True: 6.08k, False: 42.2k]
  ------------------
  862|  6.08k|                found_bad = true;
  863|  42.2k|            } else if (typ == tt::tt_word) {
  ------------------
  |  Branch (863:24): [True: 23.1k, False: 19.0k]
  ------------------
  864|       |                // The qpdf tokenizer lumps alphabetic and otherwise uncategorized characters into
  865|       |                // "words". We recognize strings of alphabetic characters as potential valid
  866|       |                // operators for purposes of telling whether we're in valid content or not. It's not
  867|       |                // perfect, but it should work more reliably than what we used to do, which was
  868|       |                // already good enough for the vast majority of files.
  869|  23.1k|                bool found_alpha = false;
  870|  23.1k|                bool found_non_printable = false;
  871|  23.1k|                bool found_other = false;
  872|  61.6k|                for (char ch: check.getValue()) {
  ------------------
  |  Branch (872:29): [True: 61.6k, False: 17.2k]
  ------------------
  873|  61.6k|                    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '*')) {
  ------------------
  |  Branch (873:26): [True: 28.2k, False: 33.4k]
  |  Branch (873:39): [True: 26.2k, False: 1.90k]
  |  Branch (873:54): [True: 18.4k, False: 16.9k]
  |  Branch (873:67): [True: 16.4k, False: 1.98k]
  |  Branch (873:81): [True: 391, False: 18.4k]
  ------------------
  874|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  875|       |                        // along with alphabetic characters.
  876|  43.1k|                        found_alpha = true;
  877|  43.1k|                    } else if (static_cast<signed char>(ch) < 32 && !isSpace(ch)) {
  ------------------
  |  Branch (877:32): [True: 5.95k, False: 12.5k]
  |  Branch (877:69): [True: 5.95k, False: 0]
  ------------------
  878|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  879|  5.95k|                        found_non_printable = true;
  880|  5.95k|                        break;
  881|  12.5k|                    } else {
  882|  12.5k|                        found_other = true;
  883|  12.5k|                    }
  884|  61.6k|                }
  885|  23.1k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (885:21): [True: 5.95k, False: 17.2k]
  |  Branch (885:45): [True: 16.5k, False: 634]
  |  Branch (885:60): [True: 2.93k, False: 13.6k]
  ------------------
  886|  8.89k|                    found_bad = true;
  887|  8.89k|                }
  888|  23.1k|            }
  889|  48.3k|            if (okay || found_bad) {
  ------------------
  |  Branch (889:17): [True: 0, False: 48.3k]
  |  Branch (889:25): [True: 14.9k, False: 33.3k]
  ------------------
  890|  14.9k|                break;
  891|  14.9k|            }
  892|  48.3k|        }
  893|  17.3k|        if (!found_bad) {
  ------------------
  |  Branch (893:13): [True: 2.33k, False: 14.9k]
  ------------------
  894|  2.33k|            okay = true;
  895|  2.33k|        }
  896|  17.3k|        if (!okay) {
  ------------------
  |  Branch (896:13): [True: 14.9k, False: 2.33k]
  ------------------
  897|  14.9k|            first_try = false;
  898|  14.9k|        }
  899|  17.3k|    }
  900|  3.12k|    if (okay && (!first_try)) {
  ------------------
  |  Branch (900:9): [True: 2.33k, False: 788]
  |  Branch (900:17): [True: 280, False: 2.05k]
  ------------------
  901|    280|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  902|    280|    }
  903|       |
  904|       |    input.seek(pos, SEEK_SET);
  905|  3.12k|    input.setLastOffset(last_offset);
  906|  3.12k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  5.92M|{
  917|  5.92M|    bool ready = (state == st_token_ready);
  918|  5.92M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 3.81M, False: 2.10M]
  |  Branch (918:32): [True: 3.78M, False: 26.2k]
  ------------------
  919|  5.92M|    ch = char_to_unread;
  920|  5.92M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 5.92M, False: 0]
  ------------------
  921|  5.92M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 377k, False: 5.54M]
  |  Branch (921:43): [True: 28.1k, False: 5.51M]
  ------------------
  922|  5.92M|            ? Token(type, raw_val, raw_val, error_message)
  923|  5.92M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  5.92M|        reset();
  926|  5.92M|    }
  927|  5.92M|    return ready;
  928|  5.92M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  945|  2.21M|{
  946|  2.21M|    return m->readToken(input, context, allow_bad, max_len);
  947|  2.21M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  5.92M|{
  959|  5.92M|    nextToken(input, context, max_len);
  960|       |
  961|  5.92M|    Token token;
  962|  5.92M|    bool unread_char;
  963|  5.92M|    char char_to_unread;
  964|  5.92M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  5.92M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 326k, False: 5.59M]
  ------------------
  967|   326k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 326k, False: 0]
  ------------------
  968|   326k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   326k|        } else {
  970|      0|            throw QPDFExc(
  971|      0|                qpdf_e_damaged_pdf,
  972|      0|                input.getName(),
  973|      0|                context.empty() ? "offset " + std::to_string(input.getLastOffset()) : context,
  ------------------
  |  Branch (973:17): [True: 0, False: 0]
  ------------------
  974|      0|                input.getLastOffset(),
  975|      0|                token.getErrorMessage());
  976|      0|        }
  977|   326k|    }
  978|  5.92M|    return token;
  979|  5.92M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  49.5M|{
  984|  49.5M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 49.5M, False: 3.12k]
  ------------------
  985|  49.5M|        reset();
  986|  49.5M|    }
  987|  49.5M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   806M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 757M, False: 49.5M]
  ------------------
  990|   757M|        char ch;
  991|   757M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 81.4k, False: 756M]
  ------------------
  992|  81.4k|            presentEOF();
  993|       |
  994|  81.4k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 42.1k, False: 39.2k]
  |  Branch (994:41): [True: 119, False: 42.0k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|    119|                type = tt::tt_bad;
  998|    119|                error_message = "unexpected EOF";
  999|    119|                offset = input.getLastOffset();
 1000|    119|            }
 1001|   756M|        } else {
 1002|   756M|            handleCharacter(ch);
 1003|   756M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 48.3M, False: 708M]
  ------------------
 1004|  48.3M|                ++offset;
 1005|  48.3M|            }
 1006|   756M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 679M, False: 77.5M]
  ------------------
 1007|   679M|                raw_val += ch;
 1008|   679M|            }
 1009|   756M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 66.2M, False: 690M]
  |  Branch (1009:28): [True: 17.1M, False: 49.1M]
  |  Branch (1009:61): [True: 17.1M, False: 8.24k]
  ------------------
 1010|       |                // terminate this token now
 1011|  17.1M|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|  17.1M|                type = tt::tt_bad;
 1013|  17.1M|                state = st_token_ready;
 1014|  17.1M|                error_message = "exceeded allowable length while reading token";
 1015|  17.1M|            }
 1016|   756M|        }
 1017|   757M|    }
 1018|       |
 1019|  49.5M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 29.2M, False: 20.3M]
  |  Branch (1019:35): [True: 29.2M, False: 43.3k]
  ------------------
 1020|       |
 1021|  49.5M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 49.5M, False: 42.0k]
  ------------------
 1022|  49.5M|        input.setLastOffset(offset);
 1023|  49.5M|    }
 1024|       |
 1025|  49.5M|    return error_message.empty();
 1026|  49.5M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   362M|{
   26|   362M|    return (
   27|   362M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 6.36M, False: 356M]
  |  Branch (27:22): [True: 1.14M, False: 355M]
  |  Branch (27:36): [True: 2.39M, False: 353M]
  |  Branch (27:49): [True: 124k, False: 352M]
  |  Branch (27:62): [True: 65.0k, False: 352M]
  |  Branch (27:75): [True: 16.1k, False: 352M]
  |  Branch (27:88): [True: 12.5k, False: 352M]
  ------------------
   28|   352M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 279k, False: 352M]
  |  Branch (28:22): [True: 132k, False: 352M]
  |  Branch (28:35): [True: 177k, False: 352M]
  |  Branch (28:48): [True: 113k, False: 352M]
  |  Branch (28:61): [True: 21.4k, False: 352M]
  |  Branch (28:74): [True: 18.4k, False: 352M]
  |  Branch (28:88): [True: 421k, False: 351M]
  ------------------
   29|   351M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 38.4k, False: 351M]
  |  Branch (29:23): [True: 115k, False: 351M]
  |  Branch (29:37): [True: 17.4M, False: 334M]
  ------------------
   30|   362M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   38|  18.1k|            is(is),
   39|  18.1k|            str(str)
   40|  18.1k|        {
   41|  18.1k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   53|  48.7k|{
   54|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   55|       |    // delimiter or EOF.
   56|  48.7k|    Tokenizer tokenizer;
   57|  48.7k|    tokenizer.nextToken(is, "finder", str.size() + 2);
   58|  48.7k|    qpdf_offset_t pos = is.tell();
   59|  48.7k|    if (tokenizer.getType() != tt::tt_word || tokenizer.getValue() != str) {
  ------------------
  |  Branch (59:9): [True: 29.2k, False: 19.4k]
  |  Branch (59:47): [True: 2.16k, False: 17.3k]
  ------------------
   60|  31.4k|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   61|  31.4k|        return false;
   62|  31.4k|    }
   63|  17.3k|    qpdf_offset_t token_start = is.getLastOffset();
   64|  17.3k|    char next;
   65|  17.3k|    bool next_okay = false;
   66|  17.3k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (66:9): [True: 13, False: 17.3k]
  ------------------
   67|     13|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   68|     13|        next_okay = true;
   69|  17.3k|    } else {
   70|  17.3k|        next_okay = is_delimiter(next);
   71|  17.3k|    }
   72|  17.3k|    is.seek(pos, SEEK_SET);
   73|  17.3k|    if (!next_okay) {
  ------------------
  |  Branch (73:9): [True: 0, False: 17.3k]
  ------------------
   74|      0|        return false;
   75|      0|    }
   76|  17.3k|    if (token_start == 0) {
  ------------------
  |  Branch (76:9): [True: 0, False: 17.3k]
  ------------------
   77|       |        // Can't actually happen...we never start the search at the beginning of the input.
   78|      0|        return false;
   79|      0|    }
   80|  17.3k|    return true;
   81|  17.3k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   42|  18.1k|        ~QPDFWordTokenFinder() override = default;

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|  34.8k|{
   40|  34.8k|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 412, False: 34.4k]
  ------------------
   41|    412|        sp = std::make_unique<Sparse>();
   42|  58.4k|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 58.4k, False: 412]
  ------------------
   43|  58.4k|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 12.2k, False: 46.1k]
  |  Branch (43:54): [True: 200, False: 45.9k]
  ------------------
   44|  12.4k|                sp->elements[sp->size] = std::move(item);
   45|  12.4k|            }
   46|  58.4k|            ++sp->size;
   47|  58.4k|        }
   48|  34.4k|    } else {
   49|  34.4k|        elements = std::move(v);
   50|  34.4k|    }
   51|  34.8k|}
_ZNK4qpdf5Array5arrayEv:
   55|  61.3k|{
   56|  61.3k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 61.3k, False: 0]
  ------------------
   57|  61.3k|        return a;
   58|  61.3k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|  61.3k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  5.76k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  5.76k|{
   67|  5.76k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  8.60k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  8.60k|{
   72|  8.60k|}
_ZN4qpdf5Array5emptyEv:
   76|  1.04k|{
   77|  1.04k|    return Array(std::vector<QPDFObjectHandle>());
   78|  1.04k|}
_ZN4qpdf5Array5beginEv:
   82|   189k|{
   83|   189k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 103k, False: 86.3k]
  ------------------
   84|   103k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 102k, False: 375]
  ------------------
   85|   102k|            return a->elements.begin();
   86|   102k|        }
   87|    375|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 375, False: 0]
  ------------------
   88|    375|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    375|        }
   90|    375|        return sp_elements->begin();
   91|   103k|    }
   92|  86.3k|    return {};
   93|   189k|}
_ZN4qpdf5Array3endEv:
   97|   189k|{
   98|   189k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 103k, False: 86.3k]
  ------------------
   99|   103k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 102k, False: 375]
  ------------------
  100|   102k|            return a->elements.end();
  101|   102k|        }
  102|    375|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 375]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    375|        return sp_elements->end();
  106|   103k|    }
  107|  86.3k|    return {};
  108|   189k|}
_ZNK4qpdf5Array4sizeEv:
  178|   296k|{
  179|   296k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 241k, False: 54.7k]
  ------------------
  180|   241k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 23.9k, False: 217k]
  ------------------
  181|   241k|    }
  182|  54.7k|    return 0;
  183|   296k|}
_ZNK4qpdf5ArrayixEm:
  187|   760k|{
  188|   760k|    static const QPDFObjectHandle null_obj;
  189|   760k|    auto a = as<QPDF_Array>();
  190|   760k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 1.55k, False: 759k]
  ------------------
  191|  1.55k|        return null_obj;
  192|  1.55k|    }
  193|   759k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 29.5k, False: 729k]
  ------------------
  194|  29.5k|        auto const& iter = a->sp->elements.find(n);
  195|  29.5k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 22.7k, False: 6.76k]
  ------------------
  196|  29.5k|    }
  197|   729k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.67k, False: 727k]
  ------------------
  198|   759k|}
_ZNK4qpdf5ArrayixEi:
  202|   652k|{
  203|   652k|    static const QPDFObjectHandle null_obj;
  204|   652k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.52k, False: 649k]
  ------------------
  205|  2.52k|        return null_obj;
  206|  2.52k|    }
  207|   649k|    return (*this)[static_cast<size_t>(n)];
  208|   652k|}
_ZNK4qpdf5Array3getEm:
  212|     60|{
  213|     60|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 60]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|     60|    auto a = array();
  217|     60|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 60, False: 0]
  ------------------
  218|     60|        return a->elements[n];
  219|     60|    }
  220|      0|    auto const& iter = a->sp->elements.find(n);
  221|      0|    return iter == a->sp->elements.end() ? null() : iter->second;
  ------------------
  |  Branch (221:12): [True: 0, False: 0]
  ------------------
  222|     60|}
_ZNK4qpdf5Array3getEi:
  226|     60|{
  227|     60|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 60]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|     60|    return get(to_s(n));
  231|     60|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  10.3k|{
  236|  10.3k|    auto a = array();
  237|  10.3k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 382, False: 9.98k]
  ------------------
  238|    382|        std::vector<QPDFObjectHandle> v;
  239|    382|        v.reserve(size());
  240|  4.26k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 4.26k, False: 382]
  ------------------
  241|  4.26k|            v.resize(item.first, null_oh);
  242|  4.26k|            v.emplace_back(item.second);
  243|  4.26k|        }
  244|    382|        v.resize(size(), null_oh);
  245|    382|        return v;
  246|  9.98k|    } else {
  247|  9.98k|        return a->elements;
  248|  9.98k|    }
  249|  10.3k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     75|{
  254|     75|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 75]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     75|    auto a = array();
  258|     75|    checkOwnership(oh);
  259|     75|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 5, False: 70]
  ------------------
  260|      5|        a->sp->elements[at] = oh;
  261|     70|    } else {
  262|     70|        a->elements[at] = oh;
  263|     70|    }
  264|     75|    return true;
  265|     75|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     75|{
  270|     75|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 75]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     75|    return set(to_s(at), oh);
  274|     75|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  12.9k|{
  291|  12.9k|    auto a = array();
  292|  12.9k|    size_t sz = size();
  293|  12.9k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 12.9k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  12.9k|    checkOwnership(item);
  297|  12.9k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 12.9k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  12.9k|        push_back(item);
  300|  12.9k|        return true;
  301|  12.9k|    }
  302|      0|    if (!a->sp) {
  ------------------
  |  Branch (302:9): [True: 0, False: 0]
  ------------------
  303|      0|        a->elements.insert(a->elements.cbegin() + to_i(at), item);
  304|      0|        return true;
  305|      0|    }
  306|      0|    auto iter = a->sp->elements.crbegin();
  307|      0|    while (iter != a->sp->elements.crend()) {
  ------------------
  |  Branch (307:12): [True: 0, False: 0]
  ------------------
  308|      0|        auto key = (iter++)->first;
  309|      0|        if (key >= at) {
  ------------------
  |  Branch (309:13): [True: 0, False: 0]
  ------------------
  310|      0|            auto nh = a->sp->elements.extract(key);
  311|      0|            ++nh.key();
  312|      0|            a->sp->elements.insert(std::move(nh));
  313|      0|        } else {
  314|      0|            break;
  315|      0|        }
  316|      0|    }
  317|      0|    a->sp->elements[at] = item;
  318|      0|    ++a->sp->size;
  319|      0|    return true;
  320|      0|}
_ZN4qpdf5Array6insertEiRK16QPDFObjectHandle:
  324|  12.9k|{
  325|  12.9k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 12.9k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  12.9k|    return insert(to_s(at_i), item);
  329|  12.9k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|  30.7k|{
  334|  30.7k|    auto a = array();
  335|  30.7k|    checkOwnership(item);
  336|  30.7k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 324, False: 30.4k]
  ------------------
  337|    324|        a->sp->elements[(a->sp->size)++] = item;
  338|  30.4k|    } else {
  339|  30.4k|        a->elements.emplace_back(item);
  340|  30.4k|    }
  341|  30.7k|}
_ZN4qpdf5Array5eraseEm:
  345|  7.14k|{
  346|  7.14k|    auto a = array();
  347|  7.14k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 7.14k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  7.14k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 7.14k, False: 0]
  ------------------
  351|  7.14k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  7.14k|        return true;
  353|  7.14k|    }
  354|      0|    auto end = a->sp->elements.end();
  355|      0|    if (auto iter = a->sp->elements.lower_bound(at); iter != end) {
  ------------------
  |  Branch (355:54): [True: 0, False: 0]
  ------------------
  356|      0|        if (iter->first == at) {
  ------------------
  |  Branch (356:13): [True: 0, False: 0]
  ------------------
  357|      0|            iter++;
  358|      0|            a->sp->elements.erase(at);
  359|      0|        }
  360|       |
  361|      0|        while (iter != end) {
  ------------------
  |  Branch (361:16): [True: 0, False: 0]
  ------------------
  362|      0|            auto nh = a->sp->elements.extract(iter++);
  363|      0|            --nh.key();
  364|      0|            a->sp->elements.insert(std::move(nh));
  365|      0|        }
  366|      0|    }
  367|      0|    --(a->sp->size);
  368|      0|    return true;
  369|  7.14k|}
_ZN4qpdf5Array5eraseEi:
  373|  7.14k|{
  374|  7.14k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 7.14k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  7.14k|    return erase(to_s(at_i));
  378|  7.14k|}
_ZNK16QPDFObjectHandle14getArrayNItemsEv:
  382|   242k|{
  383|   242k|    auto s = size();
  384|   242k|    if (s > 1 || isArray()) {
  ------------------
  |  Branch (384:9): [True: 241k, False: 1.14k]
  |  Branch (384:18): [True: 1.14k, False: 0]
  ------------------
  385|   242k|        return to_i(s);
  386|   242k|    }
  387|      0|    typeWarning("array", "treating as empty");
  388|      0|    return 0;
  389|   242k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|   255k|{
  394|   255k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 255k, False: 0]
  ------------------
  395|   255k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 232k, False: 22.4k]
  ------------------
  396|   232k|            return result;
  397|   232k|        }
  398|  22.4k|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 22.4k, False: 0]
  |  Branch (398:23): [True: 22.4k, False: 0]
  ------------------
  399|       |            // sparse array null
  400|  22.4k|            return newNull();
  401|  22.4k|        }
  402|      0|        objectWarning("returning null for out of bounds array access");
  403|      0|    } else {
  404|      0|        typeWarning("array", "returning null");
  405|      0|    }
  406|      0|    static auto constexpr msg = " -> null returned from invalid array access"sv;
  407|      0|    return QPDF_Null::create(obj, msg, "");
  408|   255k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  67.2k|{
  413|  67.2k|    Array array(*this);
  414|   171k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 171k, False: 65.6k]
  ------------------
  415|   171k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 1.57k, False: 169k]
  ------------------
  416|  1.57k|            return false;
  417|  1.57k|        }
  418|   171k|    }
  419|  65.6k|    return array.size() == 4;
  420|  67.2k|}
_ZNK16QPDFObjectHandle8isMatrixEv:
  424|  6.64k|{
  425|  6.64k|    Array array(*this);
  426|  6.64k|    for (auto const& oh: array) {
  ------------------
  |  Branch (426:24): [True: 3.06k, False: 6.57k]
  ------------------
  427|  3.06k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (427:13): [True: 71, False: 2.99k]
  ------------------
  428|     71|            return false;
  429|     71|        }
  430|  3.06k|    }
  431|  6.57k|    return array.size() == 6;
  432|  6.64k|}
_ZNK16QPDFObjectHandle19getArrayAsRectangleEv:
  436|  26.9k|{
  437|  26.9k|    Array array(*this);
  438|  26.9k|    if (array.size() != 4) {
  ------------------
  |  Branch (438:9): [True: 1.37k, False: 25.6k]
  ------------------
  439|  1.37k|        return {};
  440|  1.37k|    }
  441|  25.6k|    std::array<double, 4> items;
  442|   127k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (442:24): [True: 102k, False: 25.4k]
  ------------------
  443|   102k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (443:13): [True: 181, False: 101k]
  ------------------
  444|    181|            return {};
  445|    181|        }
  446|   102k|    }
  447|  25.4k|    return {
  448|  25.4k|        std::min(items[0], items[2]),
  449|  25.4k|        std::min(items[1], items[3]),
  450|  25.4k|        std::max(items[0], items[2]),
  451|  25.4k|        std::max(items[1], items[3])};
  452|  25.6k|}
_ZNK16QPDFObjectHandle16getArrayAsMatrixEv:
  456|    459|{
  457|    459|    Array array(*this);
  458|    459|    if (array.size() != 6) {
  ------------------
  |  Branch (458:9): [True: 0, False: 459]
  ------------------
  459|      0|        return {};
  460|      0|    }
  461|    459|    std::array<double, 6> items;
  462|  3.21k|    for (size_t i = 0; i < 6; ++i) {
  ------------------
  |  Branch (462:24): [True: 2.75k, False: 459]
  ------------------
  463|  2.75k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (463:13): [True: 0, False: 2.75k]
  ------------------
  464|      0|            return {};
  465|      0|        }
  466|  2.75k|    }
  467|    459|    return {items[0], items[1], items[2], items[3], items[4], items[5]};
  468|    459|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  9.99k|{
  473|  9.99k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 9.99k, False: 0]
  ------------------
  474|  9.99k|        return array.getAsVector();
  475|  9.99k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  9.99k|}
_ZN16QPDFObjectHandle10appendItemERKS_:
  526|  10.6k|{
  527|  10.6k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (527:14): [True: 10.6k, False: 0]
  ------------------
  528|  10.6k|        array.push_back(item);
  529|  10.6k|    } else {
  530|      0|        typeWarning("array", "ignoring attempt to append item");
  531|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item");
  532|      0|    }
  533|  10.6k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|   289k|{
  567|   289k|    switch (resolved_type_code()) {
  568|   260k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 260k, False: 28.9k]
  ------------------
  569|   260k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 289k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 289k]
  ------------------
  572|  10.4k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 10.4k, False: 279k]
  ------------------
  573|  10.4k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 289k]
  ------------------
  574|  10.4k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 289k]
  ------------------
  575|  10.4k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 289k]
  ------------------
  576|  10.4k|        return 0;
  577|     90|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 90, False: 289k]
  ------------------
  578|  1.43k|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 1.34k, False: 288k]
  ------------------
  579|  1.90k|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 477, False: 289k]
  ------------------
  580|  1.93k|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 25, False: 289k]
  ------------------
  581|  17.8k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 15.8k, False: 273k]
  ------------------
  582|  18.3k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 506, False: 289k]
  ------------------
  583|  18.5k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 196, False: 289k]
  ------------------
  584|  18.5k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 289k]
  ------------------
  585|  18.5k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 289k]
  ------------------
  586|  18.5k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 289k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|   289k|    }
  591|   289k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  2.45k|{
  596|  2.45k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 2.45k, False: 0]
  ------------------
  597|  2.45k|        return Array(obj)[n];
  598|  2.45k|    }
  599|      0|    if (n < size()) {
  ------------------
  |  Branch (599:9): [True: 0, False: 0]
  ------------------
  600|      0|        return *this;
  601|      0|    }
  602|      0|    return {};
  603|      0|}
_ZNK4qpdf10BaseHandleixEi:
  607|  2.45k|{
  608|  2.45k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 2.45k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  2.45k|    return (*this)[static_cast<size_t>(n)];
  612|  2.45k|}
QPDF_Array.cc:_ZL4to_si:
   15|  20.2k|{
   16|  20.2k|    return static_cast<size_t>(n);
   17|  20.2k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|  43.7k|{
   28|  43.7k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 43.7k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|  43.7k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 841, False: 42.9k]
  |  Branch (31:19): [True: 755, False: 86]
  |  Branch (31:34): [True: 0, False: 755]
  ------------------
   32|      0|        throw std::logic_error(
   33|      0|            "Attempting to add an object from a different QPDF. Use "
   34|      0|            "QPDF::copyForeignObject to add objects from another file.");
   35|      0|    }
   36|  43.7k|}
QPDF_Array.cc:_ZL4to_im:
   21|   249k|{
   22|   249k|    return static_cast<int>(n);
   23|   249k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  13.4k|{
   13|  13.4k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 13.4k, False: 0]
  ------------------
   14|  13.4k|        return d;
   15|  13.4k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  13.4k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|  2.27M|{
   23|  2.27M|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 2.21M, False: 64.2k]
  ------------------
   24|  2.21M|        auto it = d->items.find(key);
   25|  2.21M|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 1.47M, False: 737k]
  ------------------
   26|  1.47M|            return it->second;
   27|  1.47M|        }
   28|  2.21M|    }
   29|   802k|    static const QPDFObjectHandle null_obj;
   30|   802k|    return null_obj;
   31|  2.27M|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|   211k|{
   64|   211k|    return !(*this)[key].null();
   65|   211k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  13.4k|{
  100|  13.4k|    std::set<std::string> result;
  101|  47.2k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 47.2k, False: 13.4k]
  ------------------
  102|  47.2k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 43.4k, False: 3.72k]
  ------------------
  103|  43.4k|            result.insert(iter.first);
  104|  43.4k|        }
  105|  47.2k|    }
  106|  13.4k|    return result;
  107|  13.4k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  25.8k|{
  118|       |    // no-op if key does not exist
  119|  25.8k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 25.8k, False: 0]
  ------------------
  120|  25.8k|        return d->items.erase(key);
  121|  25.8k|    }
  122|      0|    return 0;
  123|  25.8k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|   224k|{
  141|   224k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 224k, False: 223]
  ------------------
  142|   224k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 54.9k, False: 169k]
  |  Branch (142:29): [True: 50.4k, False: 4.50k]
  ------------------
  143|       |            // The PDF spec doesn't distinguish between keys with null values and missing keys.
  144|       |            // Allow indirect nulls which are equivalent to a dangling reference, which is permitted
  145|       |            // by the spec.
  146|  50.4k|            d->items.erase(key);
  147|   173k|        } else {
  148|       |            // add or replace value
  149|   173k|            d->items[key] = value;
  150|   173k|        }
  151|   224k|        return true;
  152|   224k|    }
  153|    223|    return false;
  154|   224k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|   217k|{
  173|   217k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 217k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|   217k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  49.6k|    BaseDictionary(std::move(dict))
  180|  49.6k|{
  181|  49.6k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|   287k|    BaseDictionary(obj)
  185|   287k|{
  186|   287k|}
_ZN4qpdf10Dictionary5emptyEv:
  190|  20.3k|{
  191|  20.3k|    return Dictionary(std::map<std::string, QPDFObjectHandle>());
  192|  20.3k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|   183k|{
  197|   183k|    auto qpdf = getOwningQPDF();
  198|   183k|    auto item_qpdf = item.getOwningQPDF();
  199|   183k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 133k, False: 50.1k]
  |  Branch (199:17): [True: 33.9k, False: 99.0k]
  |  Branch (199:30): [True: 0, False: 33.9k]
  ------------------
  200|      0|        throw std::logic_error(
  201|      0|            "Attempting to add an object from a different QPDF. Use "
  202|      0|            "QPDF::copyForeignObject to add objects from another file.");
  203|      0|    }
  204|   183k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|   149k|{
  209|   149k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 149k, False: 235]
  ------------------
  210|   149k|        return dict.contains(key);
  211|   149k|    } else {
  212|    235|        typeWarning("dictionary", "returning false for a key containment request");
  213|    235|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    235|        return false;
  215|    235|    }
  216|   149k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   834k|{
  221|   834k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 513k, False: 320k]
  ------------------
  222|   513k|        return result;
  223|   513k|    }
  224|   320k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 320k, False: 318]
  ------------------
  225|   320k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|   320k|        return QPDF_Null::create(obj, msg, key);
  227|   320k|    }
  228|    318|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    318|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    318|    return QPDF_Null::create(obj, msg, "");
  231|   320k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  21.7k|{
  236|  21.7k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 229, False: 21.4k]
  ------------------
  237|  21.7k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  13.5k|{
  242|  13.5k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 13.4k, False: 93]
  ------------------
  243|  13.4k|        return dict.getKeys();
  244|  13.4k|    }
  245|     93|    typeWarning("dictionary", "treating as empty");
  246|     93|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|     93|    return {};
  248|  13.5k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|   192k|{
  264|   192k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 183k, False: 9.10k]
  ------------------
  265|   183k|        checkOwnership(value);
  266|   183k|        dict.replace(key, value);
  267|   183k|        return;
  268|   183k|    }
  269|  9.10k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  9.10k|}
_ZN16QPDFObjectHandle19replaceKeyAndGetNewERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  274|  9.46k|{
  275|  9.46k|    replaceKey(key, value);
  276|  9.46k|    return value;
  277|  9.46k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|  19.8k|{
  290|  19.8k|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 9.02k, False: 10.8k]
  |  Branch (290:23): [True: 10.8k, False: 0]
  ------------------
  291|  19.8k|        return;
  292|  19.8k|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  25.9k|    Common(common),
  127|  25.9k|    copier_(std::make_shared<Copier>(*this))
  128|  25.9k|{
  129|  25.9k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  49.3k|{
  226|  49.3k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 49.3k]
  ------------------
  227|       |        // We need to check user provided filters first as we allow users to replace qpdf provided
  228|       |        // default filters. This will have a performance impact if the facility to register stream
  229|       |        // filters is actually used. We can optimize this away if necessary.
  230|      0|        auto ff = filter_factories.find(expand_filter_name(name));
  231|      0|        if (ff != filter_factories.end()) {
  ------------------
  |  Branch (231:13): [True: 0, False: 0]
  ------------------
  232|      0|            return ff->second;
  233|      0|        }
  234|      0|    }
  235|  49.3k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 5.75k, False: 43.6k]
  ------------------
  236|  5.75k|        return SF_FlateLzwDecode::flate_factory;
  237|  5.75k|    }
  238|  43.6k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 3.51k, False: 40.0k]
  ------------------
  239|  3.51k|        return []() { return std::make_shared<SF_Crypt>(); };
  240|  3.51k|    }
  241|  40.0k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 185, False: 39.9k]
  ------------------
  242|    185|        return SF_FlateLzwDecode::lzw_factory;
  243|    185|    }
  244|  39.9k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 44, False: 39.8k]
  ------------------
  245|     44|        return SF_RunLengthDecode::factory;
  246|     44|    }
  247|  39.8k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 741, False: 39.1k]
  ------------------
  248|    741|        return SF_DCTDecode::factory;
  249|    741|    }
  250|  39.1k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 3.68k, False: 35.4k]
  ------------------
  251|  3.68k|        return SF_ASCII85Decode::factory;
  252|  3.68k|    }
  253|  35.4k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 48, False: 35.3k]
  ------------------
  254|     48|        return SF_ASCIIHexDecode::factory;
  255|     48|    }
  256|       |    // The PDF specification provides these filter abbreviations for use in inline images, but
  257|       |    // according to table H.1 in the pre-ISO versions of the PDF specification, Adobe Reader
  258|       |    // also accepts them for stream filters.
  259|       |
  260|  35.3k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 17.3k, False: 18.0k]
  ------------------
  261|  17.3k|        return SF_FlateLzwDecode::flate_factory;
  262|  17.3k|    }
  263|  18.0k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 572, False: 17.4k]
  ------------------
  264|    572|        return SF_ASCIIHexDecode::factory;
  265|    572|    }
  266|  17.4k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 121, False: 17.3k]
  ------------------
  267|    121|        return SF_ASCII85Decode::factory;
  268|    121|    }
  269|  17.3k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 4.47k, False: 12.8k]
  ------------------
  270|  4.47k|        return SF_FlateLzwDecode::lzw_factory;
  271|  4.47k|    }
  272|  12.8k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 12.4k, False: 462]
  ------------------
  273|  12.4k|        return SF_RunLengthDecode::factory;
  274|  12.4k|    }
  275|    462|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 90, False: 372]
  ------------------
  276|     90|        return SF_DCTDecode::factory;
  277|     90|    }
  278|    372|    return nullptr;
  279|    462|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  52.6k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  52.6k|{
  285|  52.6k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  52.6k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  52.6k|    obj->setDescription(&qpdf, descr, offset);
  288|  52.6k|    setDictDescription();
  289|  52.6k|}
_ZN4qpdf6Stream4copyEv:
  293|    413|{
  294|    413|    Stream result = qpdf()->newStream();
  295|    413|    result.stream()->stream_dict = getDict().copy();
  296|    413|    copy_data_to(result);
  297|    413|    return result;
  298|    413|}
_ZN4qpdf6Stream12copy_data_toERS0_:
  302|    411|{
  303|    411|    qpdf_expect(dest);
  ------------------
  |  |   13|    411|#define qpdf_expect assert
  ------------------
  |  Branch (303:5): [True: 411, False: 0]
  ------------------
  304|    411|    auto s = stream();
  305|    411|    auto& d_streams = dest.qpdf()->doc().objects().streams();
  306|       |
  307|    411|    auto dict = dest.getDict();
  308|       |
  309|       |    // Copy information from the foreign stream so we can pipe its data later without keeping the
  310|       |    // original QPDF object around.
  311|    411|    if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) {
  ------------------
  |  Branch (311:9): [True: 0, False: 411]
  |  Branch (311:57): [True: 0, False: 0]
  ------------------
  312|       |        // Pull the stream data into a buffer before attempting the copy operation. Do it on the
  313|       |        // source stream so that if the source stream is copied multiple times, we don't have to
  314|       |        // keep duplicating the memory. Passing uninitialised object handles will preserve the
  315|       |        // existing filters and decode parameters.
  316|      0|        replaceStreamData(getRawStreamData(), {}, {});
  317|      0|    }
  318|    411|    if (s->stream_data) {
  ------------------
  |  Branch (318:9): [True: 12, False: 399]
  ------------------
  319|     12|        dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]);
  320|    399|    } else {
  321|    399|        d_streams.copier()->register_copy(dest, *this, s->stream_provider.get());
  322|    399|        dest.replaceStreamData(d_streams.copier(), dict["/Filter"], dict["/DecodeParms"]);
  323|    399|    }
  324|    411|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  57.0k|{
  452|  57.0k|    auto s = stream();
  453|  57.0k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 20.3k, False: 36.6k]
  ------------------
  454|  20.3k|        s->stream_dict.setObjectDescription(
  455|  20.3k|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|  20.3k|    }
  457|  57.0k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  19.2k|{
  462|  19.2k|    std::string result;
  463|  19.2k|    pl::String buf(result);
  464|  19.2k|    bool filtered;
  465|  19.2k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  19.2k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 2.49k, False: 16.7k]
  ------------------
  467|  2.49k|        throw QPDFExc(
  468|  2.49k|            qpdf_e_unsupported,
  469|  2.49k|            qpdf()->getFilename(),
  470|  2.49k|            "",
  471|  2.49k|            offset(),
  472|  2.49k|            "getStreamData called on unfilterable stream");
  473|  2.49k|    }
  474|  16.7k|    return result;
  475|  19.2k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  28.4k|{
  496|  28.4k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 28.4k, False: 22]
  ------------------
  497|  28.4k|        return false;
  498|  28.4k|    }
  499|     22|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  28.4k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  46.3k|{
  507|  46.3k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  46.3k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  46.3k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 26.6k, False: 19.7k]
  ------------------
  513|       |        // No filters
  514|  26.6k|        return true;
  515|  26.6k|    }
  516|  19.7k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 31, False: 19.6k]
  ------------------
  517|     31|        global::Limits::error();
  518|     31|        warn(
  519|     31|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     31|            "not filterable");
  521|     31|        return false;
  522|     31|    }
  523|  19.6k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 14.0k, False: 5.67k]
  ------------------
  524|       |        // One filter
  525|  14.0k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  14.0k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 146, False: 13.8k]
  ------------------
  527|    146|            return false;
  528|    146|        }
  529|  13.8k|        filters.emplace_back(ff());
  530|  13.8k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 5.65k, False: 26]
  ------------------
  531|       |        // Potentially multiple filters
  532|  35.3k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 35.3k, False: 5.40k]
  ------------------
  533|  35.3k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 25, False: 35.3k]
  ------------------
  534|     25|                warn("stream filter type is not name or array");
  535|     25|                return false;
  536|     25|            }
  537|  35.3k|            auto ff = s->filter_factory(item);
  538|  35.3k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 226, False: 35.1k]
  ------------------
  539|    226|                filters.clear();
  540|    226|                return false;
  541|    226|            }
  542|  35.1k|            filters.emplace_back(ff());
  543|  35.1k|        }
  544|  5.65k|    } else {
  545|     26|        warn("stream filter type is not name or array");
  546|     26|        return false;
  547|     26|    }
  548|       |
  549|       |    // filters now contains a list of filters to be applied in order. See which ones we can support.
  550|       |    // See if we can support any decode parameters that are specified.
  551|       |
  552|  19.2k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  19.2k|    auto can_filter = // linebreak
  555|  19.2k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  19.2k|        if (!filter.setDecodeParms(d_obj) ||
  557|  19.2k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  19.2k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  19.2k|            return false;
  560|  19.2k|        }
  561|  19.2k|        return true;
  562|  19.2k|    };
  563|       |
  564|  19.2k|    auto decode_array = decode_obj.as_array(strict);
  565|  19.2k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 19.1k, False: 142]
  |  Branch (565:26): [True: 71, False: 71]
  ------------------
  566|  19.1k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 71, False: 19.1k]
  ------------------
  567|     71|            decode_obj = QPDFObjectHandle::newNull();
  568|     71|        }
  569|       |
  570|  47.6k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 47.6k, False: 18.9k]
  ------------------
  571|  47.6k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 272, False: 47.4k]
  ------------------
  572|    272|                return false;
  573|    272|            }
  574|  47.6k|        }
  575|  19.1k|    } else {
  576|       |        // Ignore /DecodeParms entirely if /Filters is empty.  At least one case of a file whose
  577|       |        // /DecodeParms was [ << >> ] when /Filters was empty has been seen in the wild.
  578|     71|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 59, False: 12]
  |  Branch (578:13): [True: 21, False: 50]
  |  Branch (578:33): [True: 21, False: 38]
  ------------------
  579|     21|            warn("stream /DecodeParms length is inconsistent with filters");
  580|     21|            return false;
  581|     21|        }
  582|       |
  583|     50|        int i = -1;
  584|     60|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 60, False: 39]
  ------------------
  585|     60|            auto d_obj = decode_array.get(++i);
  586|     60|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 11, False: 49]
  ------------------
  587|     11|                return false;
  588|     11|            }
  589|     60|        }
  590|     50|    }
  591|       |
  592|  18.9k|    return true;
  593|  19.2k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  46.3k|{
  604|  46.3k|    auto s = stream();
  605|  46.3k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  46.3k|    bool ignored;
  607|  46.3k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 46.3k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  46.3k|    bool& filter = *filterp;
  611|       |
  612|  46.3k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 41.7k, False: 4.63k]
  |  Branch (612:54): [True: 28.1k, False: 13.6k]
  |  Branch (612:73): [True: 4.80k, False: 23.3k]
  ------------------
  613|  46.3k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 13.6k, False: 32.7k]
  |  Branch (613:54): [True: 312, False: 13.2k]
  ------------------
  614|  46.3k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 4.80k, False: 41.5k]
  |  Branch (614:40): [True: 312, False: 41.2k]
  ------------------
  615|       |
  616|  46.3k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 4.80k, False: 41.5k]
  |  Branch (616:25): [True: 312, False: 41.2k]
  ------------------
  617|  5.12k|        filter = true;
  618|  5.12k|    }
  619|       |
  620|  46.3k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 5.12k, False: 41.2k]
  |  Branch (620:23): [True: 0, False: 41.2k]
  |  Branch (620:39): [True: 41.2k, False: 0]
  ------------------
  621|  46.3k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 46.3k, False: 0]
  ------------------
  622|  46.3k|        filter = filterable(decode_level, filters);
  623|  46.3k|    }
  624|       |
  625|  46.3k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 46.3k]
  ------------------
  626|      0|        QTC::TC("qpdf", "QPDF_Stream pipeStreamData with null pipeline");
  627|       |        // Return value is whether we can filter in this case.
  628|      0|        return filter;
  629|      0|    }
  630|       |
  631|       |    // Construct the pipeline in reverse order. Force pipelines we create to be deleted when this
  632|       |    // function finishes. Pipelines created by QPDFStreamFilter objects will be deleted by those
  633|       |    // objects.
  634|  46.3k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  46.3k|    ContentNormalizer normalizer;
  637|  46.3k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 45.6k, False: 762]
  ------------------
  638|  45.6k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 45.6k]
  ------------------
  639|      0|            auto new_pipeline =
  640|      0|                std::make_unique<Pl_Flate>("compress stream", pipeline, Pl_Flate::a_deflate);
  641|      0|            pipeline = new_pipeline.get();
  642|      0|            to_delete.push_back(std::move(new_pipeline));
  643|      0|        }
  644|       |
  645|  45.6k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 45.6k]
  ------------------
  646|      0|            auto new_pipeline =
  647|      0|                std::make_unique<Pl_QPDFTokenizer>("normalizer", &normalizer, pipeline);
  648|      0|            pipeline = new_pipeline.get();
  649|      0|            to_delete.push_back(std::move(new_pipeline));
  650|      0|        }
  651|       |
  652|  45.6k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 45.6k]
  ------------------
  653|      0|            auto new_pipeline =
  654|      0|                std::make_unique<Pl_QPDFTokenizer>("token filter", (*iter).get(), pipeline);
  655|      0|            pipeline = new_pipeline.get();
  656|      0|            to_delete.push_back(std::move(new_pipeline));
  657|      0|        }
  658|       |
  659|  93.0k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 47.4k, False: 45.6k]
  ------------------
  660|  47.4k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 44.0k, False: 3.40k]
  ------------------
  661|  44.0k|                pipeline = decode_pipeline;
  662|  44.0k|            }
  663|  47.4k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  47.4k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 23.0k, False: 24.4k]
  ------------------
  665|  23.0k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  23.0k|            }
  667|  47.4k|        }
  668|  45.6k|    }
  669|       |
  670|  46.3k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 13.6k, False: 32.7k]
  ------------------
  671|  13.6k|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  672|  13.6k|        pipeline->write(s->stream_data->getBuffer(), s->stream_data->getSize());
  673|  13.6k|        pipeline->finish();
  674|  32.7k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 4.63k, False: 28.1k]
  ------------------
  675|  4.63k|        Pl_Count count("stream provider count", pipeline);
  676|  4.63k|        if (s->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (676:13): [True: 0, False: 4.63k]
  ------------------
  677|      0|            if (!s->stream_provider->provideStreamData(
  ------------------
  |  Branch (677:17): [True: 0, False: 0]
  ------------------
  678|      0|                    obj->getObjGen(), &count, suppress_warnings, will_retry)) {
  679|      0|                filter = false;
  680|      0|                return false;
  681|      0|            }
  682|  4.63k|        } else {
  683|  4.63k|            s->stream_provider->provideStreamData(obj->getObjGen(), &count);
  684|  4.63k|        }
  685|  4.63k|        qpdf_offset_t actual_length = count.getCount();
  686|  4.63k|        if (auto desired_length = Length()) {
  ------------------
  |  Branch (686:18): [True: 0, False: 4.63k]
  ------------------
  687|      0|            if (actual_length != desired_length) {
  ------------------
  |  Branch (687:17): [True: 0, False: 0]
  ------------------
  688|       |                // This would be caused by programmer error on the part of a library user, not by
  689|       |                // invalid input data.
  690|      0|                throw std::runtime_error(
  691|      0|                    "stream data provider for " + obj->getObjGen().unparse(' ') + " provided " +
  692|      0|                    std::to_string(actual_length) + " bytes instead of expected " +
  693|      0|                    std::to_string(desired_length.value()) + " bytes");
  694|      0|            }
  695|  4.63k|        } else {
  696|  4.63k|            Length(actual_length);
  697|  4.63k|        }
  698|  28.1k|    } else {
  699|  28.1k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 28.1k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  28.1k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 2.53k, False: 25.5k]
  ------------------
  703|  28.1k|                qpdf(),
  704|  28.1k|                id_gen(),
  705|  28.1k|                offset(),
  706|  28.1k|                s->length,
  707|  28.1k|                s->stream_dict,
  708|  28.1k|                isRootMetadata(),
  709|  28.1k|                pipeline,
  710|  28.1k|                suppress_warnings,
  711|  28.1k|                will_retry)) {
  712|  2.53k|            filter = false;
  713|  2.53k|            return false;
  714|  2.53k|        }
  715|  28.1k|    }
  716|       |
  717|  43.8k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 42.2k, False: 1.61k]
  |  Branch (717:19): [True: 42.2k, False: 0]
  |  Branch (717:41): [True: 0, False: 42.2k]
  ------------------
  718|      0|        warn("content normalization encountered bad tokens");
  719|      0|        if (normalizer.lastTokenWasBad()) {
  ------------------
  |  Branch (719:13): [True: 0, False: 0]
  ------------------
  720|      0|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  721|      0|            warn(
  722|      0|                "normalized content ended with a bad token; you may be able to resolve this by "
  723|      0|                "coalescing content streams in combination with normalizing content. From the "
  724|      0|                "command line, specify --coalesce-contents");
  725|      0|        }
  726|      0|        warn(
  727|      0|            "Resulting stream data may be corrupted but is may still useful for manual "
  728|      0|            "inspection. For more information on this warning, search for content normalization "
  729|      0|            "in the manual.");
  730|      0|    }
  731|       |
  732|  43.8k|    return true;
  733|  46.3k|}
_ZN4qpdf6Stream17replaceStreamDataEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERK16QPDFObjectHandleSB_:
  738|  20.4k|{
  739|  20.4k|    auto s = stream();
  740|  20.4k|    s->stream_data = std::make_shared<Buffer>(std::move(data));
  741|  20.4k|    s->stream_provider = nullptr;
  742|  20.4k|    replaceFilterData(filter, decode_parms, s->stream_data->getSize());
  743|  20.4k|}
_ZN4qpdf6Stream17replaceStreamDataENSt3__110shared_ptrI6BufferEERK16QPDFObjectHandleS7_:
  750|     12|{
  751|     12|    auto s = stream();
  752|     12|    s->stream_data = data;
  753|     12|    s->stream_provider = nullptr;
  754|     12|    replaceFilterData(filter, decode_parms, data->size());
  755|     12|}
_ZN4qpdf6Stream17replaceStreamDataENSt3__110shared_ptrIN16QPDFObjectHandle18StreamDataProviderEEERKS3_S7_:
  762|  5.03k|{
  763|  5.03k|    auto s = stream();
  764|  5.03k|    s->stream_provider = provider;
  765|  5.03k|    s->stream_data = nullptr;
  766|  5.03k|    replaceFilterData(filter, decode_parms, 0);
  767|  5.03k|}
_ZN4qpdf6Stream17replaceFilterDataERK16QPDFObjectHandleS3_m:
  772|  25.4k|{
  773|  25.4k|    auto s = stream();
  774|  25.4k|    if (filter) {
  ------------------
  |  Branch (774:9): [True: 14.4k, False: 10.9k]
  ------------------
  775|  14.4k|        s->stream_dict.replaceKey("/Filter", filter);
  776|  14.4k|    }
  777|  25.4k|    if (decode_parms) {
  ------------------
  |  Branch (777:9): [True: 14.1k, False: 11.3k]
  ------------------
  778|  14.1k|        s->stream_dict.replaceKey("/DecodeParms", decode_parms);
  779|  14.1k|    }
  780|  25.4k|    if (length == 0) {
  ------------------
  |  Branch (780:9): [True: 5.39k, False: 20.0k]
  ------------------
  781|  5.39k|        s->stream_dict.removeKey("/Length");
  782|  20.0k|    } else {
  783|  20.0k|        Length(length);
  784|  20.0k|    }
  785|  25.4k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  5.75k|{
  790|  5.75k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  5.75k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  43.1k|{
  796|  43.1k|    return as_stream(error).getDict();
  797|  43.1k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  7.93k|{
  832|  7.93k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  7.93k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
  861|  27.1k|{
  862|  27.1k|    bool filtering_attempted;
  863|  27.1k|    as_stream(error).pipeStreamData(
  864|  27.1k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
  865|  27.1k|    return filtering_attempted;
  866|  27.1k|}
_ZN16QPDFObjectHandle17replaceStreamDataERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_SA_:
  897|  10.9k|{
  898|  10.9k|    std::string s(data);
  899|  10.9k|    as_stream(error).replaceStreamData(std::move(s), filter, decode_parms);
  900|  10.9k|}
_ZN16QPDFObjectHandle17replaceStreamDataENSt3__110shared_ptrINS_18StreamDataProviderEEERKS_S5_:
  907|  4.63k|{
  908|  4.63k|    as_stream(error).replaceStreamData(provider, filter, decode_parms);
  909|  4.63k|}
_ZN4QPDF3Doc7Objects7Streams6Copier13register_copyERN4qpdf6StreamES6_b:
  109|    399|    {
  110|    399|        qpdf_expect(source);
  ------------------
  |  |   13|    399|#define qpdf_expect assert
  ------------------
  |  Branch (110:9): [True: 399, False: 0]
  ------------------
  111|    399|        qpdf_expect(dest);
  ------------------
  |  |   13|    399|#define qpdf_expect assert
  ------------------
  |  Branch (111:9): [True: 399, False: 0]
  ------------------
  112|    399|        if (provider) {
  ------------------
  |  Branch (112:13): [True: 0, False: 399]
  ------------------
  113|      0|            copied_streams.insert_or_assign(dest, source);
  114|    399|        } else {
  115|    399|            copied_data.insert_or_assign(dest, Data(source, dest.getDict()));
  116|    399|        }
  117|    399|    }
_ZN4QPDF3Doc7Objects7Streams6Copier4DataC2ERN4qpdf6StreamERKNS5_10DictionaryE:
   38|    399|            encp(source.qpdf()->m->encp),
   39|    399|            file(source.qpdf()->m->file),
   40|    399|            source_og(source.id_gen()),
   41|    399|            offset(source.offset()),
   42|    399|            length(source.getLength()),
   43|    399|            dest_dict(dest_dict),
   44|    399|            is_root_metadata(source.isRootMetadata())
   45|    399|        {
   46|    399|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  47.7k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  47.7k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 267, False: 47.4k]
  |  Branch (556:13): [True: 283, False: 47.4k]
  ------------------
  557|  47.4k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 44.9k, False: 2.57k]
  |  Branch (557:39): [True: 20, False: 44.8k]
  ------------------
  558|  47.4k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 47.4k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    283|            return false;
  560|    283|        }
  561|  47.4k|        return true;
  562|  47.7k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  25.9k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  25.9k|        streams(streams)
   69|  25.9k|    {
   70|  25.9k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  25.9k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|  3.51k|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|  3.51k|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|  3.45k|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|  3.45k|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 2.44k, False: 1.01k]
  ------------------
  144|  8.96k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 8.96k, False: 2.34k]
  ------------------
  145|  8.96k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 1.72k, False: 7.24k]
  |  Branch (145:25): [True: 1.67k, False: 7.28k]
  ------------------
  146|  1.72k|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 371, False: 1.35k]
  |  Branch (146:42): [True: 1.30k, False: 44]
  ------------------
  147|  1.67k|                        continue;
  148|  1.67k|                    }
  149|  7.28k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 1.72k, False: 5.56k]
  ------------------
  150|  1.72k|                        continue;
  151|  1.72k|                    }
  152|  5.56k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 94, False: 5.47k]
  ------------------
  153|     94|                        return false;
  154|     94|                    }
  155|  5.56k|                }
  156|  2.34k|                return true;
  157|  2.44k|            }
  158|  1.01k|            return decode_parms.null();
  159|  3.45k|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|  3.34k|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|  3.34k|            return nullptr;
  166|  3.34k|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  5.64k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZN11QPDF_String9writeJSONEiRN4JSON6WriterE:
   18|   110k|{
   19|   110k|    if (json_version == 1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 110k]
  ------------------
   20|      0|        if (util::is_utf16(val)) {
  ------------------
  |  Branch (20:13): [True: 0, False: 0]
  ------------------
   21|      0|            p << "\"" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   22|      0|            return;
   23|      0|        }
   24|      0|        if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (24:13): [True: 0, False: 0]
  ------------------
   25|       |            // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte
   26|       |            // representation of U+FEFF.
   27|      0|            p << "\"" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   28|      0|            return;
   29|      0|        }
   30|      0|        p << "\"" << JSON::Writer::encode_string(QUtil::pdf_doc_to_utf8(val)) << "\"";
   31|      0|        return;
   32|      0|    }
   33|       |    // See if we can unambiguously represent as Unicode.
   34|   110k|    if (util::is_utf16(val)) {
  ------------------
  |  Branch (34:9): [True: 8.25k, False: 102k]
  ------------------
   35|  8.25k|        p << "\"u:" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   36|  8.25k|        return;
   37|  8.25k|    }
   38|       |    // See if we can unambiguously represent as Unicode.
   39|   102k|    if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (39:9): [True: 3.14k, False: 99.0k]
  ------------------
   40|  3.14k|        p << "\"u:" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   41|  3.14k|        return;
   42|  3.14k|    }
   43|  99.0k|    if (!useHexString()) {
  ------------------
  |  Branch (43:9): [True: 57.8k, False: 41.2k]
  ------------------
   44|  57.8k|        auto candidate = QUtil::pdf_doc_to_utf8(val);
   45|  57.8k|        std::string test;
   46|  57.8k|        if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && test == val) {
  ------------------
  |  Branch (46:13): [True: 57.8k, False: 0]
  |  Branch (46:61): [True: 50.8k, False: 6.94k]
  ------------------
   47|       |            // This is a PDF-doc string that can be losslessly encoded as Unicode.
   48|  50.8k|            p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
   49|  50.8k|            return;
   50|  50.8k|        }
   51|  57.8k|    }
   52|  48.1k|    p << "\"b:" << QUtil::hex_encode(val) << "\"";
   53|  48.1k|}
_ZNK11QPDF_String12useHexStringEv:
   57|   146k|{
   58|       |    // Heuristic: use the hexadecimal representation of a string if there are any non-printable (in
   59|       |    // PDF Doc encoding) characters or if too large of a proportion of the string consists of
   60|       |    // non-ASCII characters.
   61|   146k|    unsigned int non_ascii = 0;
   62|  47.0M|    for (auto const ch: val) {
  ------------------
  |  Branch (62:23): [True: 47.0M, False: 120k]
  ------------------
   63|  47.0M|        if (ch > 126) {
  ------------------
  |  Branch (63:13): [True: 74.5k, False: 47.0M]
  ------------------
   64|  74.5k|            ++non_ascii;
   65|  47.0M|        } else if (ch >= 32) {
  ------------------
  |  Branch (65:20): [True: 23.5M, False: 23.5M]
  ------------------
   66|  23.5M|            continue;
   67|  23.5M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (67:20): [True: 5.81M, False: 17.6M]
  |  Branch (67:30): [True: 112k, False: 17.5M]
  ------------------
   68|  5.93M|            ++non_ascii;
   69|  17.5M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (69:22): [True: 234k, False: 17.3M]
  |  Branch (69:36): [True: 3.23k, False: 17.3M]
  |  Branch (69:50): [True: 195k, False: 17.1M]
  |  Branch (69:64): [True: 17.0M, False: 79.4k]
  |  Branch (69:78): [True: 53.8k, False: 25.6k]
  ------------------
   70|  25.6k|            return true;
   71|  25.6k|        }
   72|  47.0M|    }
   73|   120k|    return 5 * non_ascii > val.length();
   74|   146k|}
_ZN11QPDF_String7unparseEb:
   78|  47.0k|{
   79|  47.0k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (79:26): [True: 0, False: 47.0k]
  |  Branch (79:42): [True: 13.9k, False: 33.1k]
  ------------------
   80|  47.0k|    std::string result;
   81|  47.0k|    if (use_hexstring) {
  ------------------
  |  Branch (81:9): [True: 13.9k, False: 33.1k]
  ------------------
   82|  13.9k|        static auto constexpr hexchars = "0123456789abcdef";
   83|  13.9k|        result.reserve(2 * val.length() + 2);
   84|  13.9k|        result += '<';
   85|  40.9M|        for (const char c: val) {
  ------------------
  |  Branch (85:26): [True: 40.9M, False: 13.9k]
  ------------------
   86|  40.9M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
   87|  40.9M|            result += hexchars[c & 0x0f];
   88|  40.9M|        }
   89|  13.9k|        result += '>';
   90|  33.1k|    } else {
   91|  33.1k|        result += "(";
   92|  24.9M|        for (unsigned int i = 0; i < val.length(); ++i) {
  ------------------
  |  Branch (92:34): [True: 24.8M, False: 33.1k]
  ------------------
   93|  24.8M|            char ch = val.at(i);
   94|  24.8M|            switch (ch) {
   95|   152k|            case '\n':
  ------------------
  |  Branch (95:13): [True: 152k, False: 24.7M]
  ------------------
   96|   152k|                result += "\\n";
   97|   152k|                break;
   98|       |
   99|  1.76k|            case '\r':
  ------------------
  |  Branch (99:13): [True: 1.76k, False: 24.8M]
  ------------------
  100|  1.76k|                result += "\\r";
  101|  1.76k|                break;
  102|       |
  103|   139k|            case '\t':
  ------------------
  |  Branch (103:13): [True: 139k, False: 24.7M]
  ------------------
  104|   139k|                result += "\\t";
  105|   139k|                break;
  106|       |
  107|  7.96M|            case '\b':
  ------------------
  |  Branch (107:13): [True: 7.96M, False: 16.9M]
  ------------------
  108|  7.96M|                result += "\\b";
  109|  7.96M|                break;
  110|       |
  111|  37.1k|            case '\f':
  ------------------
  |  Branch (111:13): [True: 37.1k, False: 24.8M]
  ------------------
  112|  37.1k|                result += "\\f";
  113|  37.1k|                break;
  114|       |
  115|  14.7k|            case '(':
  ------------------
  |  Branch (115:13): [True: 14.7k, False: 24.8M]
  ------------------
  116|  14.7k|                result += "\\(";
  117|  14.7k|                break;
  118|       |
  119|  14.6k|            case ')':
  ------------------
  |  Branch (119:13): [True: 14.6k, False: 24.8M]
  ------------------
  120|  14.6k|                result += "\\)";
  121|  14.6k|                break;
  122|       |
  123|  4.25k|            case '\\':
  ------------------
  |  Branch (123:13): [True: 4.25k, False: 24.8M]
  ------------------
  124|  4.25k|                result += "\\\\";
  125|  4.25k|                break;
  126|       |
  127|  16.5M|            default:
  ------------------
  |  Branch (127:13): [True: 16.5M, False: 8.32M]
  ------------------
  128|  16.5M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (128:21): [True: 16.3M, False: 224k]
  ------------------
  129|  16.3M|                    result += val.at(i);
  130|  16.3M|                } else {
  131|   224k|                    result += "\\" +
  132|   224k|                        QUtil::int_to_string_base(
  133|   224k|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  134|   224k|                }
  135|  16.5M|                break;
  136|  24.8M|            }
  137|  24.8M|        }
  138|  33.1k|        result += ")";
  139|  33.1k|    }
  140|       |
  141|  47.0k|    return result;
  142|  47.0k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   12|  16.5M|{
   13|  16.5M|    return (ch >= 32 && ch <= 126) || static_cast<unsigned char>(ch) >= 160;
  ------------------
  |  Branch (13:13): [True: 16.2M, False: 362k]
  |  Branch (13:25): [True: 16.2M, False: 3.69k]
  |  Branch (13:39): [True: 142k, False: 224k]
  ------------------
   14|  16.5M|}

_ZNK4QPDF3Doc10Encryption4getVEv:
  131|  4.61k|{
  132|  4.61k|    return this->V;
  133|  4.61k|}
_ZNK4QPDF3Doc10Encryption4getREv:
  137|  8.04k|{
  138|  8.04k|    return this->R;
  139|  8.04k|}
_ZNK4QPDF3Doc10Encryption14getLengthBytesEv:
  143|  3.06k|{
  144|  3.06k|    return this->Length_bytes;
  145|  3.06k|}
_ZNK4QPDF3Doc10Encryption4getPEv:
  149|  1.72k|{
  150|  1.72k|    return static_cast<int>(P.to_ulong());
  151|  1.72k|}
_ZNK4QPDF3Doc10Encryption4getOEv:
  169|  3.94k|{
  170|  3.94k|    return this->O;
  171|  3.94k|}
_ZNK4QPDF3Doc10Encryption4getUEv:
  175|  4.83k|{
  176|  4.83k|    return this->U;
  177|  4.83k|}
_ZNK4QPDF3Doc10Encryption5getOEEv:
  181|    176|{
  182|    176|    return this->OE;
  183|    176|}
_ZNK4QPDF3Doc10Encryption5getUEEv:
  187|    314|{
  188|    314|    return this->UE;
  189|    314|}
_ZNK4QPDF3Doc10Encryption8getPermsEv:
  193|    490|{
  194|    490|    return this->Perms;
  195|    490|}
_ZNK4QPDF3Doc10Encryption6getId1Ev:
  199|  2.04k|{
  200|  2.04k|    return this->id1;
  201|  2.04k|}
_ZNK4QPDF3Doc10Encryption18getEncryptMetadataEv:
  205|  1.35k|{
  206|  1.35k|    return this->encrypt_metadata;
  207|  1.35k|}
_ZN4QPDF18trim_user_passwordERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  257|     41|{
  258|       |    // Although unnecessary, this routine trims the padding string from the end of a user password.
  259|       |    // Its only purpose is for recovery of user passwords which is done in the test suite.
  260|     41|    if (user_password.size() < key_bytes) {
  ------------------
  |  Branch (260:9): [True: 0, False: 41]
  ------------------
  261|      0|        return;
  262|      0|    }
  263|       |
  264|     41|    auto idx = user_password.find('\x28');
  265|       |
  266|     43|    while (idx != user_password.npos) {
  ------------------
  |  Branch (266:12): [True: 2, False: 41]
  ------------------
  267|      2|        if (padding_string.starts_with(user_password.substr(idx))) {
  ------------------
  |  Branch (267:13): [True: 0, False: 2]
  ------------------
  268|      0|            user_password.resize(idx);
  269|      0|            return;
  270|      0|        }
  271|      2|        QTC::TC("qpdf", "QPDF_encryption skip 0x28");
  272|      2|        idx = user_password.find('\x28', ++idx);
  273|      2|    }
  274|     41|}
_ZNK4QPDF3Doc10Encryption7hash_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_:
  346|  2.84k|{
  347|  2.84k|    Pl_SHA2 hash(256);
  348|  2.84k|    hash.writeString(password);
  349|  2.84k|    hash.writeString(salt);
  350|  2.84k|    hash.writeString(udata);
  351|  2.84k|    hash.finish();
  352|  2.84k|    std::string K = hash.getRawDigest();
  353|       |
  354|  2.84k|    std::string result;
  355|  2.84k|    if (getR() < 6) {
  ------------------
  |  Branch (355:9): [True: 260, False: 2.58k]
  ------------------
  356|    260|        result = K;
  357|  2.58k|    } else {
  358|       |        // Algorithm 2.B from ISO 32000-1 chapter 7: Computing a hash
  359|       |
  360|  2.58k|        int round_number = 0;
  361|  2.58k|        bool done = false;
  362|   181k|        while (!done) {
  ------------------
  |  Branch (362:16): [True: 179k, False: 2.58k]
  ------------------
  363|       |            // The hash algorithm has us setting K initially to the R5 value and then repeating a
  364|       |            // series of steps 64 times before starting with the termination case testing.  The
  365|       |            // wording of the specification is very unclear as to the exact number of times it
  366|       |            // should be run since the wording about whether the initial setup counts as round 0 or
  367|       |            // not is ambiguous.  This code counts the initial setup (R5) value as round 0, which
  368|       |            // appears to be correct.  This was determined to be correct by increasing or decreasing
  369|       |            // the number of rounds by 1 or 2 from this value and generating 20 test files.  In this
  370|       |            // interpretation, all the test files worked with Adobe Reader X.  In the other
  371|       |            // configurations, many of the files did not work, and we were accurately able to
  372|       |            // predict which files didn't work by looking at the conditions under which we
  373|       |            // terminated repetition.
  374|       |
  375|   179k|            ++round_number;
  376|   179k|            std::string K1 = password + K + udata;
  377|   179k|            qpdf_assert_debug(K.length() >= 32);
  ------------------
  |  |   11|   179k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (377:13): [True: 179k, False: 0]
  ------------------
  378|   179k|            std::string E = process_with_aes(
  379|   179k|                K.substr(0, 16),
  380|   179k|                true,
  381|   179k|                K1,
  382|   179k|                0,
  383|   179k|                64,
  384|   179k|                QUtil::unsigned_char_pointer(K.substr(16, 16)),
  385|   179k|                16);
  386|       |
  387|       |            // E_mod_3 is supposed to be mod 3 of the first 16 bytes of E taken as as a (128-bit)
  388|       |            // big-endian number.  Since (xy mod n) is equal to ((x mod n) + (y mod n)) mod n and
  389|       |            // since 256 mod n is 1, we can just take the sums of the the mod 3s of each byte to get
  390|       |            // the same result.
  391|   179k|            int E_mod_3 = 0;
  392|  3.04M|            for (unsigned int i = 0; i < 16; ++i) {
  ------------------
  |  Branch (392:38): [True: 2.86M, False: 179k]
  ------------------
  393|  2.86M|                E_mod_3 += static_cast<unsigned char>(E.at(i));
  394|  2.86M|            }
  395|   179k|            E_mod_3 %= 3;
  396|   179k|            int next_hash = ((E_mod_3 == 0) ? 256 : (E_mod_3 == 1) ? 384 : 512);
  ------------------
  |  Branch (396:30): [True: 61.1k, False: 117k]
  |  Branch (396:53): [True: 58.8k, False: 59.1k]
  ------------------
  397|   179k|            Pl_SHA2 sha2(next_hash);
  398|   179k|            sha2.writeString(E);
  399|   179k|            sha2.finish();
  400|   179k|            K = sha2.getRawDigest();
  401|       |
  402|   179k|            if (round_number >= 64) {
  ------------------
  |  Branch (402:17): [True: 16.1k, False: 162k]
  ------------------
  403|  16.1k|                unsigned int ch = static_cast<unsigned char>(*(E.rbegin()));
  404|       |
  405|  16.1k|                if (ch <= QIntC::to_uint(round_number - 32)) {
  ------------------
  |  Branch (405:21): [True: 2.58k, False: 13.6k]
  ------------------
  406|  2.58k|                    done = true;
  407|  2.58k|                }
  408|  16.1k|            }
  409|   179k|        }
  410|  2.58k|        result = K.substr(0, 32);
  411|  2.58k|    }
  412|       |
  413|  2.84k|    return result;
  414|  2.84k|}
_ZN4QPDF16compute_data_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiibii:
  433|  4.36k|{
  434|       |    // Algorithm 3.1 from the PDF 1.7 Reference Manual
  435|       |
  436|  4.36k|    std::string result = encryption_key;
  437|       |
  438|  4.36k|    if (encryption_V >= 5) {
  ------------------
  |  Branch (438:9): [True: 1.70k, False: 2.66k]
  ------------------
  439|       |        // Algorithm 3.1a (PDF 1.7 extension level 3): just use encryption key straight.
  440|  1.70k|        return result;
  441|  1.70k|    }
  442|       |
  443|       |    // Append low three bytes of object ID and low two bytes of generation
  444|  2.66k|    result.append(1, static_cast<char>(objid & 0xff));
  445|  2.66k|    result.append(1, static_cast<char>((objid >> 8) & 0xff));
  446|  2.66k|    result.append(1, static_cast<char>((objid >> 16) & 0xff));
  447|  2.66k|    result.append(1, static_cast<char>(generation & 0xff));
  448|  2.66k|    result.append(1, static_cast<char>((generation >> 8) & 0xff));
  449|  2.66k|    if (use_aes) {
  ------------------
  |  Branch (449:9): [True: 798, False: 1.86k]
  ------------------
  450|    798|        result += "sAlT";
  451|    798|    }
  452|  2.66k|    return MD5::digest(result).substr(0, result.size());
  453|  4.36k|}
_ZNK4QPDF3Doc10Encryption22compute_encryption_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  475|  1.23k|{
  476|  1.23k|    if (getV() >= 5) {
  ------------------
  |  Branch (476:9): [True: 0, False: 1.23k]
  ------------------
  477|       |        // For V >= 5, the encryption key is generated and stored in the file, encrypted separately
  478|       |        // with both user and owner passwords.
  479|      0|        return recover_encryption_key_with_password(password);
  480|  1.23k|    } else {
  481|       |        // For V < 5, the encryption key is derived from the user
  482|       |        // password.
  483|  1.23k|        return compute_encryption_key_from_password(password);
  484|  1.23k|    }
  485|  1.23k|}
_ZNK4QPDF3Doc10Encryption36compute_encryption_key_from_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  489|  1.23k|{
  490|       |    // Algorithm 3.2 from the PDF 1.7 Reference Manual
  491|       |
  492|       |    // This code does not properly handle Unicode passwords. Passwords are supposed to be converted
  493|       |    // from OS codepage characters to PDFDocEncoding.  Unicode passwords are supposed to be
  494|       |    // converted to OS codepage before converting to PDFDocEncoding.  We instead require the
  495|       |    // password to be presented in its final form.
  496|       |
  497|  1.23k|    MD5 md5;
  498|  1.23k|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  499|  1.23k|    md5.encodeDataIncrementally(getO());
  500|  1.23k|    char pbytes[4];
  501|  1.23k|    int p = getP();
  502|  1.23k|    pbytes[0] = static_cast<char>(p & 0xff);
  503|  1.23k|    pbytes[1] = static_cast<char>((p >> 8) & 0xff);
  504|  1.23k|    pbytes[2] = static_cast<char>((p >> 16) & 0xff);
  505|  1.23k|    pbytes[3] = static_cast<char>((p >> 24) & 0xff);
  506|  1.23k|    md5.encodeDataIncrementally(pbytes, 4);
  507|  1.23k|    md5.encodeDataIncrementally(getId1());
  508|  1.23k|    if (getR() >= 4 && !getEncryptMetadata()) {
  ------------------
  |  Branch (508:9): [True: 860, False: 372]
  |  Branch (508:24): [True: 0, False: 860]
  ------------------
  509|      0|        md5.encodeDataIncrementally("\xff\xff\xff\xff");
  510|      0|    }
  511|  1.23k|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (511:37): [True: 1.13k, False: 101]
  ------------------
  512|  1.23k|}
_ZNK4QPDF3Doc10Encryption17compute_O_rc4_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  517|    469|{
  518|    469|    if (getV() >= 5) {
  ------------------
  |  Branch (518:9): [True: 0, False: 469]
  ------------------
  519|      0|        throw std::logic_error("compute_O_rc4_key called for file with V >= 5");
  520|      0|    }
  521|    469|    std::string password = owner_password.empty() ? user_password : owner_password;
  ------------------
  |  Branch (521:28): [True: 469, False: 0]
  ------------------
  522|    469|    MD5 md5;
  523|    469|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  524|    469|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (524:37): [True: 428, False: 41]
  ------------------
  525|    469|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  542|     81|{
  543|       |    // Algorithm 3.4 from the PDF 1.7 Reference Manual
  544|       |
  545|     81|    std::string k1 = compute_encryption_key(user_password);
  546|     81|    auto udata = padding_string;
  547|     81|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  548|     81|    iterate_rc4(udata, k1, 1, false);
  549|     81|    return udata;
  550|     81|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R3ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  554|    816|{
  555|       |    // Algorithm 3.5 from the PDF 1.7 Reference Manual
  556|       |
  557|    816|    std::string k1 = compute_encryption_key(user_password);
  558|    816|    MD5 md5;
  559|    816|    md5.encodeDataIncrementally(padding_string);
  560|    816|    md5.encodeDataIncrementally(getId1());
  561|    816|    auto result = md5.digest();
  562|    816|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  563|    816|    iterate_rc4(result, k1, 20, false);
  564|       |    // pad with arbitrary data -- make it consistent for the sake of testing
  565|    816|    result += "\x0\x21\x44\x69\x90\xb9\xe4\x11\x40\x71\xa4\xd9\x10\x49\x84\xc1"s;
  566|    816|    return result;
  567|    816|}
_ZNK4QPDF3Doc10Encryption15compute_U_valueERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  571|    897|{
  572|    897|    if (getR() >= 3) {
  ------------------
  |  Branch (572:9): [True: 816, False: 81]
  ------------------
  573|    816|        return compute_U_value_R3(user_password);
  574|    816|    }
  575|       |
  576|     81|    return compute_U_value_R2(user_password);
  577|    897|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V4ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  581|    897|{
  582|       |    // Algorithm 3.6 from the PDF 1.7 Reference Manual
  583|       |
  584|    897|    std::string u_value = compute_U_value(user_password);
  585|    897|    size_t to_compare = (getR() >= 3 ? sizeof(MD5::Digest) : key_bytes);
  ------------------
  |  Branch (585:26): [True: 816, False: 81]
  ------------------
  586|    897|    return memcmp(getU().c_str(), u_value.c_str(), to_compare) == 0;
  587|    897|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  591|  1.09k|{
  592|       |    // Algorithm 3.11 from the PDF 1.7 extension level 3
  593|       |
  594|  1.09k|    std::string user_data = getU().substr(0, 32);
  595|  1.09k|    std::string validation_salt = getU().substr(32, 8);
  596|  1.09k|    std::string password = user_password.substr(0, 127);
  597|  1.09k|    return hash_V5(user_password.substr(0, 127), validation_salt, "") == user_data;
  598|  1.09k|}
_ZNK4QPDF3Doc10Encryption19check_user_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  602|  1.67k|{
  603|  1.67k|    if (getV() < 5) {
  ------------------
  |  Branch (603:9): [True: 897, False: 776]
  ------------------
  604|    897|        return check_user_password_V4(user_password);
  605|    897|    } else {
  606|    776|        return check_user_password_V5(user_password);
  607|    776|    }
  608|  1.67k|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V4ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  613|    469|{
  614|       |    // Algorithm 3.7 from the PDF 1.7 Reference Manual
  615|       |
  616|    469|    auto key = compute_O_rc4_key(user_password, owner_password);
  617|    469|    pad_short_parameter(key, QIntC::to_size(getLengthBytes()));
  618|    469|    auto new_user_password = O.substr(0, key_bytes);
  619|    469|    iterate_rc4(new_user_password, key, (getR() >= 3) ? 20 : 1, true);
  ------------------
  |  Branch (619:41): [True: 428, False: 41]
  ------------------
  620|    469|    if (check_user_password(new_user_password)) {
  ------------------
  |  Branch (620:9): [True: 41, False: 428]
  ------------------
  621|     41|        user_password = new_user_password;
  622|     41|        return true;
  623|     41|    }
  624|    428|    return false;
  625|    469|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  629|  1.26k|{
  630|       |    // Algorithm 3.12 from the PDF 1.7 extension level 3
  631|       |
  632|  1.26k|    std::string user_data = getU().substr(0, 48);
  633|  1.26k|    std::string owner_data = getO().substr(0, 32);
  634|  1.26k|    std::string validation_salt = getO().substr(32, 8);
  635|  1.26k|    return hash_V5(owner_password.substr(0, 127), validation_salt, user_data) == owner_data;
  636|  1.26k|}
_ZNK4QPDF3Doc10Encryption20check_owner_passwordERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  641|  1.24k|{
  642|  1.24k|    if (getV() < 5) {
  ------------------
  |  Branch (642:9): [True: 469, False: 776]
  ------------------
  643|    469|        return check_owner_password_V4(user_password, owner_password);
  644|    776|    } else {
  645|    776|        return check_owner_password_V5(owner_password);
  646|    776|    }
  647|  1.24k|}
_ZNK4QPDF3Doc10Encryption28compute_Perms_value_V5_clearEv:
  659|    490|{
  660|       |    // From algorithm 3.10 from the PDF 1.7 extension level 3
  661|       |    // cSpell:ignore Tadb
  662|    490|    std::string k = "    \xff\xff\xff\xffTadb    ";
  663|    490|    int perms = getP();
  664|  2.45k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (664:24): [True: 1.96k, False: 490]
  ------------------
  665|  1.96k|        k[i] = static_cast<char>(perms & 0xff);
  666|  1.96k|        perms >>= 8;
  667|  1.96k|    }
  668|    490|    if (!getEncryptMetadata()) {
  ------------------
  |  Branch (668:9): [True: 6, False: 484]
  ------------------
  669|      6|        k[8] = 'F';
  670|      6|    }
  671|    490|    QUtil::initializeWithRandomBytes(reinterpret_cast<unsigned char*>(&k[12]), 4);
  672|    490|    return k;
  673|    490|}
_ZNK4QPDF3Doc10Encryption36recover_encryption_key_with_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERb:
  678|    490|{
  679|       |    // Algorithm 3.2a from the PDF 1.7 extension level 3
  680|       |
  681|       |    // This code does not handle Unicode passwords correctly. Empirical evidence suggests that most
  682|       |    // viewers don't.  We are supposed to process the input string with the SASLprep (RFC 4013)
  683|       |    // profile of stringprep (RFC 3454) and then convert the result to UTF-8.
  684|       |
  685|    490|    perms_valid = false;
  686|    490|    std::string key_password = password.substr(0, 127);
  687|    490|    std::string key_salt;
  688|    490|    std::string user_data;
  689|    490|    std::string encrypted_file_key;
  690|    490|    if (check_owner_password_V5(key_password)) {
  ------------------
  |  Branch (690:9): [True: 176, False: 314]
  ------------------
  691|    176|        key_salt = getO().substr(40, 8);
  692|    176|        user_data = getU().substr(0, 48);
  693|    176|        encrypted_file_key = getOE().substr(0, 32);
  694|    314|    } else if (check_user_password_V5(key_password)) {
  ------------------
  |  Branch (694:16): [True: 314, False: 0]
  ------------------
  695|    314|        key_salt = getU().substr(40, 8);
  696|    314|        encrypted_file_key = getUE().substr(0, 32);
  697|    314|    }
  698|    490|    std::string intermediate_key = hash_V5(key_password, key_salt, user_data);
  699|    490|    std::string file_key = process_with_aes(intermediate_key, false, encrypted_file_key);
  700|       |
  701|       |    // Decrypt Perms and check against expected value
  702|    490|    auto perms_check = process_with_aes(file_key, false, getPerms()).substr(0, 12);
  703|    490|    perms_valid = compute_Perms_value_V5_clear().substr(0, 12) == perms_check;
  704|    490|    return file_key;
  705|    490|}
_ZNK4QPDF20EncryptionParameters11interpretCFERKN4qpdf4NameE:
  709|  3.50k|{
  710|  3.50k|    if (!cf) {
  ------------------
  |  Branch (710:9): [True: 895, False: 2.60k]
  ------------------
  711|       |        // Default: /Identity
  712|    895|        return e_none;
  713|    895|    }
  714|  2.60k|    auto it = crypt_filters.find(cf);
  715|  2.60k|    if (it != crypt_filters.end()) {
  ------------------
  |  Branch (715:9): [True: 206, False: 2.39k]
  ------------------
  716|    206|        return it->second;
  717|    206|    }
  718|  2.39k|    if (cf == "/Identity") {
  ------------------
  |  Branch (718:9): [True: 10, False: 2.38k]
  ------------------
  719|     10|        return e_none;
  720|     10|    }
  721|  2.38k|    return e_unknown;
  722|  2.39k|}
_ZN4QPDF20EncryptionParameters10initializeERS_:
  732|  11.1k|{
  733|  11.1k|    if (encryption_initialized) {
  ------------------
  |  Branch (733:9): [True: 6, False: 11.1k]
  ------------------
  734|      6|        return;
  735|      6|    }
  736|  11.1k|    encryption_initialized = true;
  737|       |
  738|  11.1k|    auto& c = qpdf.m->c;
  739|  11.1k|    auto& qm = *qpdf.m;
  740|  11.1k|    auto& trailer = qm.trailer;
  741|  11.1k|    auto& file = qm.file;
  742|       |
  743|  11.1k|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|  11.1k|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|  11.1k|    };
  746|  11.1k|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|  11.1k|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|  11.1k|    };
  749|  11.1k|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|  11.1k|        return {
  751|  11.1k|            qpdf_e_unsupported,
  752|  11.1k|            file->getName(),
  753|  11.1k|            "encryption dictionary",
  754|  11.1k|            file->getLastOffset(),
  755|  11.1k|            msg};
  756|  11.1k|    };
  757|       |
  758|       |    // After we initialize encryption parameters, we must use stored key information and never look
  759|       |    // at /Encrypt again.  Otherwise, things could go wrong if someone mutates the encryption
  760|       |    // dictionary.
  761|       |
  762|  11.1k|    if (!trailer.contains("/Encrypt")) {
  ------------------
  |  Branch (762:9): [True: 9.67k, False: 1.42k]
  ------------------
  763|  9.67k|        return;
  764|  9.67k|    }
  765|       |
  766|       |    // Go ahead and set m->encrypted here.  That way, isEncrypted will return true even if there
  767|       |    // were errors reading the encryption dictionary.
  768|  1.42k|    encrypted = true;
  769|       |
  770|  1.42k|    std::string id1;
  771|  1.42k|    auto id_obj = trailer.getKey("/ID");
  772|  1.42k|    if (id_obj.size() != 2 || !id_obj.getArrayItem(0).isString()) {
  ------------------
  |  Branch (772:9): [True: 1.01k, False: 407]
  |  Branch (772:9): [True: 1.02k, False: 404]
  |  Branch (772:31): [True: 5, False: 402]
  ------------------
  773|       |        // Treating a missing ID as the empty string enables qpdf to decrypt some invalid encrypted
  774|       |        // files with no /ID that poppler can read but Adobe Reader can't.
  775|  1.02k|        qpdf.warn(qpdf.m->c.damagedPDF("trailer", "invalid /ID in trailer dictionary"));
  776|  1.02k|    } else {
  777|    404|        id1 = id_obj.getArrayItem(0).getStringValue();
  778|    404|    }
  779|       |
  780|  1.42k|    auto encryption_dict = trailer.getKey("/Encrypt");
  781|  1.42k|    if (!encryption_dict.isDictionary()) {
  ------------------
  |  Branch (781:9): [True: 78, False: 1.34k]
  ------------------
  782|     78|        throw qpdf.m->c.damagedPDF("/Encrypt in trailer dictionary is not a dictionary");
  783|     78|    }
  784|       |
  785|  1.34k|    if (Name(encryption_dict["/Filter"]) != "/Standard") {
  ------------------
  |  Branch (785:9): [True: 7, False: 1.34k]
  ------------------
  786|      7|        throw unsupported("unsupported encryption filter");
  787|      7|    }
  788|  1.34k|    if (!encryption_dict.getKey("/SubFilter").null()) {
  ------------------
  |  Branch (788:9): [True: 3, False: 1.33k]
  ------------------
  789|      3|        qpdf.warn(unsupported("file uses encryption SubFilters, which qpdf does not support"));
  790|      3|    }
  791|       |
  792|  1.34k|    if (!(encryption_dict.getKey("/V").isInteger() && encryption_dict.getKey("/R").isInteger() &&
  ------------------
  |  Branch (792:9): [True: 12, False: 1.32k]
  |  Branch (792:11): [True: 1.33k, False: 7]
  |  Branch (792:55): [True: 1.32k, False: 4]
  ------------------
  793|  1.32k|          encryption_dict.getKey("/O").isString() && encryption_dict.getKey("/U").isString() &&
  ------------------
  |  Branch (793:11): [True: 1.32k, False: 3]
  |  Branch (793:54): [True: 1.32k, False: 4]
  ------------------
  794|  1.32k|          encryption_dict.getKey("/P").isInteger())) {
  ------------------
  |  Branch (794:11): [True: 1.32k, False: 2]
  ------------------
  795|     12|        throw_damaged_pdf("some encryption dictionary parameters are missing or the wrong type");
  796|     12|    }
  797|       |
  798|  1.34k|    int V = encryption_dict.getKey("/V").getIntValueAsInt();
  799|  1.34k|    int R = encryption_dict.getKey("/R").getIntValueAsInt();
  800|  1.34k|    std::string O = encryption_dict.getKey("/O").getStringValue();
  801|  1.34k|    std::string U = encryption_dict.getKey("/U").getStringValue();
  802|  1.34k|    int p = static_cast<int>(encryption_dict.getKey("/P").getIntValue());
  803|       |
  804|       |    // If supporting new encryption R/V values, remember to update error message inside this if
  805|       |    // statement.
  806|  1.34k|    if (!(2 <= R && R <= 6 && (V == 1 || V == 2 || V == 4 || V == 5))) {
  ------------------
  |  Branch (806:11): [True: 1.31k, False: 29]
  |  Branch (806:21): [True: 1.31k, False: 1]
  |  Branch (806:32): [True: 41, False: 1.26k]
  |  Branch (806:42): [True: 146, False: 1.12k]
  |  Branch (806:52): [True: 289, False: 834]
  |  Branch (806:62): [True: 782, False: 52]
  ------------------
  807|     61|        throw unsupported(
  808|     61|            "Unsupported /R or /V in encryption dictionary; R = " + std::to_string(R) +
  809|     61|            " (max 6), V = " + std::to_string(V) + " (max 5)");
  810|     61|    }
  811|       |
  812|  1.27k|    P_ = std::bitset<32>(static_cast<unsigned long long>(p));
  813|  1.27k|    encryption_V = V;
  814|  1.27k|    R_ = R;
  815|       |
  816|       |    // OE, UE, and Perms are only present if V >= 5.
  817|  1.27k|    std::string OE;
  818|  1.27k|    std::string UE;
  819|  1.27k|    std::string Perms;
  820|       |
  821|  1.27k|    if (V < 5) {
  ------------------
  |  Branch (821:9): [True: 476, False: 803]
  ------------------
  822|       |        // These must be exactly the right number of bytes.
  823|    476|        pad_short_parameter(O, key_bytes);
  824|    476|        pad_short_parameter(U, key_bytes);
  825|    476|        if (!(O.length() == key_bytes && U.length() == key_bytes)) {
  ------------------
  |  Branch (825:15): [True: 475, False: 1]
  |  Branch (825:42): [True: 470, False: 5]
  ------------------
  826|      6|            throw_damaged_pdf("incorrect length for /O and/or /U in encryption dictionary");
  827|      6|        }
  828|    803|    } else {
  829|    803|        if (!(encryption_dict.getKey("/OE").isString() &&
  ------------------
  |  Branch (829:13): [True: 4, False: 799]
  |  Branch (829:15): [True: 780, False: 23]
  ------------------
  830|    780|              encryption_dict.getKey("/UE").isString() &&
  ------------------
  |  Branch (830:15): [True: 779, False: 1]
  ------------------
  831|    779|              encryption_dict.getKey("/Perms").isString())) {
  ------------------
  |  Branch (831:15): [True: 778, False: 1]
  ------------------
  832|      4|            throw_damaged_pdf(
  833|      4|                "some V=5 encryption dictionary parameters are missing or the wrong type");
  834|      4|        }
  835|    803|        OE = encryption_dict.getKey("/OE").getStringValue();
  836|    803|        UE = encryption_dict.getKey("/UE").getStringValue();
  837|    803|        Perms = encryption_dict.getKey("/Perms").getStringValue();
  838|       |
  839|       |        // These may be longer than the minimum number of bytes.
  840|    803|        pad_short_parameter(O, OU_key_bytes_V5);
  841|    803|        pad_short_parameter(U, OU_key_bytes_V5);
  842|    803|        pad_short_parameter(OE, OUE_key_bytes_V5);
  843|    803|        pad_short_parameter(UE, OUE_key_bytes_V5);
  844|    803|        pad_short_parameter(Perms, Perms_key_bytes_V5);
  845|    803|    }
  846|       |
  847|  1.27k|    int Length = 128; // Just take a guess.
  848|  1.27k|    if (V <= 1) {
  ------------------
  |  Branch (848:9): [True: 40, False: 1.23k]
  ------------------
  849|     40|        Length = 40;
  850|  1.23k|    } else if (V == 4) {
  ------------------
  |  Branch (850:16): [True: 284, False: 955]
  ------------------
  851|    284|        Length = 128;
  852|    955|    } else if (V == 5) {
  ------------------
  |  Branch (852:16): [True: 778, False: 177]
  ------------------
  853|    778|        Length = 256;
  854|    778|    } else {
  855|    177|        if (encryption_dict.getKey("/Length").isInteger()) {
  ------------------
  |  Branch (855:13): [True: 81, False: 96]
  ------------------
  856|     81|            Length = encryption_dict.getKey("/Length").getIntValueAsInt();
  857|     81|            if (Length % 8 || Length < 40 || Length > 128) {
  ------------------
  |  Branch (857:17): [True: 30, False: 51]
  |  Branch (857:31): [True: 1, False: 50]
  |  Branch (857:46): [True: 1, False: 49]
  ------------------
  858|     32|                Length = 128; // Just take a guess.
  859|     32|            }
  860|     81|        }
  861|    177|    }
  862|       |
  863|  1.27k|    encrypt_metadata = true;
  864|  1.27k|    if (V >= 4 && encryption_dict.getKey("/EncryptMetadata").isBool()) {
  ------------------
  |  Branch (864:9): [True: 1.06k, False: 217]
  |  Branch (864:9): [True: 6, False: 1.27k]
  |  Branch (864:19): [True: 6, False: 1.05k]
  ------------------
  865|      6|        encrypt_metadata = encryption_dict.getKey("/EncryptMetadata").getBoolValue();
  866|      6|    }
  867|       |
  868|  1.27k|    if (V == 4 || V == 5) {
  ------------------
  |  Branch (868:9): [True: 315, False: 964]
  |  Branch (868:19): [True: 778, False: 186]
  ------------------
  869|  1.06k|        auto CF = encryption_dict.getKey("/CF");
  870|  3.13k|        for (auto const& [filter, cdict]: CF.as_dictionary()) {
  ------------------
  |  Branch (870:41): [True: 3.13k, False: 1.06k]
  ------------------
  871|  3.13k|            if (cdict.isDictionary()) {
  ------------------
  |  Branch (871:17): [True: 1.59k, False: 1.54k]
  ------------------
  872|  1.59k|                encryption_method_e method = e_none;
  873|  1.59k|                if (Name const& CFM = cdict["/CFM"]) {
  ------------------
  |  Branch (873:33): [True: 1.00k, False: 583]
  ------------------
  874|  1.00k|                    if (CFM == "/V2") {
  ------------------
  |  Branch (874:25): [True: 186, False: 821]
  ------------------
  875|    186|                        method = e_rc4;
  876|    821|                    } else if (CFM == "/AESV2") {
  ------------------
  |  Branch (876:32): [True: 35, False: 786]
  ------------------
  877|     35|                        method = e_aes;
  878|    786|                    } else if (CFM == "/AESV3") {
  ------------------
  |  Branch (878:32): [True: 162, False: 624]
  ------------------
  879|    162|                        method = e_aesv3;
  880|    624|                    } else {
  881|       |                        // Don't complain now -- maybe we won't need to reference this type.
  882|    624|                        method = e_unknown;
  883|    624|                    }
  884|  1.00k|                }
  885|  1.59k|                crypt_filters[filter] = method;
  886|  1.59k|            }
  887|  3.13k|        }
  888|       |
  889|  1.06k|        cf_stream = interpretCF(encryption_dict["/StmF"]);
  890|  1.06k|        cf_string = interpretCF(encryption_dict["/StrF"]);
  891|  1.06k|        if (Name const& EFF = encryption_dict["/EFF"]) {
  ------------------
  |  Branch (891:25): [True: 302, False: 760]
  ------------------
  892|       |            // qpdf does not use this for anything other than informational purposes. This is
  893|       |            // intended to instruct conforming writers on which crypt filter should be used when new
  894|       |            // file attachments are added to a PDF file, but qpdf never generates encrypted files
  895|       |            // with non-default crypt filters. Prior to 10.2, I was under the mistaken impression
  896|       |            // that this was supposed to be used for decrypting attachments, but the code was wrong
  897|       |            // in a way that turns out not to have mattered because no writers were generating files
  898|       |            // the way I was imagining. Still, providing this information could be useful when
  899|       |            // looking at a file generated by something else, such as Acrobat when specifying that
  900|       |            // only attachments should be encrypted.
  901|    302|            cf_file = interpretCF(EFF);
  902|    760|        } else {
  903|    760|            cf_file = cf_stream;
  904|    760|        }
  905|  1.06k|    }
  906|       |
  907|  1.27k|    Encryption data(V, R, Length / 8, p, O, U, OE, UE, Perms, id1, encrypt_metadata);
  908|  1.27k|    if (qm.cf.password_is_hex_key()) {
  ------------------
  |  Branch (908:9): [True: 0, False: 1.27k]
  ------------------
  909|       |        // ignore passwords in file
  910|      0|        encryption_key = QUtil::hex_decode(provided_password);
  911|      0|        return;
  912|      0|    }
  913|       |
  914|  1.27k|    owner_password_matched = data.check_owner_password(user_password, provided_password);
  915|  1.27k|    if (owner_password_matched && V < 5) {
  ------------------
  |  Branch (915:9): [True: 217, False: 1.06k]
  |  Branch (915:35): [True: 41, False: 176]
  ------------------
  916|       |        // password supplied was owner password; user_password has been initialized for V < 5
  917|     41|        if (qpdf.getTrimmedUserPassword() == provided_password) {
  ------------------
  |  Branch (917:13): [True: 0, False: 41]
  ------------------
  918|      0|            user_password_matched = true;
  919|      0|            QTC::TC("qpdf", "QPDF_encryption user matches owner V < 5");
  920|      0|        }
  921|  1.23k|    } else {
  922|  1.23k|        user_password_matched = data.check_user_password(provided_password);
  923|  1.23k|        if (user_password_matched) {
  ------------------
  |  Branch (923:13): [True: 608, False: 630]
  ------------------
  924|    608|            user_password = provided_password;
  925|    608|        }
  926|  1.23k|    }
  927|  1.27k|    if (user_password_matched && owner_password_matched) {
  ------------------
  |  Branch (927:9): [True: 608, False: 671]
  |  Branch (927:34): [True: 0, False: 608]
  ------------------
  928|      0|        QTC::TC("qpdf", "QPDF_encryption same password", (V < 5) ? 0 : 1);
  ------------------
  |  Branch (928:58): [True: 0, False: 0]
  ------------------
  929|      0|    }
  930|  1.27k|    if (!(owner_password_matched || user_password_matched)) {
  ------------------
  |  Branch (930:11): [True: 251, False: 1.02k]
  |  Branch (930:37): [True: 608, False: 420]
  ------------------
  931|    420|        throw QPDFExc(qpdf_e_password, file->getName(), "", 0, "invalid password");
  932|    420|    }
  933|       |
  934|    859|    if (V < 5) {
  ------------------
  |  Branch (934:9): [True: 335, False: 524]
  ------------------
  935|       |        // For V < 5, the user password is encrypted with the owner password, and the user password
  936|       |        // is always used for computing the encryption key.
  937|    335|        encryption_key = data.compute_encryption_key(user_password);
  938|    524|    } else {
  939|       |        // For V >= 5, either password can be used independently to compute the encryption key, and
  940|       |        // neither password can be used to recover the other.
  941|    524|        bool perms_valid;
  942|    524|        encryption_key = data.recover_encryption_key_with_password(provided_password, perms_valid);
  943|    524|        if (!perms_valid) {
  ------------------
  |  Branch (943:13): [True: 489, False: 35]
  ------------------
  944|    489|            warn_damaged_pdf("/Perms field in encryption dictionary doesn't match expected value");
  945|    489|        }
  946|    524|    }
  947|    859|}
_ZN4QPDF15getKeyForObjectENSt3__110shared_ptrINS_20EncryptionParametersEEE10QPDFObjGenb:
  951|  14.1k|{
  952|  14.1k|    if (!encp->encrypted) {
  ------------------
  |  Branch (952:9): [True: 0, False: 14.1k]
  ------------------
  953|      0|        throw std::logic_error("request for encryption key in non-encrypted PDF");
  954|      0|    }
  955|       |
  956|  14.1k|    if (og != encp->cached_key_og) {
  ------------------
  |  Branch (956:9): [True: 4.36k, False: 9.77k]
  ------------------
  957|  4.36k|        encp->cached_object_encryption_key = compute_data_key(
  958|  4.36k|            encp->encryption_key, og.getObj(), og.getGen(), use_aes, encp->encryption_V, encp->R());
  959|  4.36k|        encp->cached_key_og = og;
  960|  4.36k|    }
  961|       |
  962|  14.1k|    return encp->cached_object_encryption_key;
  963|  14.1k|}
_ZN4QPDF13decryptStringERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGen:
  967|  11.1k|{
  968|  11.1k|    if (!og.isIndirect()) {
  ------------------
  |  Branch (968:9): [True: 0, False: 11.1k]
  ------------------
  969|      0|        return;
  970|      0|    }
  971|  11.1k|    bool use_aes = false;
  972|  11.1k|    if (m->encp->encryption_V >= 4) {
  ------------------
  |  Branch (972:9): [True: 5.92k, False: 5.18k]
  ------------------
  973|  5.92k|        switch (m->encp->cf_string) {
  974|    431|        case e_none:
  ------------------
  |  Branch (974:9): [True: 431, False: 5.49k]
  ------------------
  975|    431|            return;
  976|       |
  977|  4.66k|        case e_aes:
  ------------------
  |  Branch (977:9): [True: 4.66k, False: 1.25k]
  ------------------
  978|  4.66k|            use_aes = true;
  979|  4.66k|            break;
  980|       |
  981|    256|        case e_aesv3:
  ------------------
  |  Branch (981:9): [True: 256, False: 5.66k]
  ------------------
  982|    256|            use_aes = true;
  983|    256|            break;
  984|       |
  985|    259|        case e_rc4:
  ------------------
  |  Branch (985:9): [True: 259, False: 5.66k]
  ------------------
  986|    259|            break;
  987|       |
  988|    310|        default:
  ------------------
  |  Branch (988:9): [True: 310, False: 5.61k]
  ------------------
  989|    310|            warn(m->c.damagedPDF(
  990|    310|                "unknown encryption filter for strings (check /StrF in "
  991|    310|                "/Encrypt dictionary); strings may be decrypted improperly"));
  992|       |            // To avoid repeated warnings, reset cf_string.  Assume we'd want to use AES if V == 4.
  993|    310|            m->encp->cf_string = e_aes;
  994|    310|            use_aes = true;
  995|    310|            break;
  996|  5.92k|        }
  997|  5.92k|    }
  998|       |
  999|  10.6k|    std::string key = getKeyForObject(m->encp, og, use_aes);
 1000|  10.6k|    try {
 1001|  10.6k|        if (use_aes) {
  ------------------
  |  Branch (1001:13): [True: 5.23k, False: 5.43k]
  ------------------
 1002|  5.23k|            QTC::TC("qpdf", "QPDF_encryption aes decode string");
 1003|  5.23k|            Pl_Buffer bufpl("decrypted string");
 1004|  5.23k|            Pl_AES_PDF pl("aes decrypt string", &bufpl, false, key);
 1005|  5.23k|            pl.writeString(str);
 1006|  5.23k|            pl.finish();
 1007|  5.23k|            str = bufpl.getString();
 1008|  5.43k|        } else {
 1009|  5.43k|            QTC::TC("qpdf", "QPDF_encryption rc4 decode string");
 1010|  5.43k|            size_t vlen = str.length();
 1011|       |            // Using std::shared_ptr guarantees that tmp will be freed even if rc4.process throws an
 1012|       |            // exception.
 1013|  5.43k|            auto tmp = QUtil::make_unique_cstr(str);
 1014|  5.43k|            RC4 rc4(QUtil::unsigned_char_pointer(key), QIntC::to_int(key.length()));
 1015|  5.43k|            auto data = QUtil::unsigned_char_pointer(tmp.get());
 1016|  5.43k|            rc4.process(data, vlen, data);
 1017|  5.43k|            str = std::string(tmp.get(), vlen);
 1018|  5.43k|        }
 1019|  10.6k|    } catch (QPDFExc&) {
 1020|      0|        throw;
 1021|      2|    } catch (std::runtime_error& e) {
 1022|      2|        throw m->c.damagedPDF(
 1023|      2|            "error decrypting string for object " + og.unparse() + ": " + e.what());
 1024|      2|    }
 1025|  10.6k|}
_ZN4QPDF13decryptStreamENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RP8Pipeline10QPDFObjGenR16QPDFObjectHandlebRNS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEE:
 1040|  5.51k|{
 1041|  5.51k|    if (Name(stream_dict["/Type"]) == "/XRef") {
  ------------------
  |  Branch (1041:9): [True: 194, False: 5.32k]
  ------------------
 1042|    194|        return;
 1043|    194|    }
 1044|  5.32k|    bool use_aes = false;
 1045|  5.32k|    if (encp->encryption_V >= 4) {
  ------------------
  |  Branch (1045:9): [True: 4.00k, False: 1.31k]
  ------------------
 1046|  4.00k|        encryption_method_e method = e_unknown;
 1047|  4.00k|        std::string method_source = "/StmF from /Encrypt dictionary";
 1048|       |
 1049|  4.00k|        if (stream_dict.getKey("/Filter").isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1049:13): [True: 1.96k, False: 2.04k]
  ------------------
 1050|  1.96k|            if (Dictionary decode_parms = stream_dict["/DecodeParms"]) {
  ------------------
  |  Branch (1050:28): [True: 1.30k, False: 664]
  ------------------
 1051|  1.30k|                if (Name(decode_parms["/Type"]) == "/CryptFilterDecodeParms") {
  ------------------
  |  Branch (1051:21): [True: 1.07k, False: 223]
  ------------------
 1052|  1.07k|                    method = encp->interpretCF(decode_parms["/Name"]);
 1053|  1.07k|                    method_source = "stream's Crypt decode parameters";
 1054|  1.07k|                }
 1055|  1.30k|            } else {
 1056|    664|                Array filter = stream_dict["/Filter"];
 1057|    664|                Array decode = stream_dict.getKey("/DecodeParms");
 1058|    664|                if (filter.size() == decode.size()) {
  ------------------
  |  Branch (1058:21): [True: 638, False: 26]
  ------------------
 1059|    638|                    size_t i = 0;
 1060|    638|                    for (Name item: filter) {
  ------------------
  |  Branch (1060:35): [True: 0, False: 638]
  ------------------
 1061|      0|                        if (item == "/Crypt") {
  ------------------
  |  Branch (1061:29): [True: 0, False: 0]
  ------------------
 1062|      0|                            if (Name name = decode[i]["/Name"]) {
  ------------------
  |  Branch (1062:38): [True: 0, False: 0]
  ------------------
 1063|      0|                                method = encp->interpretCF(name);
 1064|      0|                                method_source = "stream's Crypt decode parameters (array)";
 1065|      0|                            }
 1066|      0|                            break;
 1067|      0|                        }
 1068|      0|                        ++i;
 1069|      0|                    }
 1070|    638|                }
 1071|    664|            }
 1072|  1.96k|        }
 1073|       |
 1074|  4.00k|        if (method == e_unknown) {
  ------------------
  |  Branch (1074:13): [True: 3.89k, False: 110]
  ------------------
 1075|  3.89k|            if (!encp->encrypt_metadata && is_root_metadata) {
  ------------------
  |  Branch (1075:17): [True: 18, False: 3.87k]
  |  Branch (1075:44): [True: 0, False: 18]
  ------------------
 1076|      0|                method = e_none;
 1077|  3.89k|            } else {
 1078|  3.89k|                method = encp->cf_stream;
 1079|  3.89k|            }
 1080|  3.89k|        }
 1081|  4.00k|        use_aes = false;
 1082|  4.00k|        switch (method) {
 1083|  1.85k|        case e_none:
  ------------------
  |  Branch (1083:9): [True: 1.85k, False: 2.14k]
  ------------------
 1084|  1.85k|            return;
 1085|      0|            break;
 1086|       |
 1087|  1.36k|        case e_aes:
  ------------------
  |  Branch (1087:9): [True: 1.36k, False: 2.63k]
  ------------------
 1088|  1.36k|            use_aes = true;
 1089|  1.36k|            break;
 1090|       |
 1091|      8|        case e_aesv3:
  ------------------
  |  Branch (1091:9): [True: 8, False: 3.99k]
  ------------------
 1092|      8|            use_aes = true;
 1093|      8|            break;
 1094|       |
 1095|    443|        case e_rc4:
  ------------------
  |  Branch (1095:9): [True: 443, False: 3.56k]
  ------------------
 1096|    443|            break;
 1097|       |
 1098|    329|        default:
  ------------------
  |  Branch (1098:9): [True: 329, False: 3.67k]
  ------------------
 1099|       |            // filter local to this stream.
 1100|    329|            qpdf_for_warning.warn(
 1101|    329|                {qpdf_e_damaged_pdf,
 1102|    329|                 file->getName(),
 1103|    329|                 "",
 1104|    329|                 file->getLastOffset(),
 1105|    329|                 "unknown encryption filter for streams (check " + method_source +
 1106|    329|                     "); streams may be decrypted improperly"});
 1107|       |            // To avoid repeated warnings, reset cf_stream.  Assume we'd want to use AES if V == 4.
 1108|    329|            encp->cf_stream = e_aes;
 1109|    329|            use_aes = true;
 1110|    329|            break;
 1111|  4.00k|        }
 1112|  4.00k|    }
 1113|  3.46k|    std::string key = getKeyForObject(encp, og, use_aes);
 1114|  3.46k|    if (use_aes) {
  ------------------
  |  Branch (1114:9): [True: 1.70k, False: 1.76k]
  ------------------
 1115|  1.70k|        decrypt_pipeline =
 1116|  1.70k|            std::make_unique<Pl_AES_PDF>("AES stream decryption", pipeline, false, key);
 1117|  1.76k|    } else {
 1118|  1.76k|        decrypt_pipeline = std::make_unique<Pl_RC4>("RC4 stream decryption", pipeline, key);
 1119|  1.76k|    }
 1120|  3.46k|    pipeline = decrypt_pipeline.get();
 1121|  3.46k|}
_ZNK4QPDF22getTrimmedUserPasswordEv:
 1219|     41|{
 1220|     41|    std::string result = m->encp->user_password;
 1221|     41|    trim_user_password(result);
 1222|     41|    return result;
 1223|     41|}
QPDF_encryption.cc:_ZL16process_with_aesRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEbS7_mjPKhm:
  323|   180k|{
  324|   180k|    Pl_Buffer buffer("buffer");
  325|   180k|    Pl_AES_PDF aes("aes", &buffer, encrypt, key);
  326|   180k|    if (iv) {
  ------------------
  |  Branch (326:9): [True: 179k, False: 980]
  ------------------
  327|   179k|        aes.setIV(iv, iv_length);
  328|   179k|    } else {
  329|    980|        aes.useZeroIV();
  330|    980|    }
  331|   180k|    aes.disablePadding();
  332|  11.6M|    for (unsigned int i = 0; i < repetitions; ++i) {
  ------------------
  |  Branch (332:30): [True: 11.4M, False: 180k]
  ------------------
  333|  11.4M|        aes.writeString(data);
  334|  11.4M|    }
  335|   180k|    aes.finish();
  336|   180k|    if (outlength == 0) {
  ------------------
  |  Branch (336:9): [True: 180k, False: 0]
  ------------------
  337|   180k|        return buffer.getString();
  338|   180k|    } else {
  339|      0|        return buffer.getString().substr(0, outlength);
  340|      0|    }
  341|   180k|}
QPDF_encryption.cc:_ZL27pad_or_truncate_password_V4NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  278|  1.70k|{
  279|  1.70k|    if (password.size() < key_bytes) {
  ------------------
  |  Branch (279:9): [True: 1.19k, False: 510]
  ------------------
  280|  1.19k|        password.append(padding_string);
  281|  1.19k|    }
  282|  1.70k|    password.resize(key_bytes);
  283|  1.70k|    return password;
  284|  1.70k|}
QPDF_encryption.cc:_ZL18iterate_md5_digestR3MD5ii:
  288|  1.70k|{
  289|  1.70k|    MD5::Digest digest;
  290|  1.70k|    md5.digest(digest);
  291|  1.70k|    auto len = std::min(QIntC::to_size(key_len), sizeof(digest));
  292|  79.6k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (292:21): [True: 77.9k, False: 1.70k]
  ------------------
  293|  77.9k|        MD5 m;
  294|  77.9k|        m.encodeDataIncrementally(reinterpret_cast<char*>(digest), len);
  295|  77.9k|        m.digest(digest);
  296|  77.9k|    }
  297|  1.70k|    return {reinterpret_cast<char*>(digest), len};
  298|  1.70k|}
QPDF_encryption.cc:_ZL19pad_short_parameterRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEm:
  418|  6.20k|{
  419|  6.20k|    if (param.length() < max_len) {
  ------------------
  |  Branch (419:9): [True: 2.60k, False: 3.60k]
  ------------------
  420|  2.60k|        QTC::TC("qpdf", "QPDF_encryption pad short parameter");
  421|  2.60k|        param.append(max_len - param.length(), '\0');
  422|  2.60k|    }
  423|  6.20k|}
QPDF_encryption.cc:_ZL11iterate_rc4RNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_17basic_string_viewIcS2_EEib:
  302|  1.36k|{
  303|  1.36k|    auto len = okey.size();
  304|  1.36k|    std::string key(len, '\0');
  305|  26.3k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (305:21): [True: 25.0k, False: 1.36k]
  ------------------
  306|  25.0k|        int const xor_value = (reverse ? iterations - 1 - i : i);
  ------------------
  |  Branch (306:32): [True: 8.60k, False: 16.4k]
  ------------------
  307|   407k|        for (size_t j = 0; j < len; ++j) {
  ------------------
  |  Branch (307:28): [True: 382k, False: 25.0k]
  ------------------
  308|   382k|            key[j] = static_cast<char>(okey[j] ^ xor_value);
  309|   382k|        }
  310|  25.0k|        RC4::process(key, data);
  311|  25.0k|    }
  312|  1.36k|}
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_2clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  749|     71|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|     71|        return {
  751|     71|            qpdf_e_unsupported,
  752|     71|            file->getName(),
  753|     71|            "encryption dictionary",
  754|     71|            file->getLastOffset(),
  755|     71|            msg};
  756|     71|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_1clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  746|     22|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|     22|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|     22|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_0clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  743|    489|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|    489|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|    489|    };

_ZN13QPDFXRefEntryC2Ev:
   30|   494k|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|  1.12M|{
   43|  1.12M|    return type;
   44|  1.12M|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|   737k|{
   49|   737k|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|   737k|    return this->field1;
   51|   737k|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|  97.2k|{
   56|  97.2k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|  97.2k|    return QIntC::to_int(field1);
   58|  97.2k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  4.89k|{
  166|  4.89k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 2.14k, False: 2.75k]
  ------------------
  167|  2.14k|        return false;
  168|  2.14k|    }
  169|  7.75k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 5.00k, False: 2.75k]
  ------------------
  170|  5.00k|        version.append(1, *p++);
  171|  5.00k|    }
  172|  2.75k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 2.22k, False: 524]
  |  Branch (172:24): [True: 1.66k, False: 569]
  ------------------
  173|  1.09k|        return false;
  174|  1.09k|    }
  175|  1.66k|    version.append(1, *p++);
  176|  3.85k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 2.19k, False: 1.66k]
  ------------------
  177|  2.19k|        version.append(1, *p++);
  178|  2.19k|    }
  179|  1.66k|    return true;
  180|  2.75k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  4.90k|{
  185|  4.90k|    qpdf_offset_t global_offset = m->file->tell();
  186|  4.90k|    std::string line = m->file->readLine(1024);
  187|  4.90k|    char const* p = line.data();
  188|  4.90k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  4.90k|    p += 5;
  190|  4.90k|    std::string version;
  191|       |    // Note: The string returned by line.data() is always null-terminated. The code below never
  192|       |    // overruns the buffer because a null character always short-circuits further advancement.
  193|  4.90k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 3.23k, False: 1.66k]
  ------------------
  194|  3.23k|        return false;
  195|  3.23k|    }
  196|  1.66k|    m->pdf_version = version;
  197|  1.66k|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 1.12k, False: 544]
  ------------------
  198|       |        // Empirical evidence strongly suggests (codified in PDF 2.0 spec) that when there is
  199|       |        // leading material prior to the PDF header, all explicit offsets in the file are such that
  200|       |        // 0 points to the beginning of the header.
  201|  1.12k|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|  1.12k|    }
  203|  1.66k|    return true;
  204|  4.90k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  8.68k|{
  209|  8.68k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 8.37k, False: 313]
  |  Branch (209:9): [True: 6.73k, False: 1.94k]
  |  Branch (209:52): [True: 6.73k, False: 1.63k]
  ------------------
  210|       |        // Position in front of offset token
  211|  6.73k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  6.73k|        return true;
  213|  6.73k|    }
  214|  1.94k|    return false;
  215|  8.68k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  25.9k|{
  220|  25.9k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 25.9k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  25.9k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  25.9k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 24.2k, False: 1.66k]
  ------------------
  227|  24.2k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  24.2k|        m->pdf_version = "1.2";
  230|  24.2k|    }
  231|       |
  232|       |    // PDF spec says %%EOF must be found within the last 1024 bytes of/ the file.  We add an extra
  233|       |    // 30 characters to leave room for the startxref stuff.
  234|  25.9k|    m->file->seek(0, SEEK_END);
  235|  25.9k|    qpdf_offset_t end_offset = m->file->tell();
  236|  25.9k|    m->xref_table_max_offset = end_offset;
  237|       |    // Sanity check on object ids. All objects must appear in xref table / stream. In all realistic
  238|       |    // scenarios at least 3 bytes are required.
  239|  25.9k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 25.9k, False: 6]
  ------------------
  240|  25.9k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  25.9k|    }
  242|  25.9k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 5.42k, False: 20.5k]
  ------------------
  243|  25.9k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  25.9k|    qpdf_offset_t xref_offset = 0;
  245|  25.9k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 6.33k, False: 19.6k]
  ------------------
  246|  6.33k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  6.33k|    }
  248|       |
  249|  25.9k|    try {
  250|  25.9k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 19.6k, False: 6.30k]
  ------------------
  251|  19.6k|            throw damagedPDF("", -1, "can't find startxref");
  252|  19.6k|        }
  253|  6.30k|        try {
  254|  6.30k|            read_xref(xref_offset);
  255|  6.30k|        } catch (QPDFExc&) {
  256|  4.20k|            throw;
  257|  4.20k|        } catch (std::exception& e) {
  258|    483|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    483|        }
  260|  24.3k|    } catch (QPDFExc& e) {
  261|  24.3k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 24.3k]
  ------------------
  262|      0|            try {
  263|      0|                reconstruct_xref(e, xref_offset > 0);
  264|      0|            } catch (std::exception& er) {
  265|      0|                warn(damagedPDF("", -1, "error reconstructing xref: "s + er.what()));
  266|      0|            }
  267|      0|            if (!m->trailer) {
  ------------------
  |  Branch (267:17): [True: 0, False: 0]
  ------------------
  268|      0|                m->trailer = Dictionary::empty();
  269|      0|            }
  270|      0|            return;
  271|      0|        }
  272|  24.3k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 24.3k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  24.3k|        reconstruct_xref(e, xref_offset > 0);
  276|  24.3k|    }
  277|       |
  278|  11.1k|    m->encp->initialize(qpdf);
  279|  11.1k|    m->parsed = true;
  280|  11.1k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 10.2k, False: 849]
  |  Branch (280:9): [True: 15, False: 11.0k]
  |  Branch (280:35): [True: 15, False: 10.2k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|     15|        throw damagedPDF("", -1, "unable to find page tree");
  283|     15|    }
  284|  11.0k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 10.1k, False: 920]
  ------------------
  285|  10.1k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 19, False: 10.1k]
  ------------------
  286|     19|            throw damagedPDF("", -1, "no pages found");
  287|     19|        }
  288|  10.1k|        (void)m->cf.max_warnings(0);
  289|  10.1k|    }
  290|  11.0k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|  34.1M|{
  295|  34.1M|    util::internal_error_if(
  296|  34.1M|        m->in_parse == v, "QPDF: re-entrant parsing detected"
  297|       |        // This happens if QPDFParser::parse tries to resolve an indirect object while it is
  298|       |        // parsing.
  299|  34.1M|    );
  300|  34.1M|    m->in_parse = v;
  301|  34.1M|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  8.54k|{
  306|  8.54k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 189, False: 8.35k]
  ------------------
  307|    189|        return;
  308|    189|    }
  309|  8.35k|    m->trailer = obj;
  310|  8.35k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  26.0k|{
  315|  26.0k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 1.33k, False: 24.7k]
  ------------------
  316|       |        // Avoid xref reconstruction infinite loops. This is getting very hard to reproduce because
  317|       |        // qpdf is throwing many fewer exceptions while parsing. Most situations are warnings now.
  318|  1.33k|        throw e;
  319|  1.33k|    }
  320|       |
  321|       |    // If recovery generates more than 1000 warnings, the file is so severely damaged that there
  322|       |    // probably is no point trying to continue.
  323|  24.7k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  24.7k|    auto check_warnings = [this, max_warnings]() {
  325|  24.7k|        if (m->warnings.size() > max_warnings) {
  326|  24.7k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  24.7k|        }
  328|  24.7k|    };
  329|       |
  330|  24.7k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  24.7k|    m->fixed_dangling_refs = false;
  333|       |
  334|  24.7k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  24.7k|    warn(e);
  336|  24.7k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  24.7k|    std::vector<QPDFObjGen> to_delete;
  340|   118k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 118k, False: 24.7k]
  ------------------
  341|   118k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 106k, False: 12.1k]
  ------------------
  342|   106k|            to_delete.emplace_back(iter.first);
  343|   106k|        }
  344|   118k|    }
  345|   106k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 106k, False: 24.7k]
  ------------------
  346|   106k|        m->xref_table.erase(iter);
  347|   106k|    }
  348|       |
  349|  24.7k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  24.7k|    std::vector<qpdf_offset_t> trailers;
  351|  24.7k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  24.7k|    m->file->seek(0, SEEK_END);
  354|  24.7k|    qpdf_offset_t eof = m->file->tell();
  355|  24.7k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  24.7k|    static size_t const MAX_LEN = 10;
  358|  2.06M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 2.03M, False: 24.7k]
  ------------------
  359|  2.03M|        QPDFTokenizer::Token t1 = m->objects.readToken(*m->file, MAX_LEN);
  360|  2.03M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  361|  2.03M|        if (t1.isInteger()) {
  ------------------
  |  Branch (361:13): [True: 464k, False: 1.57M]
  ------------------
  362|   464k|            auto pos = m->file->tell();
  363|   464k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   464k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 386k, False: 78.1k]
  |  Branch (364:17): [True: 201k, False: 262k]
  |  Branch (364:35): [True: 201k, False: 184k]
  ------------------
  365|   201k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|   201k|                int gen = QUtil::string_to_int(t2.getValue().c_str());
  367|   201k|                if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (367:21): [True: 200k, False: 979]
  ------------------
  368|   200k|                    found_objects.emplace_back(obj, gen, token_start);
  369|   200k|                } else {
  370|    979|                    warn(damagedPDF(
  371|    979|                        "", -1, "ignoring object with impossibly large id " + std::to_string(obj)));
  372|    979|                }
  373|   201k|            }
  374|   464k|            m->file->seek(pos, SEEK_SET);
  375|  1.57M|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (375:20): [True: 1.47M, False: 98.3k]
  |  Branch (375:20): [True: 66.8k, False: 1.50M]
  |  Branch (375:35): [True: 66.8k, False: 1.40M]
  ------------------
  376|  66.8k|            trailers.emplace_back(m->file->tell());
  377|  1.50M|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (377:20): [True: 1.30M, False: 200k]
  |  Branch (377:20): [True: 1.95k, False: 1.50M]
  |  Branch (377:40): [True: 1.95k, False: 1.30M]
  ------------------
  378|  1.95k|            startxrefs.emplace_back(m->file->tell());
  379|  1.95k|        }
  380|  2.03M|        check_warnings();
  381|  2.03M|        m->file->findAndSkipNextEOL();
  382|  2.03M|    }
  383|       |
  384|  24.7k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (384:9): [True: 19.8k, False: 4.87k]
  |  Branch (384:29): [True: 716, False: 19.1k]
  |  Branch (384:52): [True: 555, False: 161]
  ------------------
  385|    555|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (385:9): [True: 322, False: 233]
  ------------------
  386|    322|        auto xref_backup{m->xref_table};
  387|    322|        try {
  388|    322|            m->file->seek(startxrefs.back(), SEEK_SET);
  389|    322|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (389:22): [True: 179, False: 143]
  ------------------
  390|    179|                read_xref(offset);
  391|       |
  392|    179|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (392:21): [True: 6, False: 173]
  ------------------
  393|      6|                    warn(damagedPDF(
  394|      6|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  395|      6|                    m->encp->initialize(qpdf);
  396|      6|                    m->parsed = true;
  397|      6|                    m->reconstructed_xref = false;
  398|      6|                    return;
  399|      6|                }
  400|    179|            }
  401|    322|        } catch (...) {
  402|       |            // ok, bad luck. Do recovery.
  403|    173|        }
  404|    316|        m->xref_table = std::move(xref_backup);
  405|    316|    }
  406|       |
  407|  24.7k|    auto rend = found_objects.rend();
  408|   225k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (408:44): [True: 200k, False: 24.7k]
  ------------------
  409|   200k|        auto [obj, gen, token_start] = *it;
  410|   200k|        insertXrefEntry(obj, 1, token_start, gen);
  411|   200k|        check_warnings();
  412|   200k|    }
  413|  24.7k|    m->deleted_objects.clear();
  414|       |
  415|       |    // Search at most the last 100 trailer candidates. If none of them are valid, odds are this file
  416|       |    // is deliberately broken.
  417|  24.7k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (417:21): [True: 11, False: 24.6k]
  ------------------
  418|  41.5k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (418:39): [True: 19.8k, False: 21.6k]
  ------------------
  419|  19.8k|        m->file->seek(*it, SEEK_SET);
  420|  19.8k|        auto t = readTrailer();
  421|  19.8k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (421:13): [True: 15.8k, False: 4.06k]
  ------------------
  422|       |            // Oh well.  It was worth a try.
  423|  15.8k|        } else {
  424|  4.06k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (424:17): [True: 3.06k, False: 1.00k]
  ------------------
  425|  3.06k|                m->trailer = t;
  426|  3.06k|                break;
  427|  3.06k|            }
  428|  1.00k|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  429|  1.00k|        }
  430|  16.8k|        check_warnings();
  431|  16.8k|    }
  432|       |
  433|  24.7k|    if (!m->trailer) {
  ------------------
  |  Branch (433:9): [True: 20.6k, False: 4.03k]
  ------------------
  434|  20.6k|        qpdf_offset_t max_offset{0};
  435|  20.6k|        size_t max_size{0};
  436|       |        // If there are any xref streams, take the last one to appear.
  437|   106k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (437:30): [True: 106k, False: 20.6k]
  ------------------
  438|   106k|            auto entry = iter.second;
  439|   106k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (439:17): [True: 1.07k, False: 105k]
  ------------------
  440|  1.07k|                continue;
  441|  1.07k|            }
  442|   105k|            auto oh = qpdf.getObject(iter.first);
  443|   105k|            try {
  444|   105k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (444:21): [True: 95.1k, False: 10.2k]
  ------------------
  445|  95.1k|                    continue;
  446|  95.1k|                }
  447|   105k|            } catch (std::exception&) {
  448|  3.80k|                continue;
  449|  3.80k|            }
  450|  6.42k|            auto offset = entry.getOffset();
  451|  6.42k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  452|  6.42k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (452:17): [True: 4.44k, False: 1.98k]
  |  Branch (452:37): [True: 1.98k, False: 0]
  |  Branch (452:57): [True: 1.92k, False: 64]
  ------------------
  453|  6.35k|                max_offset = offset;
  454|  6.35k|                setTrailer(oh.getDict());
  455|  6.35k|            }
  456|  6.42k|            check_warnings();
  457|  6.42k|        }
  458|  20.6k|        if (max_offset > 0) {
  ------------------
  |  Branch (458:13): [True: 6.16k, False: 14.5k]
  ------------------
  459|  6.16k|            try {
  460|  6.16k|                read_xref(max_offset, true);
  461|  6.16k|            } catch (std::exception&) {
  462|  3.85k|                warn(damagedPDF(
  463|  3.85k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  464|  3.85k|            }
  465|  6.16k|            QTC::TC("qpdf", "QPDF recover xref stream");
  466|  6.13k|        }
  467|  20.6k|    }
  468|       |
  469|  24.6k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (469:9): [True: 14.5k, False: 10.1k]
  |  Branch (469:9): [True: 21.0k, False: 3.60k]
  |  Branch (469:25): [True: 9.80k, False: 331]
  |  Branch (469:39): [True: 6.57k, False: 3.23k]
  ------------------
  470|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  471|  21.0k|        QPDFObjectHandle root;
  472|   248k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (472:30): [True: 248k, False: 21.0k]
  ------------------
  473|   248k|            try {
  474|   248k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (474:21): [True: 7.70k, False: 240k]
  ------------------
  475|  7.70k|                    root = iter.second.object;
  476|  7.70k|                }
  477|   248k|            } catch (std::exception&) {
  478|  5.07k|                continue;
  479|  5.07k|            }
  480|   248k|        }
  481|  21.0k|        if (root) {
  ------------------
  |  Branch (481:13): [True: 7.53k, False: 13.5k]
  ------------------
  482|  7.53k|            if (!m->trailer) {
  ------------------
  |  Branch (482:17): [True: 6.63k, False: 905]
  ------------------
  483|  6.63k|                warn(damagedPDF(
  484|  6.63k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  485|  6.63k|                m->trailer = QPDFObjectHandle::newDictionary();
  486|  6.63k|            }
  487|  7.53k|            m->trailer.replaceKey("/Root", root);
  488|  7.53k|        }
  489|  21.0k|    }
  490|       |
  491|  24.6k|    if (!m->trailer) {
  ------------------
  |  Branch (491:9): [True: 7.86k, False: 16.8k]
  ------------------
  492|       |        // We could check the last encountered object to see if it was an xref stream.  If so, we
  493|       |        // could try to get the trailer from there.  This may make it possible to recover files with
  494|       |        // bad startxref pointers even when they have object streams.
  495|       |
  496|  7.86k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  497|  7.86k|    }
  498|  16.8k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (498:9): [True: 483, False: 16.3k]
  ------------------
  499|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  500|       |        // creating QPDF objects from JSON.
  501|    483|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  502|    483|    }
  503|  16.3k|    check_warnings();
  504|  16.3k|    if (!m->parsed) {
  ------------------
  |  Branch (504:9): [True: 16.0k, False: 312]
  ------------------
  505|  16.0k|        m->parsed = !m->pages.empty();
  506|  16.0k|        if (!m->parsed) {
  ------------------
  |  Branch (506:13): [True: 842, False: 15.1k]
  ------------------
  507|    842|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  508|    842|        }
  509|  15.1k|        check_warnings();
  510|  15.1k|    }
  511|       |
  512|       |    // We could iterate through the objects looking for streams and try to find objects inside of
  513|       |    // them, but it's probably not worth the trouble.  Acrobat can't recover files with any errors
  514|       |    // in an xref stream, and this would be a real long shot anyway.  If we wanted to do anything
  515|       |    // that involved looking at stream contents, we'd also have to call initializeEncryption() here.
  516|       |    // It's safe to call it more than once.
  517|  16.3k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  521|  12.6k|{
  522|  12.6k|    std::map<int, int> free_table;
  523|  12.6k|    std::set<qpdf_offset_t> visited;
  524|  26.0k|    while (xref_offset) {
  ------------------
  |  Branch (524:12): [True: 13.6k, False: 12.3k]
  ------------------
  525|  13.6k|        visited.insert(xref_offset);
  526|  13.6k|        char buf[7];
  527|  13.6k|        memset(buf, 0, sizeof(buf));
  528|  13.6k|        m->file->seek(xref_offset, SEEK_SET);
  529|       |        // Some files miss the mark a little with startxref. We could do a better job of searching
  530|       |        // in the neighborhood for something that looks like either an xref table or stream, but the
  531|       |        // simple heuristic of skipping whitespace can help with the xref table case and is harmless
  532|       |        // with the stream case.
  533|  13.6k|        bool done = false;
  534|  13.6k|        bool skipped_space = false;
  535|  32.9k|        while (!done) {
  ------------------
  |  Branch (535:16): [True: 19.2k, False: 13.6k]
  ------------------
  536|  19.2k|            char ch;
  537|  19.2k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (537:17): [True: 18.7k, False: 532]
  ------------------
  538|  18.7k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (538:21): [True: 5.99k, False: 12.7k]
  ------------------
  539|  5.99k|                    skipped_space = true;
  540|  12.7k|                } else {
  541|  12.7k|                    m->file->unreadCh(ch);
  542|  12.7k|                    done = true;
  543|  12.7k|                }
  544|  18.7k|            } else {
  545|    532|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (545:73): [True: 1, False: 531]
  ------------------
  546|    532|                done = true;
  547|    532|            }
  548|  19.2k|        }
  549|       |
  550|  13.6k|        m->file->read(buf, sizeof(buf) - 1);
  551|       |        // The PDF spec says xref must be followed by a line terminator, but files exist in the wild
  552|       |        // where it is terminated by arbitrary whitespace.
  553|  13.6k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (553:13): [True: 2.09k, False: 11.5k]
  |  Branch (553:47): [True: 2.07k, False: 17]
  ------------------
  554|  2.07k|            if (skipped_space) {
  ------------------
  |  Branch (554:17): [True: 80, False: 1.99k]
  ------------------
  555|     80|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  556|     80|            }
  557|  2.07k|            QTC::TC(
  558|  2.07k|                "qpdf",
  559|  2.07k|                "QPDF xref space",
  560|  2.07k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (560:18): [True: 99, False: 1.97k]
  ------------------
  561|  2.07k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (561:24): [True: 1.38k, False: 593]
  ------------------
  562|  1.97k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (562:24): [True: 191, False: 402]
  ------------------
  563|    593|                                        : 9999));
  564|  2.07k|            int skip = 4;
  565|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  566|  4.32k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (566:20): [True: 2.24k, False: 2.07k]
  ------------------
  567|  2.24k|                ++skip;
  568|  2.24k|            }
  569|  2.07k|            xref_offset = read_xrefTable(xref_offset + skip);
  570|  11.5k|        } else {
  571|  11.5k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  572|  11.5k|        }
  573|  13.6k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (573:13): [True: 258, False: 13.3k]
  ------------------
  574|    258|            throw damagedPDF("", -1, "loop detected following xref tables");
  575|    258|        }
  576|  13.6k|    }
  577|       |
  578|  12.3k|    if (!m->trailer) {
  ------------------
  |  Branch (578:9): [True: 0, False: 12.3k]
  ------------------
  579|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  580|      0|    }
  581|  12.3k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  582|  12.3k|    int max_obj = 0;
  583|  12.3k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (583:9): [True: 3.67k, False: 8.70k]
  ------------------
  584|  3.67k|        max_obj = m->xref_table.rbegin()->first.getObj();
  585|  3.67k|    }
  586|  12.3k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (586:9): [True: 835, False: 11.5k]
  ------------------
  587|    835|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  588|    835|    }
  589|  12.3k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (589:9): [True: 8.98k, False: 3.40k]
  |  Branch (589:21): [True: 2.02k, False: 1.37k]
  ------------------
  590|  2.55k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (590:13): [True: 123, False: 2.43k]
  |  Branch (590:13): [True: 4, False: 2.55k]
  |  Branch (590:38): [True: 4, False: 119]
  ------------------
  591|      4|            warn(damagedPDF(
  592|      4|                "",
  593|      4|                -1,
  594|      4|                "xref entry for the xref stream itself is missing - a common error handled "
  595|      4|                "correctly by qpdf and most other applications"));
  596|  2.55k|        } else {
  597|  2.55k|            warn(damagedPDF(
  598|  2.55k|                "",
  599|  2.55k|                -1,
  600|  2.55k|                ("reported number of objects (" + std::to_string(size) +
  601|  2.55k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  602|  2.55k|        }
  603|  2.55k|    }
  604|       |
  605|       |    // We no longer need the deleted_objects table, so go ahead and clear it out to make sure we
  606|       |    // never depend on its being set.
  607|  12.3k|    m->deleted_objects.clear();
  608|       |
  609|       |    // Make sure we keep only the highest generation for any object.
  610|  12.3k|    QPDFObjGen last_og{-1, 0};
  611|   310k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (611:26): [True: 310k, False: 12.3k]
  ------------------
  612|   310k|        auto id = item.first.getObj();
  613|   310k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (613:13): [True: 11.3k, False: 298k]
  |  Branch (613:39): [True: 11.3k, False: 0]
  ------------------
  614|  11.3k|            qpdf.removeObject(last_og);
  615|  11.3k|        }
  616|   310k|        last_og = item.first;
  617|   310k|    }
  618|  12.3k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  622|  8.76k|{
  623|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  624|       |    // buffer.
  625|  8.76k|    char const* p = line.c_str();
  626|  8.76k|    char const* start = line.c_str();
  627|       |
  628|       |    // Skip zero or more spaces
  629|  9.86k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (629:12): [True: 1.10k, False: 8.76k]
  ------------------
  630|  1.10k|        ++p;
  631|  1.10k|    }
  632|       |    // Require digit
  633|  8.76k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (633:9): [True: 235, False: 8.53k]
  ------------------
  634|    235|        return false;
  635|    235|    }
  636|       |    // Gather digits
  637|  8.53k|    std::string obj_str;
  638|  33.9k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (638:12): [True: 25.4k, False: 8.53k]
  ------------------
  639|  25.4k|        obj_str.append(1, *p++);
  640|  25.4k|    }
  641|       |    // Require space
  642|  8.53k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (642:9): [True: 108, False: 8.42k]
  ------------------
  643|    108|        return false;
  644|    108|    }
  645|       |    // Skip spaces
  646|  20.0k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (646:12): [True: 11.6k, False: 8.42k]
  ------------------
  647|  11.6k|        ++p;
  648|  11.6k|    }
  649|       |    // Require digit
  650|  8.42k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (650:9): [True: 102, False: 8.32k]
  ------------------
  651|    102|        return false;
  652|    102|    }
  653|       |    // Gather digits
  654|  8.32k|    std::string num_str;
  655|  32.1k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (655:12): [True: 23.8k, False: 8.32k]
  ------------------
  656|  23.8k|        num_str.append(1, *p++);
  657|  23.8k|    }
  658|       |    // Skip any space including line terminators
  659|  22.7k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (659:12): [True: 14.4k, False: 8.32k]
  ------------------
  660|  14.4k|        ++p;
  661|  14.4k|    }
  662|  8.32k|    bytes = toI(p - start);
  663|  8.32k|    obj = QUtil::string_to_int(obj_str.c_str());
  664|  8.32k|    num = QUtil::string_to_int(num_str.c_str());
  665|  8.32k|    return true;
  666|  8.42k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  670|  8.80k|{
  671|       |    // Reposition after initial read attempt and reread.
  672|  8.80k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  673|  8.80k|    auto line = m->file->readLine(30);
  674|       |
  675|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  676|       |    // buffer.
  677|  8.80k|    char const* p = line.data();
  678|       |
  679|       |    // Skip zero or more spaces. There aren't supposed to be any.
  680|  8.80k|    bool invalid = false;
  681|  13.3k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (681:12): [True: 4.56k, False: 8.80k]
  ------------------
  682|  4.56k|        ++p;
  683|  4.56k|        invalid = true;
  684|  4.56k|    }
  685|       |    // Require digit
  686|  8.80k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (686:9): [True: 29, False: 8.77k]
  ------------------
  687|     29|        return false;
  688|     29|    }
  689|       |    // Gather digits
  690|  8.77k|    std::string f1_str;
  691|  33.2k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (691:12): [True: 24.4k, False: 8.77k]
  ------------------
  692|  24.4k|        f1_str.append(1, *p++);
  693|  24.4k|    }
  694|       |    // Require space
  695|  8.77k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (695:9): [True: 44, False: 8.73k]
  ------------------
  696|     44|        return false;
  697|     44|    }
  698|  8.73k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (698:9): [True: 1.52k, False: 7.21k]
  ------------------
  699|  1.52k|        invalid = true;
  700|  1.52k|    }
  701|       |    // Skip spaces
  702|  20.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (702:12): [True: 11.6k, False: 8.73k]
  ------------------
  703|  11.6k|        ++p;
  704|  11.6k|    }
  705|       |    // Require digit
  706|  8.73k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (706:9): [True: 100, False: 8.63k]
  ------------------
  707|    100|        return false;
  708|    100|    }
  709|       |    // Gather digits
  710|  8.63k|    std::string f2_str;
  711|  30.9k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (711:12): [True: 22.3k, False: 8.63k]
  ------------------
  712|  22.3k|        f2_str.append(1, *p++);
  713|  22.3k|    }
  714|       |    // Require space
  715|  8.63k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (715:9): [True: 42, False: 8.59k]
  ------------------
  716|     42|        return false;
  717|     42|    }
  718|  8.59k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (718:9): [True: 2.38k, False: 6.20k]
  ------------------
  719|  2.38k|        invalid = true;
  720|  2.38k|    }
  721|       |    // Skip spaces
  722|  23.0k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (722:12): [True: 14.4k, False: 8.59k]
  ------------------
  723|  14.4k|        ++p;
  724|  14.4k|    }
  725|  8.59k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (725:9): [True: 1.89k, False: 6.69k]
  |  Branch (725:24): [True: 6.51k, False: 180]
  ------------------
  726|  8.41k|        type = *p;
  727|  8.41k|    } else {
  728|    180|        return false;
  729|    180|    }
  730|  8.41k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (730:9): [True: 7.47k, False: 940]
  |  Branch (730:36): [True: 460, False: 480]
  ------------------
  731|  7.93k|        invalid = true;
  732|  7.93k|    }
  733|       |
  734|  8.41k|    if (invalid) {
  ------------------
  |  Branch (734:9): [True: 7.94k, False: 468]
  ------------------
  735|  7.94k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  736|  7.94k|    }
  737|       |
  738|  8.41k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  739|  8.41k|    f2 = QUtil::string_to_int(f2_str.c_str());
  740|       |
  741|  8.41k|    return true;
  742|  8.59k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  748|  19.4k|{
  749|  19.4k|    std::array<char, 21> line;
  750|  19.4k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (750:9): [True: 233, False: 19.1k]
  ------------------
  751|       |        // C++20: [[unlikely]]
  752|    233|        return false;
  753|    233|    }
  754|  19.1k|    line[20] = '\0';
  755|  19.1k|    char const* p = line.data();
  756|       |
  757|  19.1k|    int f1_len = 0;
  758|  19.1k|    int f2_len = 0;
  759|       |
  760|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  761|       |    // buffer.
  762|       |
  763|       |    // Gather f1 digits. NB No risk of overflow as 9'999'999'999 < max long long.
  764|  89.1k|    while (*p == '0') {
  ------------------
  |  Branch (764:12): [True: 69.9k, False: 19.1k]
  ------------------
  765|  69.9k|        ++f1_len;
  766|  69.9k|        ++p;
  767|  69.9k|    }
  768|  73.8k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (768:12): [True: 54.6k, False: 19.1k]
  |  Branch (768:34): [True: 54.6k, False: 3]
  ------------------
  769|  54.6k|        f1 *= 10;
  770|  54.6k|        f1 += *p++ - '0';
  771|  54.6k|    }
  772|       |    // Require space
  773|  19.1k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (773:9): [True: 110, False: 19.0k]
  ------------------
  774|       |        // Entry doesn't start with space or digit.
  775|       |        // C++20: [[unlikely]]
  776|    110|        return false;
  777|    110|    }
  778|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  779|  66.6k|    while (*p == '0') {
  ------------------
  |  Branch (779:12): [True: 47.5k, False: 19.0k]
  ------------------
  780|  47.5k|        ++f2_len;
  781|  47.5k|        ++p;
  782|  47.5k|    }
  783|  40.4k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (783:12): [True: 21.8k, False: 18.6k]
  |  Branch (783:34): [True: 21.4k, False: 423]
  ------------------
  784|  21.4k|        f2 *= 10;
  785|  21.4k|        f2 += static_cast<int>(*p++ - '0');
  786|  21.4k|    }
  787|  19.0k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (787:9): [True: 18.3k, False: 722]
  |  Branch (787:34): [True: 3.23k, False: 15.1k]
  |  Branch (787:47): [True: 12.2k, False: 2.85k]
  ------------------
  788|       |        // C++20: [[likely]]
  789|  15.4k|        type = *p;
  790|       |        // No test for valid line[19].
  791|  15.4k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (791:13): [True: 15.1k, False: 334]
  |  Branch (791:23): [True: 14.4k, False: 751]
  |  Branch (791:34): [True: 12.0k, False: 2.39k]
  |  Branch (791:48): [True: 462, False: 1.93k]
  |  Branch (791:63): [True: 10.4k, False: 2.06k]
  |  Branch (791:79): [True: 10.2k, False: 157]
  ------------------
  792|       |            // C++20: [[likely]]
  793|  10.2k|            return true;
  794|  10.2k|        }
  795|  15.4k|    }
  796|  8.80k|    return read_bad_xrefEntry(f1, f2, type);
  797|  19.0k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  802|  2.07k|{
  803|  2.07k|    m->file->seek(xref_offset, SEEK_SET);
  804|  2.07k|    std::string line;
  805|  8.80k|    while (true) {
  ------------------
  |  Branch (805:12): [True: 8.76k, Folded]
  ------------------
  806|  8.76k|        line.assign(50, '\0');
  807|  8.76k|        m->file->read(line.data(), line.size());
  808|  8.76k|        int obj = 0;
  809|  8.76k|        int num = 0;
  810|  8.76k|        int bytes = 0;
  811|  8.76k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (811:13): [True: 445, False: 8.32k]
  ------------------
  812|    445|            throw damagedPDF("xref table", "xref syntax invalid");
  813|    445|        }
  814|  8.32k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  815|  26.9k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (815:37): [True: 19.4k, False: 7.58k]
  ------------------
  816|  19.4k|            if (i == 0) {
  ------------------
  |  Branch (816:17): [True: 524, False: 18.8k]
  ------------------
  817|       |                // This is needed by checkLinearization()
  818|    524|                first_xref_item_offset_ = m->file->tell();
  819|    524|            }
  820|       |            // For xref_table, these will always be small enough to be ints
  821|  19.4k|            qpdf_offset_t f1 = 0;
  822|  19.4k|            int f2 = 0;
  823|  19.4k|            char type = '\0';
  824|  19.4k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (824:17): [True: 738, False: 18.6k]
  ------------------
  825|    738|                throw damagedPDF(
  826|    738|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  827|    738|            }
  828|  18.6k|            if (type == 'f') {
  ------------------
  |  Branch (828:17): [True: 4.63k, False: 14.0k]
  ------------------
  829|  4.63k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  830|  14.0k|            } else {
  831|  14.0k|                insertXrefEntry(toI(i), 1, f1, f2);
  832|  14.0k|            }
  833|  18.6k|        }
  834|  7.58k|        qpdf_offset_t pos = m->file->tell();
  835|  7.58k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (835:13): [True: 854, False: 6.72k]
  ------------------
  836|    854|            break;
  837|  6.72k|        } else {
  838|  6.72k|            m->file->seek(pos, SEEK_SET);
  839|  6.72k|        }
  840|  7.58k|    }
  841|       |
  842|       |    // Set offset to previous xref table if any
  843|    891|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  844|    891|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (844:9): [True: 75, False: 816]
  ------------------
  845|     75|        throw damagedPDF("", "expected trailer dictionary");
  846|     75|    }
  847|       |
  848|    816|    if (!m->trailer) {
  ------------------
  |  Branch (848:9): [True: 727, False: 89]
  ------------------
  849|    727|        setTrailer(cur_trailer);
  850|       |
  851|    727|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (851:13): [True: 143, False: 584]
  ------------------
  852|    143|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  853|    143|        }
  854|    584|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (854:13): [True: 5, False: 579]
  ------------------
  855|      5|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  856|      5|        }
  857|    584|    }
  858|       |
  859|    668|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (859:9): [True: 23, False: 645]
  ------------------
  860|     23|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (860:13): [True: 0, False: 23]
  ------------------
  861|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  862|     23|        } else {
  863|     23|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (863:17): [True: 22, False: 1]
  ------------------
  864|       |                // Read the xref stream but disregard any return value -- we'll use our trailer's
  865|       |                // /Prev key instead of the xref stream's.
  866|     22|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  867|     22|            } else {
  868|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  869|      1|            }
  870|     23|        }
  871|     23|    }
  872|       |
  873|    667|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (873:9): [True: 175, False: 492]
  ------------------
  874|    175|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (874:13): [True: 1, False: 174]
  ------------------
  875|      1|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  876|      1|        }
  877|    174|        return cur_trailer.getKey("/Prev").getIntValue();
  878|    175|    }
  879|       |
  880|    492|    return 0;
  881|    667|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  886|  11.2k|{
  887|  11.2k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (887:9): [True: 11.2k, False: 0]
  ------------------
  888|  11.2k|        QPDFObjectHandle xref_obj;
  889|  11.2k|        try {
  890|  11.2k|            m->in_read_xref_stream = true;
  891|  11.2k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  892|  11.2k|        } catch (QPDFExc&) {
  893|       |            // ignore -- report error below
  894|  1.33k|        }
  895|  11.2k|        m->in_read_xref_stream = false;
  896|  11.1k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (896:13): [True: 8.94k, False: 2.23k]
  ------------------
  897|  8.94k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  898|  8.94k|        }
  899|  11.1k|    }
  900|       |
  901|  2.23k|    throw damagedPDF("", xref_offset, "xref not found");
  902|      0|    return 0; // unreachable
  903|  11.2k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  908|  8.94k|{
  909|  8.94k|    auto W_obj = dict.getKey("/W");
  910|  8.94k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (910:9): [True: 364, False: 8.58k]
  |  Branch (910:11): [True: 8.63k, False: 317]
  |  Branch (910:32): [True: 8.61k, False: 18]
  ------------------
  911|  8.61k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (911:11): [True: 8.59k, False: 19]
  |  Branch (911:48): [True: 8.58k, False: 10]
  ------------------
  912|    364|        throw damaged("Cross-reference stream does not have a proper /W key");
  913|    364|    }
  914|       |
  915|  8.58k|    std::array<int, 3> W;
  916|  8.58k|    int entry_size = 0;
  917|  8.58k|    auto w_vector = W_obj.getArrayAsVector();
  918|  8.58k|    int max_bytes = sizeof(qpdf_offset_t);
  919|  34.1k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (919:24): [True: 25.6k, False: 8.50k]
  ------------------
  920|  25.6k|        W[i] = w_vector[i].getIntValueAsInt();
  921|  25.6k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (921:13): [True: 25, False: 25.6k]
  ------------------
  922|     25|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  923|     25|        }
  924|  25.6k|        if (W[i] < 0) {
  ------------------
  |  Branch (924:13): [True: 55, False: 25.5k]
  ------------------
  925|     55|            throw damaged("Cross-reference stream's /W contains negative values");
  926|     55|        }
  927|  25.5k|        entry_size += W[i];
  928|  25.5k|    }
  929|  8.50k|    if (entry_size == 0) {
  ------------------
  |  Branch (929:9): [True: 4, False: 8.50k]
  ------------------
  930|      4|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  931|      4|    }
  932|  8.50k|    return {entry_size, W};
  933|  8.50k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  939|  8.49k|{
  940|       |    // Number of entries is limited by the highest possible object id and stream size.
  941|  8.49k|    auto max_num_entries = std::numeric_limits<int>::max();
  942|  8.49k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (942:9): [True: 0, False: 8.49k]
  ------------------
  943|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  944|      0|    }
  945|       |
  946|  8.49k|    auto Size_obj = dict.getKey("/Size");
  947|  8.49k|    long long size;
  948|  8.49k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (948:9): [True: 90, False: 8.40k]
  ------------------
  949|     90|        throw damaged("Cross-reference stream does not have a proper /Size key");
  950|  8.40k|    } else if (size < 0) {
  ------------------
  |  Branch (950:16): [True: 73, False: 8.33k]
  ------------------
  951|     73|        throw damaged("Cross-reference stream has a negative /Size key");
  952|  8.33k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (952:16): [True: 80, False: 8.25k]
  ------------------
  953|     80|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  954|     80|    }
  955|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  956|  8.25k|    return max_num_entries;
  957|  8.49k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  963|  8.25k|{
  964|  8.25k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  965|  8.25k|    auto Index_obj = dict.getKey("/Index");
  966|       |
  967|  8.25k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (967:9): [True: 616, False: 7.63k]
  ------------------
  968|    616|        std::vector<std::pair<int, int>> indx;
  969|    616|        int num_entries = 0;
  970|    616|        auto index_vec = Index_obj.getArrayAsVector();
  971|    616|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (971:13): [True: 6, False: 610]
  |  Branch (971:39): [True: 5, False: 605]
  ------------------
  972|     11|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  973|     11|        }
  974|       |
  975|    605|        int i = 0;
  976|    605|        long long first = 0;
  977|  15.3k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (977:23): [True: 15.3k, False: 303]
  ------------------
  978|  15.3k|            if (val.isInteger()) {
  ------------------
  |  Branch (978:17): [True: 15.3k, False: 23]
  ------------------
  979|  15.3k|                if (i % 2) {
  ------------------
  |  Branch (979:21): [True: 7.61k, False: 7.73k]
  ------------------
  980|  7.61k|                    auto count = val.getIntValue();
  981|  7.61k|                    if (count <= 0) {
  ------------------
  |  Branch (981:25): [True: 70, False: 7.54k]
  ------------------
  982|     70|                        throw damaged(
  983|     70|                            "Cross-reference stream section claims to contain " +
  984|     70|                            std::to_string(count) + " entries");
  985|     70|                    }
  986|       |                    // We are guarding against the possibility of num_entries * entry_size
  987|       |                    // overflowing. We are not checking that entries are in ascending order as
  988|       |                    // required by the spec, which probably should generate a warning. We are also
  989|       |                    // not checking that for each subsection first object number + number of entries
  990|       |                    // <= /Size. The spec requires us to ignore object number > /Size.
  991|  7.54k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (991:25): [True: 71, False: 7.47k]
  ------------------
  992|  7.47k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (992:25): [True: 24, False: 7.44k]
  ------------------
  993|     95|                        throw damaged(
  994|     95|                            "Cross-reference stream claims to contain too many entries: " +
  995|     95|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
  996|     95|                            std::to_string(num_entries));
  997|     95|                    }
  998|  7.44k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
  999|  7.44k|                    num_entries += static_cast<int>(count);
 1000|  7.73k|                } else {
 1001|  7.73k|                    first = val.getIntValue();
 1002|  7.73k|                    if (first < 0) {
  ------------------
  |  Branch (1002:25): [True: 40, False: 7.69k]
  ------------------
 1003|     40|                        throw damaged(
 1004|     40|                            "Cross-reference stream's /Index contains a negative object id");
 1005|  7.69k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1005:32): [True: 74, False: 7.62k]
  ------------------
 1006|     74|                        throw damaged(
 1007|     74|                            "Cross-reference stream's /Index contains an impossibly "
 1008|     74|                            "large object id");
 1009|     74|                    }
 1010|  7.73k|                }
 1011|  15.3k|            } else {
 1012|     23|                throw damaged(
 1013|     23|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1014|     23|                    " is not an integer");
 1015|     23|            }
 1016|  15.0k|            i++;
 1017|  15.0k|        }
 1018|    303|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1018:54): [True: 220, False: 83]
  ------------------
 1019|    303|        return {num_entries, indx};
 1020|  7.63k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1020:16): [True: 7.63k, False: 4]
  ------------------
 1021|  7.63k|        return {size, {{0, size}}};
 1022|  7.63k|    } else {
 1023|      4|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1024|      4|    }
 1025|  8.25k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1030|  8.94k|{
 1031|  8.94k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1032|  8.94k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1033|  8.94k|    };
 1034|       |
 1035|  8.94k|    auto dict = xref_obj.getDict();
 1036|       |
 1037|  8.94k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1038|  8.94k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1039|  8.94k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1040|       |
 1041|  8.94k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1042|  8.94k|    size_t actual_size = bp->getSize();
 1043|  8.94k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1044|       |
 1045|  8.94k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1045:9): [True: 5.07k, False: 3.87k]
  ------------------
 1046|  5.07k|        QPDFExc x = damaged(
 1047|  5.07k|            "Cross-reference stream data has the wrong size; expected = " +
 1048|  5.07k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1049|  5.07k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1049:13): [True: 788, False: 4.28k]
  ------------------
 1050|    788|            throw x;
 1051|  4.28k|        } else {
 1052|  4.28k|            warn(x);
 1053|  4.28k|        }
 1054|  5.07k|    }
 1055|       |
 1056|  8.16k|    bool saw_first_compressed_object = false;
 1057|       |
 1058|       |    // Actual size vs. expected size check above ensures that we will not overflow any buffers here.
 1059|       |    // We know that entry_size * num_entries is less or equal to the size of the buffer.
 1060|  8.16k|    auto p = bp->getBuffer();
 1061|  8.16k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1061:33): [True: 5.82k, False: 8.16k]
  ------------------
 1062|       |        // Process a subsection.
 1063|  1.64M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1063:25): [True: 1.63M, False: 5.82k]
  ------------------
 1064|       |            // Read this entry
 1065|  1.63M|            std::array<qpdf_offset_t, 3> fields{};
 1066|  1.63M|            if (W[0] == 0) {
  ------------------
  |  Branch (1066:17): [True: 312k, False: 1.32M]
  ------------------
 1067|   312k|                fields[0] = 1;
 1068|   312k|            }
 1069|  6.53M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1069:32): [True: 4.90M, False: 1.63M]
  ------------------
 1070|  10.3M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1070:33): [True: 5.48M, False: 4.90M]
  ------------------
 1071|  5.48M|                    fields[j] <<= 8;
 1072|  5.48M|                    fields[j] |= *p++;
 1073|  5.48M|                }
 1074|  4.90M|            }
 1075|       |
 1076|       |            // Get the generation number.  The generation number is 0 unless this is an uncompressed
 1077|       |            // object record, in which case the generation number appears as the third field.
 1078|  1.63M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1078:17): [True: 1.28M, False: 349k]
  ------------------
 1079|  1.28M|                if (fields[0] != 2) {
  ------------------
  |  Branch (1079:21): [True: 933k, False: 352k]
  ------------------
 1080|   933k|                    uncompressed_after_compressed_ = true;
 1081|   933k|                }
 1082|  1.28M|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1082:24): [True: 2.15k, False: 347k]
  ------------------
 1083|  2.15k|                saw_first_compressed_object = true;
 1084|  2.15k|            }
 1085|  1.63M|            if (obj == 0) {
  ------------------
  |  Branch (1085:17): [True: 4.42k, False: 1.63M]
  ------------------
 1086|       |                // This is needed by checkLinearization()
 1087|  4.42k|                first_xref_item_offset_ = xref_offset;
 1088|  1.63M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1088:24): [True: 357k, False: 1.27M]
  ------------------
 1089|       |                // Ignore fields[2], which we don't care about in this case. This works around the
 1090|       |                // issue of some PDF files that put invalid values, like -1, here for deleted
 1091|       |                // objects.
 1092|   357k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1093|  1.27M|            } else {
 1094|  1.27M|                auto typ = toI(fields[0]);
 1095|  1.27M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1095:21): [True: 573k, False: 698k]
  |  Branch (1095:44): [True: 320k, False: 378k]
  ------------------
 1096|       |                    // If we are in xref stream recovery all actual uncompressed objects have
 1097|       |                    // already been inserted into the xref table. Avoid adding junk data into the
 1098|       |                    // xref table.
 1099|   893k|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1100|   893k|                }
 1101|  1.27M|            }
 1102|  1.63M|            ++obj;
 1103|  1.63M|        }
 1104|  5.82k|    }
 1105|       |
 1106|  8.16k|    if (!m->trailer) {
  ------------------
  |  Branch (1106:9): [True: 1.45k, False: 6.70k]
  ------------------
 1107|  1.45k|        setTrailer(dict);
 1108|  1.45k|    }
 1109|       |
 1110|  8.16k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1110:9): [True: 1.18k, False: 6.97k]
  ------------------
 1111|  1.18k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1111:13): [True: 95, False: 1.09k]
  ------------------
 1112|     95|            throw damagedPDF(
 1113|     95|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1114|     95|        }
 1115|  1.09k|        return dict.getKey("/Prev").getIntValue();
 1116|  6.97k|    } else {
 1117|  6.97k|        return 0;
 1118|  6.97k|    }
 1119|  8.16k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1123|  1.10M|{
 1124|       |    // Populate the xref table in such a way that the first reference to an object that we see,
 1125|       |    // which is the one in the latest xref table in which it appears, is the one that gets stored.
 1126|       |    // This works because we are reading more recent appends before older ones.
 1127|       |
 1128|       |    // If there is already an entry for this object and generation in the table, it means that a
 1129|       |    // later xref table has registered this object.  Disregard this one.
 1130|  1.10M|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1130:19): [True: 353k, False: 754k]
  ------------------
 1131|       |
 1132|  1.10M|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1132:11): [True: 666k, False: 441k]
  |  Branch (1132:22): [True: 353k, False: 88.3k]
  ------------------
 1133|  88.3k|        return;
 1134|  88.3k|    }
 1135|       |
 1136|  1.01M|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1136:11): [True: 1.01M, False: 1.41k]
  |  Branch (1136:22): [True: 575k, False: 443k]
  |  Branch (1136:53): [True: 574k, False: 675]
  |  Branch (1136:64): [True: 573k, False: 1.09k]
  ------------------
 1137|       |        // We are ignoring invalid objgens. Most will arrive here from xref reconstruction. There
 1138|       |        // is probably no point having another warning but we could count invalid items in order to
 1139|       |        // decide when to give up.
 1140|       |        // ignore impossibly large object ids or object ids > Size.
 1141|   446k|        return;
 1142|   446k|    }
 1143|       |
 1144|   573k|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1144:9): [True: 1.53k, False: 571k]
  ------------------
 1145|  1.53k|        return;
 1146|  1.53k|    }
 1147|       |
 1148|   571k|    if (f0 == 2) {
  ------------------
  |  Branch (1148:9): [True: 219k, False: 352k]
  ------------------
 1149|   219k|        if (f1 == obj) {
  ------------------
  |  Branch (1149:13): [True: 674, False: 219k]
  ------------------
 1150|    674|            warn(
 1151|    674|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1152|    674|            return;
 1153|    674|        }
 1154|   219k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1154:13): [True: 6.44k, False: 212k]
  ------------------
 1155|       |            // ignore impossibly large object stream ids
 1156|  6.44k|            warn(damagedPDF(
 1157|  6.44k|                "xref stream",
 1158|  6.44k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1159|  6.44k|                    " is impossibly large"));
 1160|  6.44k|            return;
 1161|  6.44k|        }
 1162|   219k|    }
 1163|       |
 1164|   564k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1164:71): [True: 212k, False: 352k]
  ------------------
 1165|   564k|    if (!created) {
  ------------------
  |  Branch (1165:9): [True: 70.8k, False: 494k]
  ------------------
 1166|  70.8k|        return;
 1167|  70.8k|    }
 1168|       |
 1169|   494k|    switch (f0) {
 1170|   286k|    case 1:
  ------------------
  |  Branch (1170:5): [True: 286k, False: 207k]
  ------------------
 1171|       |        // f2 is generation
 1172|   286k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1172:47): [True: 64.5k, False: 221k]
  ------------------
 1173|   286k|        iter->second = QPDFXRefEntry(f1);
 1174|   286k|        break;
 1175|       |
 1176|   207k|    case 2:
  ------------------
  |  Branch (1176:5): [True: 207k, False: 286k]
  ------------------
 1177|   207k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1178|   207k|        break;
 1179|       |
 1180|      0|    default:
  ------------------
  |  Branch (1180:5): [True: 0, False: 494k]
  ------------------
 1181|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1182|      0|        break;
 1183|   494k|    }
 1184|   494k|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1188|   362k|{
 1189|   362k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1189:9): [True: 361k, False: 1.04k]
  |  Branch (1189:40): [True: 145k, False: 215k]
  ------------------
 1190|   145k|        m->deleted_objects.insert(og.getObj());
 1191|   145k|    }
 1192|   362k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1224|  5.60k|{
 1225|  5.60k|    bool may_change = !m->reconstructed_xref;
 1226|   136k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1226:20): [True: 136k, False: 5.47k]
  ------------------
 1227|   136k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1227:13): [True: 60.0k, False: 76.8k]
  ------------------
 1228|  60.0k|            resolve(iter.first);
 1229|  60.0k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1229:17): [True: 584, False: 59.4k]
  |  Branch (1229:31): [True: 130, False: 454]
  ------------------
 1230|    130|                return false;
 1231|    130|            }
 1232|  60.0k|        }
 1233|   136k|    }
 1234|  5.47k|    return true;
 1235|  5.60k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1241|  43.1k|{
 1242|  43.1k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1242:9): [True: 37.6k, False: 5.47k]
  ------------------
 1243|  37.6k|        return;
 1244|  37.6k|    }
 1245|  5.47k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1245:9): [True: 130, False: 5.34k]
  ------------------
 1246|    130|        m->objects.resolveXRefTable();
 1247|    130|    }
 1248|  5.47k|    m->fixed_dangling_refs = true;
 1249|  5.47k|}
_ZN4QPDF14getObjectCountEv:
 1253|  43.1k|{
 1254|       |    // This method returns the next available indirect object number. makeIndirectObject uses it for
 1255|       |    // this purpose. After fixDanglingReferences is called, all objects in the xref table will also
 1256|       |    // be in obj_cache.
 1257|  43.1k|    fixDanglingReferences();
 1258|  43.1k|    QPDFObjGen og;
 1259|  43.1k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1259:9): [True: 43.1k, False: 18]
  ------------------
 1260|  43.1k|        og = (*(m->obj_cache.rbegin())).first;
 1261|  43.1k|    }
 1262|  43.1k|    return QIntC::to_size(og.getObj());
 1263|  43.1k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1279|   298k|{
 1280|   298k|    m->last_object_description.clear();
 1281|   298k|    if (!description.empty()) {
  ------------------
  |  Branch (1281:9): [True: 9.95k, False: 288k]
  ------------------
 1282|  9.95k|        m->last_object_description += description;
 1283|  9.95k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1283:13): [True: 9.95k, False: 0]
  ------------------
 1284|  9.95k|            m->last_object_description += ": ";
 1285|  9.95k|        }
 1286|  9.95k|    }
 1287|   298k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1287:9): [True: 298k, False: 0]
  ------------------
 1288|   298k|        m->last_object_description += "object " + og.unparse(' ');
 1289|   298k|    }
 1290|   298k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1294|  20.7k|{
 1295|  20.7k|    qpdf_offset_t offset = m->file->tell();
 1296|  20.7k|    auto object =
 1297|  20.7k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1298|  20.7k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1298:9): [True: 4.81k, False: 15.9k]
  |  Branch (1298:9): [True: 121, False: 20.6k]
  |  Branch (1298:34): [True: 121, False: 4.69k]
  ------------------
 1299|    121|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1300|    121|    }
 1301|       |    // Override last_offset so that it points to the beginning of the object we just read
 1302|  20.7k|    m->file->setLastOffset(offset);
 1303|  20.7k|    return object;
 1304|  20.7k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1308|   153k|{
 1309|   153k|    setLastObjectDescription(description, og);
 1310|   153k|    qpdf_offset_t offset = m->file->tell();
 1311|       |
 1312|   153k|    StringDecrypter decrypter{&qpdf, og};
 1313|   153k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1313:38): [True: 5.41k, False: 147k]
  ------------------
 1314|   153k|    auto object = Parser::parse(
 1315|   153k|        *m->file,
 1316|   153k|        m->last_object_description,
 1317|   153k|        m->tokenizer,
 1318|   153k|        decrypter_ptr,
 1319|   153k|        qpdf,
 1320|   153k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1320:9): [True: 146k, False: 6.30k]
  |  Branch (1320:34): [True: 3.53k, False: 2.76k]
  ------------------
 1321|   153k|    if (!object) {
  ------------------
  |  Branch (1321:9): [True: 14.1k, False: 138k]
  ------------------
 1322|  14.1k|        return {};
 1323|  14.1k|    }
 1324|   138k|    auto token = readToken(*m->file);
 1325|   138k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1325:9): [True: 123k, False: 14.9k]
  |  Branch (1325:9): [True: 43.5k, False: 95.3k]
  |  Branch (1325:34): [True: 43.5k, False: 80.4k]
  ------------------
 1326|  43.5k|        readStream(object, og, offset);
 1327|  43.5k|        token = readToken(*m->file);
 1328|  43.5k|    }
 1329|   138k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1329:9): [True: 42.1k, False: 96.7k]
  ------------------
 1330|  42.1k|        warn(damagedPDF("expected endobj"));
 1331|  42.1k|    }
 1332|   138k|    return object;
 1333|   153k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1338|  43.5k|{
 1339|  43.5k|    validateStreamLineEnd(object, og, offset);
 1340|       |
 1341|       |    // Must get offset before accessing any additional objects since resolving a previously
 1342|       |    // unresolved indirect object will change file position.
 1343|  43.5k|    qpdf_offset_t stream_offset = m->file->tell();
 1344|  43.5k|    size_t length = 0;
 1345|       |
 1346|  43.5k|    try {
 1347|  43.5k|        auto length_obj = object.getKey("/Length");
 1348|       |
 1349|  43.5k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1349:13): [True: 19.5k, False: 23.9k]
  ------------------
 1350|  19.5k|            if (length_obj.null()) {
  ------------------
  |  Branch (1350:17): [True: 19.3k, False: 250]
  ------------------
 1351|  19.3k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1352|  19.3k|            }
 1353|    250|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1354|  19.5k|        }
 1355|       |
 1356|  23.9k|        length = toS(length_obj.getUIntValue());
 1357|       |        // Seek in two steps to avoid potential integer overflow
 1358|  23.9k|        m->file->seek(stream_offset, SEEK_SET);
 1359|  23.9k|        m->file->seek(toO(length), SEEK_CUR);
 1360|  23.9k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1360:13): [True: 4.62k, False: 19.3k]
  ------------------
 1361|  4.62k|            throw damagedPDF("expected endstream");
 1362|  4.62k|        }
 1363|  29.8k|    } catch (QPDFExc& e) {
 1364|  29.8k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1364:13): [True: 29.8k, False: 0]
  ------------------
 1365|  29.8k|            warn(e);
 1366|  29.8k|            length = recoverStreamLength(m->file, og, stream_offset);
 1367|  29.8k|        } else {
 1368|      0|            throw;
 1369|      0|        }
 1370|  29.8k|    }
 1371|  36.6k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1372|  36.6k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1376|  43.5k|{
 1377|       |    // The PDF specification states that the word "stream" should be followed by either a carriage
 1378|       |    // return and a newline or by a newline alone.  It specifically disallowed following it by a
 1379|       |    // carriage return alone since, in that case, there would be no way to tell whether the NL in a
 1380|       |    // CR NL sequence was part of the stream data.  However, some readers, including Adobe reader,
 1381|       |    // accept a carriage return by itself when followed by a non-newline character, so that's what
 1382|       |    // we do here. We have also seen files that have extraneous whitespace between the stream
 1383|       |    // keyword and the newline.
 1384|  54.6k|    while (true) {
  ------------------
  |  Branch (1384:12): [True: 54.6k, Folded]
  ------------------
 1385|  54.6k|        char ch;
 1386|  54.6k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1386:13): [True: 200, False: 54.4k]
  ------------------
 1387|       |            // A premature EOF here will result in some other problem that will get reported at
 1388|       |            // another time.
 1389|    200|            return;
 1390|    200|        }
 1391|  54.4k|        if (ch == '\n') {
  ------------------
  |  Branch (1391:13): [True: 16.1k, False: 38.2k]
  ------------------
 1392|       |            // ready to read stream data
 1393|  16.1k|            return;
 1394|  16.1k|        }
 1395|  38.2k|        if (ch == '\r') {
  ------------------
  |  Branch (1395:13): [True: 21.9k, False: 16.2k]
  ------------------
 1396|       |            // Read another character
 1397|  21.9k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1397:17): [True: 21.9k, False: 31]
  ------------------
 1398|  21.9k|                if (ch == '\n') {
  ------------------
  |  Branch (1398:21): [True: 19.7k, False: 2.21k]
  ------------------
 1399|       |                    // Ready to read stream data
 1400|  19.7k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1401|  19.7k|                } else {
 1402|       |                    // Treat the \r by itself as the whitespace after endstream and start reading
 1403|       |                    // stream data in spite of not having seen a newline.
 1404|  2.21k|                    m->file->unreadCh(ch);
 1405|  2.21k|                    warn(damagedPDF(
 1406|  2.21k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1407|  2.21k|                }
 1408|  21.9k|            }
 1409|  21.9k|            return;
 1410|  21.9k|        }
 1411|  16.2k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1411:13): [True: 5.09k, False: 11.1k]
  ------------------
 1412|  5.09k|            m->file->unreadCh(ch);
 1413|  5.09k|            warn(damagedPDF(
 1414|  5.09k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1415|  5.09k|            return;
 1416|  5.09k|        }
 1417|  11.1k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1418|  11.1k|    }
 1419|  43.5k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1423|  26.1k|{
 1424|       |    // Find endstream or endobj. Position the input at that token.
 1425|  26.1k|    auto t = readToken(*m->file, 20);
 1426|  26.1k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1426:9): [True: 16.4k, False: 9.71k]
  |  Branch (1426:9): [True: 22.4k, False: 3.68k]
  |  Branch (1426:31): [True: 6.03k, False: 3.68k]
  ------------------
 1427|  22.4k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1428|  22.4k|        return true;
 1429|  22.4k|    }
 1430|  3.68k|    return false;
 1431|  26.1k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1436|  23.2k|{
 1437|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1438|  23.2k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1439|       |
 1440|  23.2k|    PatternFinder ef(*this, &Objects::findEndstream);
 1441|  23.2k|    size_t length = 0;
 1442|  23.2k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1442:9): [True: 22.4k, False: 731]
  ------------------
 1443|  22.4k|        length = toS(m->file->tell() - stream_offset);
 1444|       |        // Reread endstream but, if it was endobj, don't skip that.
 1445|  22.4k|        QPDFTokenizer::Token t = readToken(*m->file);
 1446|  22.4k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1446:13): [True: 16.4k, False: 6.03k]
  ------------------
 1447|  16.4k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1448|  16.4k|        }
 1449|  22.4k|    }
 1450|       |
 1451|  23.2k|    if (length) {
  ------------------
  |  Branch (1451:9): [True: 21.8k, False: 1.35k]
  ------------------
 1452|  21.8k|        auto end = stream_offset + toO(length);
 1453|  21.8k|        qpdf_offset_t found_offset = 0;
 1454|  21.8k|        QPDFObjGen found_og;
 1455|       |
 1456|       |        // Make sure this is inside this object
 1457|   657k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1457:45): [True: 657k, False: 21.8k]
  ------------------
 1458|   657k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1458:17): [True: 586k, False: 71.9k]
  ------------------
 1459|   586k|                qpdf_offset_t obj_offset = entry.getOffset();
 1460|   586k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1460:21): [True: 396k, False: 189k]
  |  Branch (1460:50): [True: 88.0k, False: 308k]
  ------------------
 1461|  88.0k|                    found_offset = obj_offset;
 1462|  88.0k|                    found_og = current_og;
 1463|  88.0k|                }
 1464|   586k|            }
 1465|   657k|        }
 1466|  21.8k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1466:13): [True: 2.61k, False: 19.2k]
  |  Branch (1466:30): [True: 17.6k, False: 1.59k]
  ------------------
 1467|       |            // If we are trying to recover an XRef stream the xref table will not contain and
 1468|       |            // won't contain any entries, therefore we cannot check the found length. Otherwise we
 1469|       |            // found endstream\nendobj within the space allowed for this object, so we're probably
 1470|       |            // in good shape.
 1471|  20.2k|        } else {
 1472|  1.59k|            length = 0;
 1473|  1.59k|        }
 1474|  21.8k|    }
 1475|       |
 1476|  23.2k|    if (length == 0) {
  ------------------
  |  Branch (1476:9): [True: 2.94k, False: 20.2k]
  ------------------
 1477|  2.94k|        warn(damagedPDF(
 1478|  2.94k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1479|  20.2k|    } else {
 1480|  20.2k|        warn(damagedPDF(
 1481|  20.2k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1482|  20.2k|    }
 1483|       |
 1484|  23.2k|    return length;
 1485|  23.2k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1489|  3.70M|{
 1490|  3.70M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1491|  3.70M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1495|   156k|{
 1496|   156k|    m->file->seek(offset, SEEK_SET);
 1497|   156k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1498|   156k|    bool objidok = tobjid.isInteger();
 1499|   156k|    if (!objidok) {
  ------------------
  |  Branch (1499:9): [True: 1.88k, False: 154k]
  ------------------
 1500|  1.88k|        throw damagedPDF(offset, "expected n n obj");
 1501|  1.88k|    }
 1502|   154k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1503|   154k|    bool genok = tgen.isInteger();
 1504|   154k|    if (!genok) {
  ------------------
  |  Branch (1504:9): [True: 278, False: 154k]
  ------------------
 1505|    278|        throw damagedPDF(offset, "expected n n obj");
 1506|    278|    }
 1507|   154k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1508|       |
 1509|   154k|    bool objok = tobj.isWord("obj");
 1510|       |
 1511|   154k|    if (!objok) {
  ------------------
  |  Branch (1511:9): [True: 418, False: 153k]
  ------------------
 1512|    418|        throw damagedPDF(offset, "expected n n obj");
 1513|    418|    }
 1514|   153k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1515|   153k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1516|   153k|    if (objid == 0) {
  ------------------
  |  Branch (1516:9): [True: 73, False: 153k]
  ------------------
 1517|     73|        throw damagedPDF(offset, "object with ID 0");
 1518|     73|    }
 1519|   153k|    return {objid, generation};
 1520|   153k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1525|   145k|{
 1526|   145k|    QPDFObjGen og;
 1527|   145k|    setLastObjectDescription(description, exp_og);
 1528|       |
 1529|   145k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1529:9): [True: 0, False: 145k]
  ------------------
 1530|      0|        try_recovery = false;
 1531|      0|    }
 1532|       |
 1533|       |    // Special case: if offset is 0, just return null.  Some PDF writers, in particular
 1534|       |    // "Mac OS X 10.7.5 Quartz PDFContext", may store deleted objects in the xref table as
 1535|       |    // "0000000000 00000 n", which is not correct, but it won't hurt anything for us to ignore
 1536|       |    // these.
 1537|   145k|    if (offset == 0) {
  ------------------
  |  Branch (1537:9): [True: 261, False: 145k]
  ------------------
 1538|    261|        warn(damagedPDF(
 1539|    261|            -1,
 1540|    261|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1541|    261|            "applications"));
 1542|    261|        return;
 1543|    261|    }
 1544|       |
 1545|   145k|    try {
 1546|   145k|        og = read_object_start(offset);
 1547|   145k|        if (exp_og != og) {
  ------------------
  |  Branch (1547:13): [True: 274, False: 144k]
  ------------------
 1548|    274|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1549|    274|            if (try_recovery) {
  ------------------
  |  Branch (1549:17): [True: 274, False: 0]
  ------------------
 1550|       |                // Will be retried below
 1551|    274|                throw e;
 1552|    274|            } else {
 1553|       |                // We can try reading the object anyway even if the ID doesn't match.
 1554|      0|                warn(e);
 1555|      0|            }
 1556|    274|        }
 1557|   145k|    } catch (QPDFExc& e) {
 1558|  1.70k|        if (!try_recovery) {
  ------------------
  |  Branch (1558:13): [True: 0, False: 1.70k]
  ------------------
 1559|      0|            throw;
 1560|      0|        }
 1561|       |        // Try again after reconstructing xref table
 1562|  1.70k|        reconstruct_xref(e);
 1563|  1.70k|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1563:13): [True: 91, False: 1.61k]
  |  Branch (1563:47): [True: 91, False: 0]
  ------------------
 1564|     91|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1565|     91|            readObjectAtOffset(false, new_offset, description, exp_og);
 1566|     91|            return;
 1567|     91|        }
 1568|  1.61k|        warn(damagedPDF(
 1569|  1.61k|            "",
 1570|  1.61k|            -1,
 1571|  1.61k|            ("object " + exp_og.unparse(' ') +
 1572|  1.61k|             " not found in file after regenerating cross reference table")));
 1573|  1.61k|        return;
 1574|  1.70k|    }
 1575|       |
 1576|   143k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1576:14): [True: 116k, False: 26.8k]
  ------------------
 1577|       |        // Determine the end offset of this object before and after white space.  We use these
 1578|       |        // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1579|       |        // the end of an object to be anywhere between these values.
 1580|   116k|        qpdf_offset_t end_before_space = m->file->tell();
 1581|       |
 1582|       |        // skip over spaces
 1583|   268k|        while (true) {
  ------------------
  |  Branch (1583:16): [True: 268k, Folded]
  ------------------
 1584|   268k|            char ch;
 1585|   268k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1585:17): [True: 961, False: 267k]
  ------------------
 1586|    961|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1587|    961|            }
 1588|   267k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1588:17): [True: 115k, False: 152k]
  ------------------
 1589|   115k|                m->file->seek(-1, SEEK_CUR);
 1590|   115k|                break;
 1591|   115k|            }
 1592|   267k|        }
 1593|   115k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1594|   115k|    }
 1595|   143k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1600|  11.2k|{
 1601|  11.2k|    auto og = read_object_start(offset);
 1602|  11.2k|    auto oh = readObject(description, og);
 1603|       |
 1604|  11.2k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1604:9): [True: 1.39k, False: 9.84k]
  |  Branch (1604:16): [True: 6.39k, False: 3.45k]
  ------------------
 1605|  6.49k|        return oh;
 1606|  6.49k|    }
 1607|       |
 1608|  4.74k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1608:9): [True: 3.45k, False: 1.29k]
  |  Branch (1608:34): [True: 17, False: 3.43k]
  ------------------
 1609|       |        // In the special case of the xref stream and linearization hint tables, the offset comes
 1610|       |        // from another source. For the specific case of xref streams, the xref stream is read and
 1611|       |        // loaded into the object cache very early in parsing. Ordinarily, when a file is updated by
 1612|       |        // appending, items inserted into the xref table in later updates take precedence over
 1613|       |        // earlier items. In the special case of reusing the object number previously used as the
 1614|       |        // xref stream, we have the following order of events:
 1615|       |        //
 1616|       |        // * reused object gets loaded into the xref table
 1617|       |        // * old object is read here while reading xref streams
 1618|       |        // * original xref entry is ignored (since already in xref table)
 1619|       |        //
 1620|       |        // It is the second step that causes a problem. Even though the xref table is correct in
 1621|       |        // this case, the old object is already in the cache and so effectively prevails over the
 1622|       |        // reused object. To work around this issue, we have a special case for the xref stream (via
 1623|       |        // the skip_cache_if_in_xref): if the object is already in the xref stream, don't cache what
 1624|       |        // we read here.
 1625|       |        //
 1626|       |        // It is likely that the same bug may exist for linearization hint tables, but the existing
 1627|       |        // code uses end_before_space and end_after_space from the cache, so fixing that would
 1628|       |        // require more significant rework. The chances of a linearization hint stream being reused
 1629|       |        // seems smaller because the xref stream is probably the highest object in the file and the
 1630|       |        // linearization hint stream would be some random place in the middle, so I'm leaving that
 1631|       |        // bug unfixed for now. If the bug were to be fixed, we could use !check_og in place of
 1632|       |        // skip_cache_if_in_xref.
 1633|     17|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1634|     17|        return oh;
 1635|     17|    }
 1636|       |
 1637|       |    // Determine the end offset of this object before and after white space.  We use these
 1638|       |    // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1639|       |    // the end of an object to be anywhere between these values.
 1640|  4.72k|    qpdf_offset_t end_before_space = m->file->tell();
 1641|       |
 1642|       |    // skip over spaces
 1643|  8.67k|    while (true) {
  ------------------
  |  Branch (1643:12): [True: 7.38k, Folded]
  ------------------
 1644|  7.38k|        char ch;
 1645|  7.38k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1645:13): [True: 102, False: 7.27k]
  ------------------
 1646|    102|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1647|    102|        }
 1648|  7.27k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1648:13): [True: 3.33k, False: 3.94k]
  ------------------
 1649|  3.33k|            m->file->seek(-1, SEEK_CUR);
 1650|  3.33k|            break;
 1651|  3.33k|        }
 1652|  7.27k|    }
 1653|  4.62k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1654|       |
 1655|  4.62k|    return oh;
 1656|  4.72k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1660|   357k|{
 1661|   357k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1661:9): [True: 0, False: 357k]
  ------------------
 1662|      0|        return m->obj_cache[og].object;
 1663|      0|    }
 1664|       |
 1665|   357k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1665:9): [True: 603, False: 357k]
  ------------------
 1666|       |        // This can happen if an object references itself directly or indirectly in some key that
 1667|       |        // has to be resolved during object parsing, such as stream length.
 1668|    603|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1669|    603|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1670|    603|        return m->obj_cache[og].object;
 1671|    603|    }
 1672|   357k|    ResolveRecorder rr(qpdf, og);
 1673|       |
 1674|   357k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 221k, False: 135k]
  ------------------
 1675|   221k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1676|   221k|        try {
 1677|   221k|            switch (entry.getType()) {
 1678|   145k|            case 1:
  ------------------
  |  Branch (1678:13): [True: 145k, False: 76.0k]
  ------------------
 1679|       |                // Object stored in cache by readObjectAtOffset
 1680|   145k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1681|   145k|                break;
 1682|       |
 1683|  76.0k|            case 2:
  ------------------
  |  Branch (1683:13): [True: 76.0k, False: 145k]
  ------------------
 1684|  76.0k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1685|  76.0k|                break;
 1686|       |
 1687|     10|            default:
  ------------------
  |  Branch (1687:13): [True: 10, False: 221k]
  ------------------
 1688|     10|                throw damagedPDF(
 1689|     10|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1690|   221k|            }
 1691|   221k|        } catch (QPDFExc& e) {
 1692|  40.7k|            warn(e);
 1693|  40.7k|        } catch (std::exception& e) {
 1694|    405|            warn(damagedPDF(
 1695|    405|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1696|    405|        }
 1697|   221k|    }
 1698|       |
 1699|   340k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1699:9): [True: 224k, False: 115k]
  ------------------
 1700|       |        // PDF spec says unknown objects resolve to the null object.
 1701|   224k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1702|   224k|    }
 1703|       |
 1704|   340k|    auto& result(m->obj_cache[og].object);
 1705|   340k|    result->setDefaultDescription(&qpdf, og);
 1706|   340k|    return result;
 1707|   357k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1711|  76.0k|{
 1712|  76.0k|    auto damaged =
 1713|  76.0k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1714|  76.0k|        return {
 1715|  76.0k|            qpdf_e_damaged_pdf,
 1716|  76.0k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1717|  76.0k|            +"object " + std::to_string(id) + " 0",
 1718|  76.0k|            offset,
 1719|  76.0k|            msg,
 1720|  76.0k|            true};
 1721|  76.0k|    };
 1722|       |
 1723|  76.0k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1723:9): [True: 49.8k, False: 26.1k]
  ------------------
 1724|  49.8k|        return;
 1725|  49.8k|    }
 1726|  26.1k|    m->resolved_object_streams.insert(obj_stream_number);
 1727|       |    // Force resolution of object stream
 1728|  26.1k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1729|  26.1k|    if (!obj_stream) {
  ------------------
  |  Branch (1729:9): [True: 22.2k, False: 3.98k]
  ------------------
 1730|  22.2k|        throw damagedPDF(
 1731|  22.2k|            "object " + std::to_string(obj_stream_number) + " 0",
 1732|  22.2k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1733|  22.2k|    }
 1734|       |
 1735|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1736|       |    // the stream.
 1737|  3.98k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1738|  3.98k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1739|  3.98k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1740|       |
 1741|  3.98k|    QPDFObjectHandle dict = obj_stream.getDict();
 1742|  3.98k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1742:9): [True: 713, False: 3.26k]
  ------------------
 1743|    713|        warn(damagedPDF(
 1744|    713|            "object " + std::to_string(obj_stream_number) + " 0",
 1745|    713|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1746|    713|    }
 1747|       |
 1748|  3.98k|    unsigned int n{0};
 1749|  3.98k|    int first{0};
 1750|  3.98k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1750:9): [True: 145, False: 3.83k]
  |  Branch (1750:11): [True: 1.20k, False: 2.77k]
  |  Branch (1750:50): [True: 1.17k, False: 24]
  ------------------
 1751|    145|        throw damagedPDF(
 1752|    145|            "object " + std::to_string(obj_stream_number) + " 0",
 1753|    145|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1754|    145|    }
 1755|       |
 1756|       |    // id, offset, size
 1757|  3.83k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1758|       |
 1759|  3.83k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1760|       |
 1761|  3.83k|    is::OffsetBuffer input("", stream_data);
 1762|       |
 1763|  3.83k|    const auto b_size = stream_data.size();
 1764|  3.83k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1765|  3.83k|    auto b_start = stream_data.data();
 1766|       |
 1767|  3.83k|    if (first >= end_offset) {
  ------------------
  |  Branch (1767:9): [True: 36, False: 3.79k]
  ------------------
 1768|     36|        throw damagedPDF(
 1769|     36|            "object " + std::to_string(obj_stream_number) + " 0",
 1770|     36|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1771|     36|    }
 1772|       |
 1773|  3.79k|    int id = 0;
 1774|  3.79k|    long long last_offset = -1;
 1775|  3.79k|    bool is_first = true;
 1776|  42.1k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1776:30): [True: 38.5k, False: 3.63k]
  ------------------
 1777|  38.5k|        auto tnum = readToken(input);
 1778|  38.5k|        auto id_offset = input.getLastOffset();
 1779|  38.5k|        auto toffset = readToken(input);
 1780|  38.5k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1780:15): [True: 38.4k, False: 103]
  |  Branch (1780:35): [True: 38.4k, False: 65]
  ------------------
 1781|    168|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1782|    168|        }
 1783|       |
 1784|  38.4k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1785|  38.4k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1786|       |
 1787|  38.4k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1787:13): [True: 339, False: 38.0k]
  ------------------
 1788|    339|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1789|    339|            continue;
 1790|    339|        }
 1791|       |
 1792|  38.0k|        if (num < 1) {
  ------------------
  |  Branch (1792:13): [True: 579, False: 37.4k]
  ------------------
 1793|    579|            warn(damaged(num, id_offset, "object id is invalid"s));
 1794|    579|            continue;
 1795|    579|        }
 1796|       |
 1797|  37.4k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1797:13): [True: 3.31k, False: 34.1k]
  ------------------
 1798|  3.31k|            warn(damaged(
 1799|  3.31k|                num,
 1800|  3.31k|                input.getLastOffset(),
 1801|  3.31k|                "offset " + std::to_string(offset) +
 1802|  3.31k|                    " is invalid (must be larger than previous offset " +
 1803|  3.31k|                    std::to_string(last_offset) + ")"));
 1804|  3.31k|            continue;
 1805|  3.31k|        }
 1806|       |
 1807|  34.1k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1807:13): [True: 961, False: 33.2k]
  ------------------
 1808|    961|            continue;
 1809|    961|        }
 1810|       |
 1811|  33.2k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1811:13): [True: 6.71k, False: 26.4k]
  ------------------
 1812|  6.71k|            warn(damaged(
 1813|  6.71k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1814|  6.71k|            continue;
 1815|  6.71k|        }
 1816|       |
 1817|  26.4k|        if (is_first) {
  ------------------
  |  Branch (1817:13): [True: 834, False: 25.6k]
  ------------------
 1818|    834|            is_first = false;
 1819|  25.6k|        } else {
 1820|  25.6k|            offsets.emplace_back(
 1821|  25.6k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1822|  25.6k|        }
 1823|       |
 1824|  26.4k|        last_offset = offset;
 1825|  26.4k|        id = num;
 1826|  26.4k|    }
 1827|       |
 1828|  3.63k|    if (!is_first) {
  ------------------
  |  Branch (1828:9): [True: 710, False: 2.92k]
  ------------------
 1829|       |        // We found at least one valid entry.
 1830|    710|        offsets.emplace_back(
 1831|    710|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1832|    710|    }
 1833|       |
 1834|       |    // To avoid having to read the object stream multiple times, store all objects that would be
 1835|       |    // found here in the cache.  Remember that some objects stored here might have been overridden
 1836|       |    // by new objects appended to the file, so it is necessary to recheck the xref table and only
 1837|       |    // cache what would actually be resolved here.
 1838|  23.0k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1838:52): [True: 23.0k, False: 3.63k]
  ------------------
 1839|  23.0k|        QPDFObjGen og(obj_id, 0);
 1840|  23.0k|        auto entry = m->xref_table.find(og);
 1841|  23.0k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1841:13): [True: 21.5k, False: 1.49k]
  |  Branch (1841:13): [True: 20.9k, False: 2.14k]
  |  Branch (1841:45): [True: 21.1k, False: 377]
  ------------------
 1842|  21.1k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1842:13): [True: 20.9k, False: 272]
  ------------------
 1843|  20.9k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1844|  20.9k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1844:22): [True: 18.3k, False: 2.57k]
  ------------------
 1845|  18.3k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1846|  18.3k|            }
 1847|  20.9k|        } else {
 1848|  2.14k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1849|  2.14k|        }
 1850|  23.0k|    }
 1851|  3.63k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1855|  27.1k|{
 1856|  27.1k|    obj->setDefaultDescription(&qpdf, og);
 1857|  27.1k|    return {obj};
 1858|  27.1k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1867|   361k|{
 1868|   361k|    object->setObjGen(&qpdf, og);
 1869|   361k|    if (isCached(og)) {
  ------------------
  |  Branch (1869:9): [True: 295k, False: 66.1k]
  ------------------
 1870|   295k|        auto& cache = m->obj_cache[og];
 1871|   295k|        object->move_to(cache.object, destroy);
 1872|   295k|        cache.end_before_space = end_before_space;
 1873|   295k|        cache.end_after_space = end_after_space;
 1874|   295k|    } else {
 1875|  66.1k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1876|  66.1k|    }
 1877|   361k|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1881|  1.20M|{
 1882|  1.20M|    return m->obj_cache.contains(og);
 1883|  1.20M|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1887|   844k|{
 1888|   844k|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1888:12): [True: 162k, False: 681k]
  |  Branch (1888:29): [True: 482k, False: 199k]
  ------------------
 1889|   844k|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1893|  43.1k|{
 1894|  43.1k|    int max_objid = toI(qpdf.getObjectCount());
 1895|  43.1k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1895:9): [True: 13, False: 43.1k]
  ------------------
 1896|     13|        throw std::range_error("max object id is too high to create new objects");
 1897|     13|    }
 1898|  43.1k|    return {max_objid + 1, 0};
 1899|  43.1k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1903|  27.2k|{
 1904|  27.2k|    QPDFObjGen next{nextObjGen()};
 1905|  27.2k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1906|  27.2k|    return newIndirect(next, m->obj_cache[next].object);
 1907|  27.2k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1911|  27.2k|{
 1912|  27.2k|    if (!oh) {
  ------------------
  |  Branch (1912:9): [True: 0, False: 27.2k]
  ------------------
 1913|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1914|      0|    }
 1915|  27.2k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1916|  27.2k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1920|   498k|{
 1921|       |    // This method is called by the parser and therefore must not resolve any objects.
 1922|   498k|    auto og = QPDFObjGen(id, gen);
 1923|   498k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1923:44): [True: 241k, False: 257k]
  ------------------
 1924|   241k|        return iter->second.object;
 1925|   241k|    }
 1926|   257k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1926:9): [True: 93.8k, False: 163k]
  |  Branch (1926:40): [True: 148k, False: 15.2k]
  |  Branch (1926:54): [True: 143k, False: 4.99k]
  ------------------
 1927|   237k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1928|   237k|            .first->second.object;
 1929|   237k|    }
 1930|  20.2k|    if (parse_pdf) {
  ------------------
  |  Branch (1930:9): [True: 20.2k, False: 0]
  ------------------
 1931|  20.2k|        return QPDFObject::create<QPDF_Null>();
 1932|  20.2k|    }
 1933|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1934|  20.2k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1952|   131k|{
 1953|   131k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1953:42): [True: 59.0k, False: 72.5k]
  ------------------
 1954|  59.0k|        return {it->second.object};
 1955|  72.5k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1955:16): [True: 3.94k, False: 68.6k]
  |  Branch (1955:29): [True: 2.22k, False: 1.71k]
  ------------------
 1956|  2.22k|        return QPDFObject::create<QPDF_Null>();
 1957|  70.3k|    } else {
 1958|  70.3k|        auto result =
 1959|  70.3k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1960|  70.3k|        return {result.first->second.object};
 1961|  70.3k|    }
 1962|   131k|}
_ZN4QPDF13replaceObjectE10QPDFObjGen16QPDFObjectHandle:
 1972|     85|{
 1973|     85|    if (!oh || (oh.isIndirect() && !(oh.isStream() && oh.getObjGen() == og))) {
  ------------------
  |  Branch (1973:9): [True: 0, False: 85]
  |  Branch (1973:9): [True: 0, False: 85]
  |  Branch (1973:17): [True: 0, False: 85]
  |  Branch (1973:38): [True: 0, False: 0]
  |  Branch (1973:55): [True: 0, False: 0]
  ------------------
 1974|      0|        throw std::logic_error("QPDF::replaceObject called with indirect object handle");
 1975|      0|    }
 1976|     85|    m->objects.updateCache(og, oh.obj_sp(), -1, -1, false);
 1977|     85|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1981|  11.3k|{
 1982|  11.3k|    m->xref_table.erase(og);
 1983|  11.3k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1983:46): [True: 856, False: 10.5k]
  ------------------
 1984|       |        // Take care of any object handles that may be floating around.
 1985|    856|        cached->second.object->assign_null();
 1986|    856|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 1987|    856|        m->obj_cache.erase(cached);
 1988|    856|    }
 1989|  11.3k|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  75.1k|        o(o),
  148|  75.1k|        checker(checker)
  149|  75.1k|    {
  150|  75.1k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  39.7k|    {
  155|  39.7k|        return (this->o.*checker)();
  156|  39.7k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  2.28M|    auto check_warnings = [this, max_warnings]() {
  325|  2.28M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 2.28M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  2.28M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1031|  6.08k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1032|  6.08k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1033|  6.08k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   357k|        qpdf(qpdf),
  130|   357k|        iter(qpdf.m->resolving.insert(og).first)
  131|   357k|    {
  132|   357k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   357k|    {
  135|   357k|        qpdf.m->resolving.erase(iter);
  136|   357k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1713|  11.1k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1714|  11.1k|        return {
 1715|  11.1k|            qpdf_e_damaged_pdf,
 1716|  11.1k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1717|  11.1k|            +"object " + std::to_string(id) + " 0",
 1718|  11.1k|            offset,
 1719|  11.1k|            msg,
 1720|  11.1k|            true};
 1721|  11.1k|    };

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  23.0k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  23.0k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 18.0k, False: 4.95k]
  |  Branch (55:30): [True: 17.0k, False: 967]
  ------------------
   56|  17.0k|        ever_called_get_all_pages_ = true;
   57|  17.0k|        auto root = qpdf.getRoot();
   58|  17.0k|        QPDFObjGen::set visited;
   59|  17.0k|        QPDFObjGen::set seen;
   60|  17.0k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  17.0k|        bool warned = false;
   62|  17.0k|        bool changed_pages = false;
   63|  19.5k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 13.8k, False: 5.65k]
  |  Branch (63:16): [True: 2.71k, False: 16.8k]
  |  Branch (63:40): [True: 2.71k, False: 11.1k]
  ------------------
   64|  2.71k|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 267, False: 2.45k]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|    267|                break;
   67|    267|            }
   68|       |            // Files have been found in the wild where /Pages in the catalog points to the first
   69|       |            // page. Try to work around this and similar cases with this heuristic.
   70|  2.45k|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 1.22k, False: 1.23k]
  ------------------
   71|  1.22k|                root.warn(
   72|  1.22k|                    "document page tree root (root -> /Pages) doesn't point"
   73|  1.22k|                    " to the root of the page tree; attempting to correct");
   74|  1.22k|                warned = true;
   75|  1.22k|            }
   76|  2.45k|            changed_pages = true;
   77|  2.45k|            pages = pages.getKey("/Parent");
   78|  2.45k|        }
   79|  17.0k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 1.21k, False: 15.8k]
  ------------------
   80|  1.21k|            root.replaceKey("/Pages", pages);
   81|  1.21k|        }
   82|  17.0k|        seen.clear();
   83|  17.0k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 156, False: 16.9k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    156|            throw QPDFExc(
   86|    156|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    156|        }
   88|  16.9k|        try {
   89|  16.9k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  16.9k|        } catch (...) {
   91|     85|            all_pages.clear();
   92|     85|            invalid_page_found = false;
   93|     85|            throw;
   94|     85|        }
   95|  11.3k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 5.92k, False: 5.39k]
  ------------------
   96|  5.92k|            flattenPagesTree();
   97|  5.92k|            invalid_page_found = false;
   98|  5.92k|        }
   99|  11.3k|    }
  100|  17.2k|    return all_pages;
  101|  23.0k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  13.7k|{
  112|  13.7k|    static uint32_t constexpr max_level = 100;
  113|  13.7k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 13.7k]
  ------------------
  114|      0|        throw QPDFExc(
  115|      0|            qpdf_e_pages,
  116|      0|            m->file->getName(),
  117|      0|            "object " + cur_node.getObjGen().unparse(' '),
  118|      0|            0,
  119|      0|            "/Pages structure too deeply nested (getAllPages)");
  120|      0|    }
  121|  13.7k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 21, False: 13.7k]
  ------------------
  122|     21|        throw QPDFExc(
  123|     21|            qpdf_e_pages,
  124|     21|            m->file->getName(),
  125|     21|            "object " + cur_node.getObjGen().unparse(' '),
  126|     21|            0,
  127|     21|            "Loop detected in /Pages structure (getAllPages)");
  128|     21|    }
  129|  13.7k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 10.8k, False: 2.87k]
  ------------------
  130|       |        // During fuzzing files were encountered where the root object appeared in the pages tree.
  131|       |        // Unconditionally setting the /Type to /Pages could cause problems, but trying to
  132|       |        // accommodate the possibility may be excessive.
  133|  10.8k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  10.8k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  10.8k|    }
  136|  13.7k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 13.6k, False: 112]
  ------------------
  137|  13.6k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  13.6k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 1.48k, False: 12.1k]
  ------------------
  139|  13.6k|    }
  140|  13.7k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 13.4k, False: 271]
  ------------------
  141|  13.4k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  13.4k|    }
  143|  13.7k|    auto kids = cur_node.getKey("/Kids");
  144|  13.7k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 22, False: 13.7k]
  ------------------
  145|     22|        throw QPDFExc(
  146|     22|            qpdf_e_pages,
  147|     22|            m->file->getName(),
  148|     22|            "object " + cur_node.getObjGen().unparse(' '),
  149|     22|            0,
  150|     22|            "Loop detected in /Pages structure (getAllPages)");
  151|     22|    }
  152|  13.7k|    int i = -1;
  153|  76.3k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 76.3k, False: 13.7k]
  ------------------
  154|  76.3k|        ++i;
  155|  76.3k|        int errors = 0;
  156|       |
  157|  76.3k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 45.7k, False: 30.6k]
  ------------------
  158|  45.7k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  45.7k|            invalid_page_found = true;
  160|  45.7k|            continue;
  161|  45.7k|        }
  162|  30.6k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 2.32k, False: 28.2k]
  ------------------
  163|  2.32k|            cur_node.warn(
  164|  2.32k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  2.32k|            kid = qpdf.makeIndirectObject(kid);
  166|  2.32k|            ++errors;
  167|  2.32k|        }
  168|  30.6k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 2.34k, False: 28.2k]
  ------------------
  169|  2.34k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  28.2k|        } else {
  171|  28.2k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 23.9k, False: 4.31k]
  |  Branch (171:17): [True: 10.2k, False: 18.0k]
  |  Branch (171:31): [True: 10.2k, False: 13.7k]
  ------------------
  172|  10.2k|                kid.warn(
  173|  10.2k|                    "kid " + std::to_string(i) +
  174|  10.2k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  10.2k|                kid.replaceKey(
  176|  10.2k|                    "/MediaBox",
  177|  10.2k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  10.2k|                ++errors;
  179|  10.2k|            }
  180|  28.2k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 22.4k, False: 5.84k]
  ------------------
  181|  22.4k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  22.4k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 9.82k, False: 12.6k]
  ------------------
  184|  9.82k|                    ++errors;
  185|  9.82k|                    kid.warn(
  186|  9.82k|                        "kid " + std::to_string(i) +
  187|  9.82k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  9.82k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  9.82k|                }
  190|  22.4k|            }
  191|  28.2k|            auto annots = kid.getKey("/Annots");
  192|  28.2k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 6.24k, False: 22.0k]
  ------------------
  193|  6.24k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 82, False: 6.16k]
  ------------------
  194|     82|                    kid.warn(
  195|     82|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     82|                    kid.removeKey("/Annots");
  197|     82|                    ++errors;
  198|  6.16k|                } else {
  199|  6.16k|                    QPDFObjGen::set seen_annots;
  200|   127k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 127k, False: 6.16k]
  ------------------
  201|   127k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 3.66k, False: 123k]
  ------------------
  202|  3.66k|                            kid.warn(
  203|  3.66k|                                "kid " + std::to_string(i) +
  204|  3.66k|                                " (from 0) Annots has duplicate entry for annotation " +
  205|  3.66k|                                annot.id_gen().unparse(' '));
  206|  3.66k|                            ++errors;
  207|  3.66k|                        }
  208|   127k|                    }
  209|  6.16k|                }
  210|  6.24k|            }
  211|       |
  212|  28.2k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 9.46k, False: 18.8k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  9.46k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 7.52k, False: 1.94k]
  ------------------
  216|  7.52k|                    cur_node.warn(
  217|  7.52k|                        "kid " + std::to_string(i) +
  218|  7.52k|                        " (from 0) appears more than once in the pages tree;"
  219|  7.52k|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|  7.52k|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|  7.52k|                    seen.add(kid);
  224|  7.52k|                } else {
  225|  1.94k|                    cur_node.warn(
  226|  1.94k|                        "kid " + std::to_string(i) +
  227|  1.94k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  1.94k|                    invalid_page_found = true;
  229|  1.94k|                    kid = QPDFObjectHandle::newNull();
  230|  1.94k|                    continue;
  231|  1.94k|                }
  232|  7.52k|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 7.50k, False: 17]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|  7.50k|                    ++errors;
  235|  7.50k|                }
  236|  7.52k|            }
  237|  26.3k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 8.98k, False: 17.3k]
  ------------------
  238|  8.98k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  8.98k|                kid.replaceKey("/Type", Name("/Page"));
  240|  8.98k|                ++errors;
  241|  8.98k|            }
  242|  26.3k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 17.5k, False: 8.75k]
  |  Branch (242:42): [True: 1.33k, False: 16.2k]
  ------------------
  243|  1.33k|                cur_node.warn(
  244|  1.33k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.33k|                invalid_page_found = true;
  246|  1.33k|                kid = QPDFObjectHandle::newNull();
  247|  1.33k|                continue;
  248|  1.33k|            }
  249|  24.9k|            all_pages.emplace_back(kid);
  250|  24.9k|        }
  251|  30.6k|    }
  252|  13.7k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  5.92k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  5.92k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 5.92k]
  ------------------
  278|      0|        return;
  279|      0|    }
  280|       |
  281|       |    // Push inherited objects down to the /Page level.  As a side effect all_pages will also be
  282|       |    // generated.
  283|  5.92k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  5.92k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  5.92k|    size_t const len = all_pages.size();
  288|  23.3k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 17.4k, False: 5.92k]
  ------------------
  289|       |        // Populate pageobj_to_pages_pos and fix parent pointer. There should be no duplicates at
  290|       |        // this point because pushInheritedAttributesToPage calls getAllPages which resolves
  291|       |        // duplicates.
  292|  17.4k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  17.4k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  17.4k|    }
  295|       |
  296|  5.92k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  5.92k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 4.65k, False: 1.27k]
  ------------------
  299|  4.65k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 4.65k, False: 0]
  |  Branch (299:13): [True: 4.59k, False: 53]
  |  Branch (299:35): [True: 4.59k, False: 53]
  ------------------
  300|  4.59k|            pages.replaceKey("/Count", Integer(len));
  301|  4.59k|        } else {
  302|     53|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     53|        }
  304|  4.65k|    }
  305|  5.92k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  5.92k|{
  317|       |    // Traverse pages tree pushing all inherited resources down to the page level.
  318|       |
  319|       |    // The record of whether we've done this is cleared by updateAllPagesCache().  If we're warning
  320|       |    // for skipped keys, re-traverse unconditionally.
  321|  5.92k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 5.92k]
  |  Branch (321:49): [True: 0, False: 0]
  ------------------
  322|      0|        return;
  323|      0|    }
  324|       |
  325|       |    // Calling cache() resolves any duplicated page objects, repairs broken nodes, and detects
  326|       |    // loops, so we don't have to do those activities here.
  327|  5.92k|    (void)cache();
  328|       |
  329|       |    // key_ancestors is a mapping of page attribute keys to a stack of Pages nodes that contain
  330|       |    // values for them.
  331|  5.92k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  5.92k|    pushInheritedAttributesToPageInternal(
  333|  5.92k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  5.92k|        key_ancestors,
  335|  5.92k|        allow_changes,
  336|  5.92k|        warn_skipped_keys);
  337|  5.92k|    util::assertion(
  338|  5.92k|        key_ancestors.empty(),
  339|  5.92k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  5.92k|    pushed_inherited_attributes_to_pages = true;
  341|  5.92k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  5.92k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  7.93k|{
  351|       |    // Make a list of inheritable keys. Only the keys /MediaBox, /CropBox, /Resources, and /Rotate
  352|       |    // are inheritable attributes. Push this object onto the stack of pages nodes that have values
  353|       |    // for this attribute.
  354|       |
  355|  7.93k|    std::set<std::string> inheritable_keys;
  356|  31.6k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 31.6k, False: 7.93k]
  ------------------
  357|  31.6k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 1.14k, False: 30.5k]
  |  Branch (357:35): [True: 78, False: 30.4k]
  |  Branch (357:56): [True: 925, False: 29.5k]
  |  Branch (357:79): [True: 125, False: 29.4k]
  ------------------
  358|  2.27k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 2.27k]
  ------------------
  359|      0|                throw QPDFExc(
  360|      0|                    qpdf_e_internal,
  361|      0|                    m->file->getName(),
  362|      0|                    "/Pages object " + cur_pages.id_gen().unparse(' '),
  363|      0|                    cur_pages.offset(),
  364|      0|                    "pushInheritedAttributesToPage detected an inheritable attribute when called "
  365|      0|                    "in no-change mode");
  366|      0|            }
  367|       |
  368|       |            // This is an inheritable resource
  369|  2.27k|            inheritable_keys.insert(key);
  370|  2.27k|            auto oh = cur_pages[key];
  371|  2.27k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 473, False: 1.80k]
  ------------------
  372|  2.27k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 1.80k, False: 473]
  ------------------
  373|  1.80k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 718, False: 1.08k]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    718|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    718|                    oh = cur_pages[key];
  378|  1.08k|                } else {
  379|       |                    // It's okay to copy scalars.
  380|  1.08k|                }
  381|  1.80k|            }
  382|  2.27k|            key_ancestors[key].emplace_back(oh);
  383|  2.27k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 182, False: 2.09k]
  ------------------
  384|    182|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  2.27k|            cur_pages.erase(key);
  387|  29.4k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 7.91k, False: 21.4k]
  |  Branch (387:40): [True: 449, False: 21.0k]
  |  Branch (387:60): [True: 7.93k, False: 13.0k]
  |  Branch (387:78): [True: 5.30k, False: 7.79k]
  ------------------
  388|       |            // Warn when flattening, but not if the key is at the top level (i.e. "/Parent" not
  389|       |            // set), as we don't change these; but flattening removes intermediate /Pages nodes.
  390|  7.79k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 7.79k, False: 0]
  |  Branch (390:17): [True: 586, False: 7.21k]
  |  Branch (390:38): [True: 586, False: 7.21k]
  ------------------
  391|    586|                warn(
  392|    586|                    qpdf_e_pages,
  393|    586|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|    586|                    cur_pages.offset(),
  395|    586|                    ("Unknown key " + key +
  396|    586|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|    586|                     "tree"));
  398|    586|            }
  399|  7.79k|        }
  400|  31.6k|    }
  401|       |
  402|       |    // Process descendant nodes. This method does not perform loop detection because all code paths
  403|       |    // that lead here follow a call to getAllPages, which already throws an exception in the event
  404|       |    // of a loop in the pages tree.
  405|  63.7k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 63.7k, False: 7.93k]
  ------------------
  406|  63.7k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 2.01k, False: 61.7k]
  ------------------
  407|  2.01k|            pushInheritedAttributesToPageInternal(
  408|  2.01k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  61.7k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  61.7k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 15.2k, False: 61.7k]
  ------------------
  412|  15.2k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 12.2k, False: 3.00k]
  ------------------
  413|  12.2k|                    kid.replaceKey(key, values.back());
  414|  12.2k|                } else {
  415|  3.00k|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|  3.00k|                }
  417|  15.2k|            }
  418|  61.7k|        }
  419|  63.7k|    }
  420|       |
  421|       |    // For each inheritable key, pop the stack.  If the stack becomes empty, remove it from the map.
  422|       |    // That way, the invariant that the list of keys in key_ancestors is exactly those keys for
  423|       |    // which inheritable attributes are available.
  424|       |
  425|  7.93k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 1.80k, False: 6.13k]
  ------------------
  426|  2.06k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 2.06k, False: 1.80k]
  ------------------
  427|  2.06k|            key_ancestors[key].pop_back();
  428|  2.06k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 1.88k, False: 179]
  ------------------
  429|  1.88k|                key_ancestors.erase(key);
  430|  1.88k|            }
  431|  2.06k|        }
  432|  6.13k|    } else {
  433|  6.13k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  6.13k|    }
  435|  7.93k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  17.4k|{
  440|  17.4k|    QPDFObjGen og(obj.getObjGen());
  441|  17.4k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 17.4k, False: 0]
  ------------------
  442|  17.4k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 17.4k]
  ------------------
  443|       |            // The library never calls insertPageobjToPage in a way that causes this to happen.
  444|      0|            throw QPDFExc(
  445|      0|                qpdf_e_pages,
  446|      0|                m->file->getName(),
  447|      0|                "page " + std::to_string(pos) + " (numbered from zero): object " + og.unparse(' '),
  448|      0|                0,
  449|      0|                "duplicate page reference found; this would cause loss of data");
  450|      0|        }
  451|  17.4k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  17.4k|}
_ZN22QPDFPageDocumentHelperC2ER4QPDF:
  584|  12.8k|    QPDFDocumentHelper(qpdf)
  585|  12.8k|{
  586|  12.8k|}
_ZN22QPDFPageDocumentHelper11getAllPagesEv:
  601|  12.1k|{
  602|  12.1k|    auto& pp = qpdf.doc().pages();
  603|  12.1k|    return {pp.begin(), pp.end()};
  604|  12.1k|}
_ZN22QPDFPageDocumentHelper18flattenAnnotationsEii:
  641|  9.16k|{
  642|  9.16k|    qpdf.doc().pages().flatten_annotations(required_flags, forbidden_flags);
  643|  9.16k|}
_ZN4QPDF3Doc5Pages19flatten_annotationsEii:
  647|  9.16k|{
  648|  9.16k|    auto& afdh = qpdf.doc().acroform();
  649|  9.16k|    if (afdh.getNeedAppearances()) {
  ------------------
  |  Branch (649:9): [True: 0, False: 9.16k]
  ------------------
  650|      0|        qpdf.getRoot()
  651|      0|            .getKey("/AcroForm")
  652|      0|            .warn(
  653|      0|                "document does not have updated appearance streams, so form fields "
  654|      0|                "will not be flattened");
  655|      0|    }
  656|  22.2k|    for (QPDFPageObjectHelper ph: all()) {
  ------------------
  |  Branch (656:33): [True: 22.2k, False: 9.16k]
  ------------------
  657|  22.2k|        QPDFObjectHandle resources = ph.getAttribute("/Resources", true);
  658|  22.2k|        if (!resources.isDictionary()) {
  ------------------
  |  Branch (658:13): [True: 923, False: 21.3k]
  ------------------
  659|       |            // As of #1521, this should be impossible unless a user inserted an invalid page.
  660|    923|            resources = ph.getObjectHandle().replaceKeyAndGetNew("/Resources", Dictionary::empty());
  661|    923|        }
  662|  22.2k|        flatten_annotations_for_page(ph, resources, afdh, required_flags, forbidden_flags);
  663|  22.2k|    }
  664|  9.16k|    if (!afdh.getNeedAppearances()) {
  ------------------
  |  Branch (664:9): [True: 9.13k, False: 31]
  ------------------
  665|  9.13k|        qpdf.getRoot().removeKey("/AcroForm");
  666|  9.13k|    }
  667|  9.16k|}
_ZN4QPDF3Doc5Pages28flatten_annotations_for_pageER20QPDFPageObjectHelperR16QPDFObjectHandleRN4qpdf4impl8AcroFormEii:
  676|  22.2k|{
  677|  22.2k|    bool need_appearances = afdh.getNeedAppearances();
  678|  22.2k|    std::vector<QPDFAnnotationObjectHelper> annots = page.getAnnotations();
  679|  22.2k|    std::vector<QPDFObjectHandle> new_annots;
  680|  22.2k|    std::string new_content;
  681|  22.2k|    int rotate = 0;
  682|  22.2k|    QPDFObjectHandle rotate_obj = page.getObjectHandle().getKey("/Rotate");
  683|  22.2k|    if (rotate_obj.isInteger() && rotate_obj.getIntValue()) {
  ------------------
  |  Branch (683:9): [True: 919, False: 21.3k]
  |  Branch (683:35): [True: 258, False: 661]
  ------------------
  684|    258|        rotate = rotate_obj.getIntValueAsInt();
  685|    258|    }
  686|  22.2k|    int next_fx = 1;
  687|  22.2k|    for (auto& aoh: annots) {
  ------------------
  |  Branch (687:19): [True: 17.3k, False: 22.2k]
  ------------------
  688|  17.3k|        QPDFObjectHandle as = aoh.getAppearanceStream("/N");
  689|  17.3k|        bool is_widget = (aoh.getSubtype() == "/Widget");
  690|  17.3k|        bool process = true;
  691|  17.3k|        if (need_appearances && is_widget) {
  ------------------
  |  Branch (691:13): [True: 0, False: 17.3k]
  |  Branch (691:33): [True: 0, False: 0]
  ------------------
  692|      0|            process = false;
  693|      0|        }
  694|  17.3k|        if (process && as.isStream()) {
  ------------------
  |  Branch (694:13): [True: 17.3k, False: 4]
  |  Branch (694:24): [True: 10.5k, False: 6.81k]
  ------------------
  695|  10.5k|            if (is_widget) {
  ------------------
  |  Branch (695:17): [True: 9.30k, False: 1.24k]
  ------------------
  696|  9.30k|                QPDFFormFieldObjectHelper ff = afdh.getFieldForAnnotation(aoh);
  697|  9.30k|                QPDFObjectHandle as_resources = as.getDict().getKey("/Resources");
  698|  9.30k|                if (as_resources.isIndirect()) {
  ------------------
  |  Branch (698:21): [True: 502, False: 8.79k]
  ------------------
  699|    502|                    ;
  700|    502|                    as.getDict().replaceKey("/Resources", as_resources.shallowCopy());
  701|    502|                    as_resources = as.getDict().getKey("/Resources");
  702|    502|                }
  703|  9.30k|                as_resources.mergeResources(ff.getDefaultResources());
  704|  9.30k|            } else {
  705|  1.24k|                QTC::TC("qpdf", "QPDFPageDocumentHelper non-widget annotation");
  706|  1.24k|            }
  707|  10.5k|            std::string name = resources.getUniqueResourceName("/Fxo", next_fx);
  708|  10.5k|            std::string content =
  709|  10.5k|                aoh.getPageContentForAppearance(name, rotate, required_flags, forbidden_flags);
  710|  10.5k|            if (!content.empty()) {
  ------------------
  |  Branch (710:17): [True: 6.55k, False: 3.99k]
  ------------------
  711|  6.55k|                resources.mergeResources(Dictionary({{"/XObject", Dictionary({{name, as}})}}));
  712|  6.55k|                resources.getKey("/XObject").replaceKey(name, as);
  713|  6.55k|                ++next_fx;
  714|  6.55k|            }
  715|  10.5k|            new_content += content;
  716|  10.5k|        } else if (process && !aoh.getAppearanceDictionary().null()) {
  ------------------
  |  Branch (716:20): [True: 6.81k, False: 4]
  |  Branch (716:20): [True: 1.61k, False: 5.20k]
  |  Branch (716:31): [True: 1.61k, False: 5.19k]
  ------------------
  717|       |            // If an annotation has no selected appearance stream, just drop the annotation when
  718|       |            // flattening. This can happen for unchecked checkboxes and radio buttons, popup windows
  719|       |            // associated with comments that aren't visible, and other types of annotations that
  720|       |            // aren't visible. Annotations that have no appearance streams at all, such as Link,
  721|       |            // Popup, and Projection, should be preserved.
  722|  5.20k|        } else {
  723|  5.20k|            new_annots.push_back(aoh.getObjectHandle());
  724|  5.20k|        }
  725|  17.3k|    }
  726|  22.2k|    if (new_annots.size() != annots.size()) {
  ------------------
  |  Branch (726:9): [True: 3.26k, False: 19.0k]
  ------------------
  727|  3.26k|        QPDFObjectHandle page_oh = page.getObjectHandle();
  728|  3.26k|        if (new_annots.empty()) {
  ------------------
  |  Branch (728:13): [True: 2.78k, False: 487]
  ------------------
  729|  2.78k|            page_oh.removeKey("/Annots");
  730|  2.78k|        } else {
  731|    487|            QPDFObjectHandle old_annots = page_oh.getKey("/Annots");
  732|    487|            QPDFObjectHandle new_annots_oh = QPDFObjectHandle::newArray(new_annots);
  733|    487|            if (old_annots.isIndirect()) {
  ------------------
  |  Branch (733:17): [True: 85, False: 402]
  ------------------
  734|     85|                qpdf.replaceObject(old_annots.getObjGen(), new_annots_oh);
  735|    402|            } else {
  736|    402|                page_oh.replaceKey("/Annots", new_annots_oh);
  737|    402|            }
  738|    487|        }
  739|  3.26k|        page.addPageContents(qpdf.newStream("q\n"), true);
  740|  3.26k|        page.addPageContents(qpdf.newStream("\nQ\n" + new_content), false);
  741|  3.26k|    }
  742|  22.2k|}

_ZN5QUtil18int_to_string_baseExii:
  343|   224k|{
  344|   224k|    return int_to_string_base_internal(num, base, length);
  345|   224k|}
_ZN5QUtil16double_to_stringEdib:
  355|   131k|{
  356|       |    // Backward compatibility -- this code used to use sprintf and treated decimal_places <= 0 to
  357|       |    // mean to use the default, which was six decimal places. Starting in 10.2, we trim trailing
  358|       |    // zeroes by default.
  359|   131k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 91.9k, False: 39.3k]
  ------------------
  360|  91.9k|        decimal_places = 6;
  361|  91.9k|    }
  362|   131k|    std::ostringstream buf;
  363|   131k|    buf.imbue(std::locale::classic());
  364|   131k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|   131k|    std::string result = buf.str();
  366|   131k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 131k, False: 0]
  ------------------
  367|   792k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 792k, False: 0]
  |  Branch (367:41): [True: 660k, False: 131k]
  ------------------
  368|   660k|            result.pop_back();
  369|   660k|        }
  370|   131k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 131k, False: 0]
  |  Branch (370:38): [True: 97.1k, False: 34.0k]
  ------------------
  371|  97.1k|            result.pop_back();
  372|  97.1k|        }
  373|   131k|    }
  374|   131k|    return result;
  375|   131k|}
_ZN5QUtil12string_to_llEPKc:
  379|  4.64M|{
  380|  4.64M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  4.64M|    long long result = strtoll(str, nullptr, 10);
  385|  4.64M|#endif
  386|  4.64M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 1.27k, False: 4.64M]
  ------------------
  387|  1.27k|        throw std::range_error(
  388|  1.27k|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|  1.27k|    }
  390|  4.64M|    return result;
  391|  4.64M|}
_ZN5QUtil13string_to_intEPKc:
  395|   812k|{
  396|       |    // QIntC::to_int does range checking
  397|   812k|    return QIntC::to_int(string_to_ll(str));
  398|   812k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   184k|{
  448|   184k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   184k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.43k|{
  454|  5.43k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.43k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.43k|{
  718|  5.43k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.43k|    result.get()[str.length()] = '\0';
  721|  5.43k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.43k|    return result;
  723|  5.43k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  727|  48.1k|{
  728|  48.1k|    static auto constexpr hexchars = "0123456789abcdef";
  729|  48.1k|    std::string result;
  730|  48.1k|    result.reserve(2 * input.length());
  731|  12.0M|    for (const char c: input) {
  ------------------
  |  Branch (731:22): [True: 12.0M, False: 48.1k]
  ------------------
  732|  12.0M|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  733|  12.0M|        result += hexchars[c & 0x0f];
  734|  12.0M|    }
  735|  48.1k|    return result;
  736|  48.1k|}
_ZN5QUtil7get_envERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPS6_:
  812|      1|{
  813|       |    // This was basically ripped out of wxWindows.
  814|       |#ifdef _WIN32
  815|       |# ifdef NO_GET_ENVIRONMENT
  816|       |    return false;
  817|       |# else
  818|       |    // first get the size of the buffer
  819|       |    DWORD len = ::GetEnvironmentVariable(var.c_str(), NULL, 0);
  820|       |    if (len == 0) {
  821|       |        // this means that there is no such variable
  822|       |        return false;
  823|       |    }
  824|       |
  825|       |    if (value) {
  826|       |        auto t = QUtil::make_shared_array<char>(len + 1);
  827|       |        ::GetEnvironmentVariable(var.c_str(), t.get(), len);
  828|       |        *value = t.get();
  829|       |    }
  830|       |
  831|       |    return true;
  832|       |# endif
  833|       |#else
  834|      1|    char* p = getenv(var.c_str());
  835|      1|    if (p == nullptr) {
  ------------------
  |  Branch (835:9): [True: 1, False: 0]
  ------------------
  836|      1|        return false;
  837|      1|    }
  838|      0|    if (value) {
  ------------------
  |  Branch (838:9): [True: 0, False: 0]
  ------------------
  839|      0|        *value = p;
  840|      0|    }
  841|       |
  842|      0|    return true;
  843|      1|#endif
  844|      1|}
_ZN5QUtil6toUTF8Em:
 1004|   338M|{
 1005|   338M|    std::string result;
 1006|       |
 1007|       |    // A UTF-8 encoding of a Unicode value is a single byte for Unicode values <= 127.  For larger
 1008|       |    // values, the first byte of the UTF-8 encoding has '1' as each of its n highest bits and '0'
 1009|       |    // for its (n+1)th highest bit where n is the total number of bytes required.  Subsequent bytes
 1010|       |    // start with '10' and have the remaining 6 bits free for encoding.  For example, an 11-bit
 1011|       |    // Unicode value can be stored in two bytes where the first is 110zzzzz, the second is 10zzzzzz,
 1012|       |    // and the z's represent the remaining bits.
 1013|       |
 1014|   338M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 338M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   338M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 153M, False: 184M]
  ------------------
 1017|   153M|        result += static_cast<char>(uval);
 1018|   184M|    } else {
 1019|   184M|        unsigned char bytes[7];
 1020|   184M|        bytes[6] = '\0';
 1021|   184M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   184M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   496M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 312M, False: 184M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   312M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   312M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   312M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   312M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 312M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   312M|            --cur_byte;
 1037|   312M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   184M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   184M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   184M|    }
 1043|       |
 1044|   338M|    return result;
 1045|   338M|}
_ZN5QUtil7toUTF16Em:
 1049|   680k|{
 1050|   680k|    std::string result;
 1051|   680k|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 11.8k, False: 668k]
  |  Branch (1051:29): [True: 568, False: 11.2k]
  ------------------
 1052|    568|        result = "\xff\xfd";
 1053|   680k|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 678k, False: 1.08k]
  ------------------
 1054|   678k|        char out[2];
 1055|   678k|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|   678k|        out[1] = static_cast<char>(uval & 0xff);
 1057|   678k|        result = std::string(out, 2);
 1058|   678k|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 481, False: 606]
  ------------------
 1059|    481|        char out[4];
 1060|    481|        uval -= 0x10000;
 1061|    481|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|    481|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|    481|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|    481|        out[1] = static_cast<char>(high & 0xff);
 1065|    481|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|    481|        out[3] = static_cast<char>(low & 0xff);
 1067|    481|        result = std::string(out, 4);
 1068|    606|    } else {
 1069|    606|        result = "\xff\xfd";
 1070|    606|    }
 1071|       |
 1072|   680k|    return result;
 1073|   680k|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    490|{
 1127|    490|    return getRandomDataProviderProvider()->getProvider();
 1128|    490|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    490|{
 1133|    490|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    490|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  52.0M|{
 1480|  52.0M|    auto o_pos = pos;
 1481|  52.0M|    size_t len = utf8_val.length();
 1482|  52.0M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  52.0M|    error = false;
 1484|  52.0M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 19.1M, False: 32.9M]
  ------------------
 1485|  19.1M|        return static_cast<unsigned long>(ch);
 1486|  19.1M|    }
 1487|       |
 1488|  32.9M|    size_t bytes_needed = 0;
 1489|  32.9M|    unsigned bit_check = 0x40;
 1490|  32.9M|    unsigned char to_clear = 0x80;
 1491|  80.4M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 47.5M, False: 32.9M]
  ------------------
 1492|  47.5M|        ++bytes_needed;
 1493|  47.5M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  47.5M|        bit_check >>= 1;
 1495|  47.5M|    }
 1496|  32.9M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 66.3k, False: 32.8M]
  |  Branch (1496:32): [True: 3.65M, False: 29.1M]
  |  Branch (1496:55): [True: 124, False: 29.1M]
  ------------------
 1497|  3.72M|        error = true;
 1498|  3.72M|        return 0xfffd;
 1499|  3.72M|    }
 1500|       |
 1501|  29.1M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  64.1M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 44.9M, False: 19.2M]
  ------------------
 1503|  44.9M|        --bytes_needed;
 1504|  44.9M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  44.9M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 9.96M, False: 34.9M]
  ------------------
 1506|  9.96M|            --pos;
 1507|  9.96M|            error = true;
 1508|  9.96M|            return 0xfffd;
 1509|  9.96M|        }
 1510|  34.9M|        codepoint <<= 6;
 1511|  34.9M|        codepoint += (ch & 0x3f);
 1512|  34.9M|    }
 1513|  19.2M|    unsigned long lower_bound = 0;
 1514|  19.2M|    switch (pos - o_pos) {
 1515|  3.52M|    case 2:
  ------------------
  |  Branch (1515:5): [True: 3.52M, False: 15.7M]
  ------------------
 1516|  3.52M|        lower_bound = 1 << 7;
 1517|  3.52M|        break;
 1518|  15.7M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 15.7M, False: 3.53M]
  ------------------
 1519|  15.7M|        lower_bound = 1 << 11;
 1520|  15.7M|        break;
 1521|  1.14k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 1.14k, False: 19.2M]
  ------------------
 1522|  1.14k|        lower_bound = 1 << 16;
 1523|  1.14k|        break;
 1524|  1.11k|    case 5:
  ------------------
  |  Branch (1524:5): [True: 1.11k, False: 19.2M]
  ------------------
 1525|  1.11k|        lower_bound = 1 << 12;
 1526|  1.11k|        break;
 1527|    456|    case 6:
  ------------------
  |  Branch (1527:5): [True: 456, False: 19.2M]
  ------------------
 1528|    456|        lower_bound = 1 << 26;
 1529|    456|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 19.2M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  19.2M|    }
 1533|       |
 1534|  19.2M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 19.2M, False: 0]
  |  Branch (1534:28): [True: 318, False: 19.2M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|    318|        error = true;
 1537|    318|    }
 1538|  19.2M|    return codepoint;
 1539|  19.2M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    580|{
 1638|    580|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    580|}
_ZN5QUtil13utf8_to_asciiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1643|  27.9k|{
 1644|  27.9k|    return transcode_utf8(utf8, e_ascii, unknown_char);
 1645|  27.9k|}
_ZN5QUtil16utf8_to_win_ansiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1649|    412|{
 1650|    412|    return transcode_utf8(utf8, e_winansi, unknown_char);
 1651|    412|}
_ZN5QUtil17utf8_to_mac_romanERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1655|     52|{
 1656|     52|    return transcode_utf8(utf8, e_macroman, unknown_char);
 1657|     52|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  59.1k|{
 1686|  59.1k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  59.1k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  43.8k|{
 1692|  43.8k|    return util::is_utf16(val);
 1693|  43.8k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  43.8k|{
 1704|  43.8k|    std::string result;
 1705|       |    // This code uses unsigned long and unsigned short to hold codepoint values. It requires
 1706|       |    // unsigned long to be at least 32 bits and unsigned short to be at least 16 bits, but it will
 1707|       |    // work fine if they are larger.
 1708|  43.8k|    unsigned long codepoint = 0L;
 1709|  43.8k|    size_t len = val.length();
 1710|  43.8k|    size_t start = 0;
 1711|  43.8k|    bool is_le = false;
 1712|  43.8k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 43.8k, False: 0]
  ------------------
 1713|  43.8k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 2.14k, False: 41.7k]
  ------------------
 1714|  2.14k|            is_le = true;
 1715|  2.14k|        }
 1716|  43.8k|        start += 2;
 1717|  43.8k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  56.2M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 56.2M, False: 43.8k]
  ------------------
 1720|       |        // Convert from UTF16-BE.  If we get a malformed codepoint, this code will generate
 1721|       |        // incorrect output without giving a warning.  Specifically, a high codepoint not followed
 1722|       |        // by a low codepoint will be discarded, and a low codepoint not preceded by a high
 1723|       |        // codepoint will just get its low 10 bits output.
 1724|  56.2M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 325k, False: 55.9M]
  ------------------
 1725|  56.2M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 325k, False: 55.9M]
  ------------------
 1726|  56.2M|        unsigned short bits = QIntC::to_ushort(
 1727|  56.2M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  56.2M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  56.2M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 4.84k, False: 56.2M]
  ------------------
 1730|  4.84k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  4.84k|            continue;
 1732|  56.2M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 2.77k, False: 56.2M]
  ------------------
 1733|  2.77k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 615, False: 2.15k]
  ------------------
 1734|    615|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|    615|            }
 1736|  2.77k|            codepoint += bits & 0x3FF;
 1737|  56.2M|        } else {
 1738|  56.2M|            codepoint = bits;
 1739|  56.2M|        }
 1740|       |
 1741|  56.2M|        result += QUtil::toUTF8(codepoint);
 1742|  56.2M|        codepoint = 0;
 1743|  56.2M|    }
 1744|  43.8k|    return result;
 1745|  43.8k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   489k|{
 1782|   489k|    std::string result;
 1783|   489k|    size_t len = val.length();
 1784|   258M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 257M, False: 489k]
  ------------------
 1785|   257M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   257M|        unsigned short ch_short = ch;
 1787|   257M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 127M, False: 129M]
  |  Branch (1787:28): [True: 72.9M, False: 54.9M]
  ------------------
 1788|  72.9M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   184M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 151M, False: 33.4M]
  |  Branch (1789:34): [True: 880k, False: 150M]
  ------------------
 1790|   880k|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|   184M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 118k, False: 183M]
  ------------------
 1792|   118k|            ch_short = 0xfffd;
 1793|   118k|        }
 1794|   257M|        result += QUtil::toUTF8(ch_short);
 1795|   257M|    }
 1796|   489k|    return result;
 1797|   489k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    490|{
 1113|       |    // Thread-safe static initializer
 1114|    490|    static RandomDataProviderProvider rdpp;
 1115|    490|    return &rdpp;
 1116|    490|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProviderC2Ev:
 1093|      1|    default_provider(CryptoRandomDataProvider::getInstance())
 1094|      1|{
 1095|      1|    this->current_provider = default_provider;
 1096|      1|}
QUtil.cc:_ZN12_GLOBAL__N_126RandomDataProviderProvider11getProviderEv:
 1100|    490|{
 1101|    490|    return this->current_provider;
 1102|    490|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|  29.0k|{
 1630|  29.0k|    std::string result;
 1631|  29.0k|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|  29.0k|    return result;
 1633|  29.0k|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  88.2k|{
 1544|  88.2k|    bool okay = true;
 1545|  88.2k|    result.clear();
 1546|  88.2k|    size_t len = utf8_val.length();
 1547|  88.2k|    switch (encoding) {
 1548|    580|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 580, False: 87.6k]
  ------------------
 1549|    580|        result += "\xfe\xff";
 1550|    580|        break;
 1551|  59.1k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 59.1k, False: 29.0k]
  ------------------
 1552|       |        // We need to avoid having the result start with something that will be interpreted as
 1553|       |        // UTF-16 or UTF-8, meaning we can't end up with a string that starts with "fe ff",
 1554|       |        // (UTF-16-BE) "ff fe" (UTF-16-LE, not officially part of the PDF spec, but recognized by
 1555|       |        // most readers including qpdf), or "ef bb bf" (UTF-8). It's more efficient to check the
 1556|       |        // input string to see if it will map to one of those sequences than to check the output
 1557|       |        // string since all cases start with the same starting character.
 1558|  59.1k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 21.9k, False: 37.2k]
  |  Branch (1558:27): [True: 1.06k, False: 20.9k]
  ------------------
 1559|  1.06k|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|  1.06k|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|  1.06k|            static std::string ef_bb_bf("\xaf\xc2\xbb\xc2\xbf");
 1562|       |            // C++-20 has starts_with, but when this was written, qpdf had a minimum supported
 1563|       |            // version of C++-17.
 1564|  1.06k|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 0, False: 1.06k]
  |  Branch (1564:57): [True: 0, False: 1.06k]
  ------------------
 1565|  1.06k|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 0, False: 1.06k]
  ------------------
 1566|      0|                result += unknown;
 1567|      0|                okay = false;
 1568|      0|            }
 1569|  1.06k|        }
 1570|  59.1k|        break;
 1571|  28.4k|    default:
  ------------------
  |  Branch (1571:5): [True: 28.4k, False: 59.7k]
  ------------------
 1572|  28.4k|        break;
 1573|  88.2k|    }
 1574|  88.2k|    size_t pos = 0;
 1575|  52.1M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 52.0M, False: 88.2k]
  ------------------
 1576|  52.0M|        bool error = false;
 1577|  52.0M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  52.0M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 13.6M, False: 38.3M]
  ------------------
 1579|  13.6M|            okay = false;
 1580|  13.6M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 6.09M, False: 7.59M]
  ------------------
 1581|  6.09M|                result += "\xff\xfd";
 1582|  7.59M|            } else {
 1583|  7.59M|                result.append(1, unknown);
 1584|  7.59M|            }
 1585|  38.3M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 19.1M, False: 19.2M]
  ------------------
 1586|  19.1M|            char ch = static_cast<char>(codepoint);
 1587|  19.1M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 462k, False: 18.6M]
  ------------------
 1588|   462k|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  18.6M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 14.6M, False: 4.00M]
  |  Branch (1589:52): [True: 6.42M, False: 8.24M]
  |  Branch (1589:68): [True: 2.43k, False: 6.42M]
  |  Branch (1589:85): [True: 2.23k, False: 14.6M]
  ------------------
 1590|       |                // PDFDocEncoding maps some low characters to Unicode, so if we encounter those
 1591|       |                // invalid UTF-8 code points, map them to unknown so reversing the mapping doesn't
 1592|       |                // change them into other characters.
 1593|  4.66k|                okay = false;
 1594|  4.66k|                result.append(1, unknown);
 1595|  18.6M|            } else {
 1596|  18.6M|                result.append(1, ch);
 1597|  18.6M|            }
 1598|  19.2M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 217k, False: 19.0M]
  ------------------
 1599|   217k|            result += QUtil::toUTF16(codepoint);
 1600|  19.0M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 445, False: 19.0M]
  |  Branch (1600:43): [True: 196, False: 249]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|    196|            okay = false;
 1603|    196|            result.append(1, unknown);
 1604|  19.0M|        } else if (
 1605|  19.0M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 19.0M, False: 211]
  |  Branch (1605:34): [True: 3.41M, False: 15.5M]
  ------------------
 1606|  3.41M|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 588, False: 3.41M]
  |  Branch (1606:41): [True: 191k, False: 3.22M]
  ------------------
 1607|   192k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  18.8M|        } else {
 1609|  18.8M|            unsigned char ch = '\0';
 1610|  18.8M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 1.62k, False: 18.8M]
  ------------------
 1611|  1.62k|                ch = encode_winansi(codepoint);
 1612|  18.8M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 966, False: 18.8M]
  ------------------
 1613|    966|                ch = encode_macroman(codepoint);
 1614|  18.8M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 4.68M, False: 14.1M]
  ------------------
 1615|  4.68M|                ch = encode_pdfdoc(codepoint);
 1616|  4.68M|            }
 1617|  18.8M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 14.3M, False: 4.48M]
  ------------------
 1618|  14.3M|                okay = false;
 1619|  14.3M|                ch = static_cast<unsigned char>(unknown);
 1620|  14.3M|            }
 1621|  18.8M|            result.append(1, static_cast<char>(ch));
 1622|  18.8M|        }
 1623|  52.0M|    }
 1624|  88.2k|    return okay;
 1625|  88.2k|}
QUtil.cc:_ZL14encode_winansim:
 1449|  1.62k|{
 1450|  1.62k|    auto i = unicode_to_win_ansi.find(codepoint);
 1451|  1.62k|    if (i != unicode_to_win_ansi.end()) {
  ------------------
  |  Branch (1451:9): [True: 489, False: 1.13k]
  ------------------
 1452|    489|        return i->second;
 1453|    489|    }
 1454|  1.13k|    return '\0';
 1455|  1.62k|}
QUtil.cc:_ZL15encode_macromanm:
 1459|    966|{
 1460|    966|    auto i = unicode_to_mac_roman.find(codepoint);
 1461|    966|    if (i != unicode_to_mac_roman.end()) {
  ------------------
  |  Branch (1461:9): [True: 284, False: 682]
  ------------------
 1462|    284|        return i->second;
 1463|    284|    }
 1464|    682|    return '\0';
 1465|    966|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  4.68M|{
 1470|  4.68M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  4.68M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 4.48M, False: 203k]
  ------------------
 1472|  4.48M|        return i->second;
 1473|  4.48M|    }
 1474|   203k|    return '\0';
 1475|  4.68M|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  300|   224k|{
  301|       |    // Backward compatibility -- int_to_string, which calls this function, used to use sprintf with
  302|       |    // %0*d, so we interpret length such that a negative value appends spaces and a positive value
  303|       |    // prepends zeroes.
  304|   224k|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (304:11): [True: 224k, False: 0]
  |  Branch (304:26): [True: 0, False: 0]
  |  Branch (304:42): [True: 0, False: 0]
  ------------------
  305|      0|        throw std::logic_error("int_to_string_base called with unsupported base");
  306|      0|    }
  307|   224k|    std::string cvt;
  308|   224k|    if (base == 10) {
  ------------------
  |  Branch (308:9): [True: 0, False: 224k]
  ------------------
  309|       |        // Use the more efficient std::to_string when possible
  310|      0|        cvt = std::to_string(num);
  311|   224k|    } else {
  312|   224k|        std::ostringstream buf;
  313|   224k|        buf.imbue(std::locale::classic());
  314|   224k|        buf << std::setbase(base) << std::nouppercase << num;
  315|   224k|        cvt = buf.str();
  316|   224k|    }
  317|   224k|    std::string result;
  318|   224k|    int str_length = QIntC::to_int(cvt.length());
  319|   224k|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (319:9): [True: 224k, False: 0]
  |  Branch (319:25): [True: 74.4k, False: 149k]
  ------------------
  320|  74.4k|        result.append(QIntC::to_size(length - str_length), '0');
  321|  74.4k|    }
  322|   224k|    result += cvt;
  323|   224k|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (323:9): [True: 0, False: 224k]
  |  Branch (323:25): [True: 0, False: 0]
  ------------------
  324|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  325|      0|    }
  326|   224k|    return result;
  327|   224k|}

_ZN3RC4C2EPKhi:
    6|  32.2k|    crypto(QPDFCryptoProvider::getImpl())
    7|  32.2k|{
    8|  32.2k|    crypto->RC4_init(key_data, key_len);
    9|  32.2k|}
_ZN3RC47processEPKhmPh:
   13|  31.8k|{
   14|  31.8k|    crypto->RC4_process(in_data, len, out_data);
   15|  31.8k|}
_ZN3RC47processENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERNS0_12basic_stringIcS3_NS0_9allocatorIcEEEE:
   19|  25.0k|{
   20|  25.0k|    RC4 rc4(reinterpret_cast<unsigned char const*>(key.data()), static_cast<int>(key.size()));
   21|  25.0k|    rc4.process(
   22|  25.0k|        reinterpret_cast<unsigned char const*>(data.data()),
   23|  25.0k|        data.size(),
   24|  25.0k|        reinterpret_cast<unsigned char*>(data.data()));
   25|  25.0k|}

_ZN10RC4_nativeC2EPKhi:
   18|  32.2k|{
   19|  32.2k|    if (key_len == -1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 32.2k]
  ------------------
   20|      0|        key_len = QIntC::to_int(strlen(reinterpret_cast<char const*>(key_data)));
   21|      0|    }
   22|       |
   23|  8.27M|    for (int i = 0; i < 256; ++i) {
  ------------------
  |  Branch (23:21): [True: 8.24M, False: 32.2k]
  ------------------
   24|  8.24M|        key.state[i] = static_cast<unsigned char>(i);
   25|  8.24M|    }
   26|  32.2k|    key.x = 0;
   27|  32.2k|    key.y = 0;
   28|       |
   29|  32.2k|    int i1 = 0;
   30|  32.2k|    int i2 = 0;
   31|  8.27M|    for (int i = 0; i < 256; ++i) {
  ------------------
  |  Branch (31:21): [True: 8.24M, False: 32.2k]
  ------------------
   32|  8.24M|        i2 = (key_data[i1] + key.state[i] + i2) % 256;
   33|  8.24M|        swap_byte(key.state[i], key.state[i2]);
   34|  8.24M|        i1 = (i1 + 1) % key_len;
   35|  8.24M|    }
   36|  32.2k|}
_ZN10RC4_native7processEPKhmPh:
   40|  31.8k|{
   41|  27.4M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (41:24): [True: 27.3M, False: 31.8k]
  ------------------
   42|  27.3M|        key.x = static_cast<unsigned char>((key.x + 1) % 256);
   43|  27.3M|        key.y = static_cast<unsigned char>((key.state[key.x] + key.y) % 256);
   44|  27.3M|        swap_byte(key.state[key.x], key.state[key.y]);
   45|  27.3M|        int xor_index = (key.state[key.x] + key.state[key.y]) % 256;
   46|  27.3M|        out_data[i] = in_data[i] ^ key.state[xor_index];
   47|  27.3M|    }
   48|  31.8k|}
RC4_native.cc:_ZL9swap_byteRhS_:
    9|  35.6M|{
   10|  35.6M|    unsigned char t;
   11|       |
   12|  35.6M|    t = a;
   13|  35.6M|    a = b;
   14|  35.6M|    b = t;
   15|  35.6M|}

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  27.3k|{
   14|  27.3k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 21.6k, False: 5.64k]
  ------------------
   15|  21.6k|        return true;
   16|  21.6k|    }
   17|       |
   18|  5.64k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  5.64k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  11.7k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 11.7k, False: 5.49k]
  ------------------
   22|  11.7k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  11.7k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 3.37k, False: 8.37k]
  ------------------
   24|  3.37k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 3.36k, False: 13]
  ------------------
   25|  3.36k|                predictor = value.getIntValueAsInt();
   26|  3.36k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 195, False: 3.17k]
  |  Branch (26:41): [True: 1.13k, False: 2.03k]
  |  Branch (26:60): [True: 1.99k, False: 41]
  |  Branch (26:79): [True: 1.97k, False: 17]
  ------------------
   27|     58|                    return false;
   28|     58|                }
   29|  3.36k|            } else {
   30|     13|                return false;
   31|     13|            }
   32|  8.37k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.76k, False: 6.61k]
  |  Branch (32:41): [True: 392, False: 6.22k]
  |  Branch (32:61): [True: 500, False: 5.72k]
  ------------------
   33|  2.65k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.64k, False: 10]
  ------------------
   34|  2.64k|                int val = value.getIntValueAsInt();
   35|  2.64k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.64k, False: 1]
  |  Branch (35:37): [True: 21, False: 2.62k]
  ------------------
   36|     21|                    QPDFLogger::defaultLogger()->warn(
   37|     21|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     21|                    return false;
   39|     21|                }
   40|  2.62k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.73k, False: 891]
  ------------------
   41|  1.73k|                    columns = val;
   42|  1.73k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 391, False: 500]
  ------------------
   43|    391|                    colors = val;
   44|    500|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 499, False: 1]
  ------------------
   45|    499|                    bits_per_component = val;
   46|    499|                }
   47|  2.62k|            } else {
   48|     10|                return false;
   49|     10|            }
   50|  5.72k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 3.98k, False: 1.74k]
  |  Branch (50:27): [True: 184, False: 3.79k]
  ------------------
   51|    184|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 181, False: 3]
  ------------------
   52|    181|                int earlychange = value.getIntValueAsInt();
   53|    181|                early_code_change = (earlychange == 1);
   54|    181|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 66, False: 115]
  |  Branch (54:43): [True: 66, False: 49]
  ------------------
   55|     49|                    return false;
   56|     49|                }
   57|    181|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    184|        }
   61|  11.7k|    }
   62|       |
   63|  5.49k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 3.11k, False: 2.38k]
  |  Branch (63:26): [True: 3, False: 3.10k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  5.48k|    return true;
   68|  5.49k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  27.1k|{
   73|  27.1k|    std::unique_ptr<Pipeline> pipeline;
   74|  27.1k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.96k, False: 25.1k]
  |  Branch (74:28): [True: 1.96k, False: 0]
  ------------------
   75|  1.96k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.96k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.96k|            "png decode",
   78|  1.96k|            next,
   79|  1.96k|            Pl_PNGFilter::a_decode,
   80|  1.96k|            QIntC::to_uint(columns),
   81|  1.96k|            QIntC::to_uint(colors),
   82|  1.96k|            QIntC::to_uint(bits_per_component));
   83|  1.96k|        next = pipeline.get();
   84|  1.96k|        pipelines.push_back(std::move(pipeline));
   85|  25.1k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 1.13k, False: 24.0k]
  ------------------
   86|  1.13k|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|  1.13k|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|  1.13k|            "tiff decode",
   89|  1.13k|            next,
   90|  1.13k|            Pl_TIFFPredictor::a_decode,
   91|  1.13k|            QIntC::to_uint(columns),
   92|  1.13k|            QIntC::to_uint(colors),
   93|  1.13k|            QIntC::to_uint(bits_per_component));
   94|  1.13k|        next = pipeline.get();
   95|  1.13k|        pipelines.push_back(std::move(pipeline));
   96|  1.13k|    }
   97|       |
   98|  27.1k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 4.16k, False: 22.9k]
  ------------------
   99|  4.16k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  22.9k|    } else {
  101|  22.9k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  22.9k|    }
  103|  27.1k|    next = pipeline.get();
  104|  27.1k|    pipelines.push_back(std::move(pipeline));
  105|  27.1k|    return next;
  106|  27.1k|}

_ZN11SHA2_nativeC2Ei:
    8|   181k|    bits(bits)
    9|   181k|{
   10|   181k|    switch (bits) {
   11|  63.9k|    case 256:
  ------------------
  |  Branch (11:5): [True: 63.9k, False: 117k]
  ------------------
   12|  63.9k|        sph_sha256_init(&ctx256);
   13|  63.9k|        break;
   14|  58.8k|    case 384:
  ------------------
  |  Branch (14:5): [True: 58.8k, False: 123k]
  ------------------
   15|  58.8k|        sph_sha384_init(&ctx384);
   16|  58.8k|        break;
   17|  59.1k|    case 512:
  ------------------
  |  Branch (17:5): [True: 59.1k, False: 122k]
  ------------------
   18|  59.1k|        sph_sha512_init(&ctx512);
   19|  59.1k|        break;
   20|      0|    default:
  ------------------
  |  Branch (20:5): [True: 0, False: 181k]
  ------------------
   21|      0|        badBits();
   22|      0|        break;
   23|   181k|    }
   24|   181k|}
_ZN11SHA2_native6updateEPKhm:
   34|   183k|{
   35|   183k|    switch (bits) {
   36|  65.4k|    case 256:
  ------------------
  |  Branch (36:5): [True: 65.4k, False: 117k]
  ------------------
   37|  65.4k|        sph_sha256(&ctx256, buf, len);
  ------------------
  |  |  169|  65.4k|#define sph_sha256   sph_sha224
  ------------------
   38|  65.4k|        break;
   39|  58.8k|    case 384:
  ------------------
  |  Branch (39:5): [True: 58.8k, False: 124k]
  ------------------
   40|  58.8k|        sph_sha384(&ctx384, buf, len);
   41|  58.8k|        break;
   42|  59.1k|    case 512:
  ------------------
  |  Branch (42:5): [True: 59.1k, False: 124k]
  ------------------
   43|  59.1k|        sph_sha512(&ctx512, buf, len);
  ------------------
  |  |  329|  59.1k|#define sph_sha512   sph_sha384
  ------------------
   44|  59.1k|        break;
   45|      0|    default:
  ------------------
  |  Branch (45:5): [True: 0, False: 183k]
  ------------------
   46|      0|        badBits();
   47|      0|        break;
   48|   183k|    }
   49|   183k|}
_ZN11SHA2_native8finalizeEv:
   53|   181k|{
   54|   181k|    switch (bits) {
   55|  63.9k|    case 256:
  ------------------
  |  Branch (55:5): [True: 63.9k, False: 117k]
  ------------------
   56|  63.9k|        sph_sha256_close(&ctx256, sha256sum);
   57|  63.9k|        break;
   58|  58.8k|    case 384:
  ------------------
  |  Branch (58:5): [True: 58.8k, False: 123k]
  ------------------
   59|  58.8k|        sph_sha384_close(&ctx384, sha384sum);
   60|  58.8k|        break;
   61|  59.1k|    case 512:
  ------------------
  |  Branch (61:5): [True: 59.1k, False: 122k]
  ------------------
   62|  59.1k|        sph_sha512_close(&ctx512, sha512sum);
   63|  59.1k|        break;
   64|      0|    default:
  ------------------
  |  Branch (64:5): [True: 0, False: 181k]
  ------------------
   65|      0|        badBits();
   66|      0|        break;
   67|   181k|    }
   68|   181k|}
_ZN11SHA2_native12getRawDigestEv:
   72|   181k|{
   73|   181k|    std::string result;
   74|   181k|    switch (bits) {
   75|  63.9k|    case 256:
  ------------------
  |  Branch (75:5): [True: 63.9k, False: 117k]
  ------------------
   76|  63.9k|        result = std::string(reinterpret_cast<char*>(sha256sum), sizeof(sha256sum));
   77|  63.9k|        break;
   78|  58.8k|    case 384:
  ------------------
  |  Branch (78:5): [True: 58.8k, False: 123k]
  ------------------
   79|  58.8k|        result = std::string(reinterpret_cast<char*>(sha384sum), sizeof(sha384sum));
   80|  58.8k|        break;
   81|  59.1k|    case 512:
  ------------------
  |  Branch (81:5): [True: 59.1k, False: 122k]
  ------------------
   82|  59.1k|        result = std::string(reinterpret_cast<char*>(sha512sum), sizeof(sha512sum));
   83|  59.1k|        break;
   84|      0|    default:
  ------------------
  |  Branch (84:5): [True: 0, False: 181k]
  ------------------
   85|      0|        badBits();
   86|      0|        break;
   87|   181k|    }
   88|   181k|    return result;
   89|   181k|}

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   81|    490|{
   82|       |# if defined(_WIN32)
   83|       |
   84|       |    // Optimization: make the WindowsCryptProvider static as long as
   85|       |    // it can be done in a thread-safe fashion.
   86|       |    WindowsCryptProvider c;
   87|       |    if (!CryptGenRandom(c.crypt_prov, static_cast<DWORD>(len), reinterpret_cast<BYTE*>(data))) {
   88|       |        throw std::runtime_error("unable to generate secure random data");
   89|       |    }
   90|       |
   91|       |# else
   92|    490|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|    490|        FILE* f = fopen("/dev/urandom", "rb");
   94|    490|        if (f == nullptr) {
   95|    490|            f = fopen("/dev/arandom", "rb");
   96|    490|        }
   97|    490|        if (f == nullptr) {
   98|    490|            f = fopen("/dev/random", "rb");
   99|    490|        }
  100|    490|        if (f == nullptr) {
  101|    490|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|    490|        }
  103|    490|        return std::make_unique<QUtil::FileCloser>(f);
  104|    490|    }();
  105|       |
  106|    490|    size_t fr = fread(data, 1, len, random_device->f);
  107|    490|    if (fr != len) {
  ------------------
  |  Branch (107:9): [True: 0, False: 490]
  ------------------
  108|      0|        throw std::runtime_error(
  109|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  110|      0|    }
  111|       |
  112|    490|# endif
  113|    490|}
_ZN24SecureRandomDataProvider11getInstanceEv:
  117|      1|{
  118|      1|    static SecureRandomDataProvider instance;
  119|      1|    return &instance;
  120|      1|}
SecureRandomDataProvider.cc:_ZZN24SecureRandomDataProvider17provideRandomDataEPhmENK3$_0clEv:
   92|      1|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|      1|        FILE* f = fopen("/dev/urandom", "rb");
   94|      1|        if (f == nullptr) {
  ------------------
  |  Branch (94:13): [True: 0, False: 1]
  ------------------
   95|      0|            f = fopen("/dev/arandom", "rb");
   96|      0|        }
   97|      1|        if (f == nullptr) {
  ------------------
  |  Branch (97:13): [True: 0, False: 1]
  ------------------
   98|      0|            f = fopen("/dev/random", "rb");
   99|      0|        }
  100|      1|        if (f == nullptr) {
  ------------------
  |  Branch (100:13): [True: 0, False: 1]
  ------------------
  101|      0|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|      0|        }
  103|      1|        return std::make_unique<QUtil::FileCloser>(f);
  104|      1|    }();

_ZN4qpdf6global7Options9fuzz_modeEb:
   13|  25.9k|{
   14|  25.9k|    if (value) {
  ------------------
  |  Branch (14:9): [True: 25.9k, False: 0]
  ------------------
   15|  25.9k|        o.fuzz_mode_ = true;
   16|       |        // Limit the memory used to decompress JPEG files during fuzzing. Excessive memory use
   17|       |        // during fuzzing is due to corrupt JPEG data which sometimes cannot be detected before
   18|       |        // jpeg_start_decompress is called. During normal use of qpdf very large JPEGs can
   19|       |        // occasionally occur legitimately and therefore must be allowed during normal operations.
   20|  25.9k|        Limits::dct_max_memory(10'000'000);
   21|  25.9k|        Limits::dct_max_progressive_scans(50);
   22|       |        // Do not decompress corrupt data. This may cause extended runtime within jpeglib without
   23|       |        // exercising additional code paths in qpdf.
   24|  25.9k|        dct_throw_on_corrupt_data(true);
   25|  25.9k|        Limits::png_max_memory(1'000'000);
   26|  25.9k|        Limits::flate_max_memory(200'000);
   27|  25.9k|        Limits::run_length_max_memory(1'000'000);
   28|  25.9k|        Limits::tiff_max_memory(1'000'000);
   29|       |        // Set a reasonable default maximum warnings per document for fuzzing to avoid time-outs due
   30|       |        // to extensive recovery efforts.
   31|  25.9k|        Limits::doc_max_warnings(200);
   32|  25.9k|    }
   33|  25.9k|}
qpdf_global_set_uint32:
  129|  25.9k|{
  130|  25.9k|    switch (param) {
  131|      0|    case qpdf_p_inspection_mode:
  ------------------
  |  Branch (131:5): [True: 0, False: 25.9k]
  ------------------
  132|      0|        Options::inspection_mode(value);
  133|      0|        return qpdf_r_ok;
  134|  25.9k|    case qpdf_p_fuzz_mode:
  ------------------
  |  Branch (134:5): [True: 25.9k, False: 0]
  ------------------
  135|  25.9k|        Options::fuzz_mode(value);
  136|  25.9k|        return qpdf_r_ok;
  137|      0|    case qpdf_p_default_limits:
  ------------------
  |  Branch (137:5): [True: 0, False: 25.9k]
  ------------------
  138|      0|        Options::default_limits(value);
  139|      0|        return qpdf_r_ok;
  140|      0|    case qpdf_p_dct_throw_on_corrupt_data:
  ------------------
  |  Branch (140:5): [True: 0, False: 25.9k]
  ------------------
  141|      0|        Options::dct_throw_on_corrupt_data(value);
  142|      0|        return qpdf_r_ok;
  143|      0|    case qpdf_p_doc_max_warnings:
  ------------------
  |  Branch (143:5): [True: 0, False: 25.9k]
  ------------------
  144|      0|        Limits::doc_max_warnings(value);
  145|      0|        return qpdf_r_ok;
  146|      0|    case qpdf_p_parser_max_nesting:
  ------------------
  |  Branch (146:5): [True: 0, False: 25.9k]
  ------------------
  147|      0|        Limits::parser_max_nesting(value);
  148|      0|        return qpdf_r_ok;
  149|      0|    case qpdf_p_parser_max_errors:
  ------------------
  |  Branch (149:5): [True: 0, False: 25.9k]
  ------------------
  150|      0|        Limits::parser_max_errors(value);
  151|      0|        return qpdf_r_ok;
  152|      0|    case qpdf_p_parser_max_container_size:
  ------------------
  |  Branch (152:5): [True: 0, False: 25.9k]
  ------------------
  153|      0|        Limits::parser_max_container_size(false, value);
  154|      0|        return qpdf_r_ok;
  155|      0|    case qpdf_p_parser_max_container_size_damaged:
  ------------------
  |  Branch (155:5): [True: 0, False: 25.9k]
  ------------------
  156|      0|        Limits::parser_max_container_size(true, value);
  157|      0|        return qpdf_r_ok;
  158|      0|    case qpdf_p_max_stream_filters:
  ------------------
  |  Branch (158:5): [True: 0, False: 25.9k]
  ------------------
  159|      0|        Limits::max_stream_filters(value);
  160|      0|        return qpdf_r_ok;
  161|      0|    case qpdf_p_dct_max_memory:
  ------------------
  |  Branch (161:5): [True: 0, False: 25.9k]
  ------------------
  162|      0|        Limits::dct_max_memory(util::fits<long>(value) ? static_cast<long>(value) : 0);
  ------------------
  |  Branch (162:32): [True: 0, False: 0]
  ------------------
  163|      0|        return qpdf_r_ok;
  164|      0|    case qpdf_p_dct_max_progressive_scans:
  ------------------
  |  Branch (164:5): [True: 0, False: 25.9k]
  ------------------
  165|      0|        Limits::dct_max_progressive_scans(util::fits<int>(value) ? static_cast<int>(value) : 0);
  ------------------
  |  Branch (165:43): [True: 0, False: 0]
  ------------------
  166|      0|        return qpdf_r_ok;
  167|      0|    case qpdf_p_flate_max_memory:
  ------------------
  |  Branch (167:5): [True: 0, False: 25.9k]
  ------------------
  168|      0|        Limits::flate_max_memory(value);
  169|      0|        return qpdf_r_ok;
  170|      0|    case qpdf_p_png_max_memory:
  ------------------
  |  Branch (170:5): [True: 0, False: 25.9k]
  ------------------
  171|      0|        Limits::png_max_memory(value);
  172|      0|        return qpdf_r_ok;
  173|      0|    case qpdf_p_run_length_max_memory:
  ------------------
  |  Branch (173:5): [True: 0, False: 25.9k]
  ------------------
  174|      0|        Limits::run_length_max_memory(value);
  175|      0|        return qpdf_r_ok;
  176|      0|    case qpdf_p_tiff_max_memory:
  ------------------
  |  Branch (176:5): [True: 0, False: 25.9k]
  ------------------
  177|      0|        Limits::tiff_max_memory(value);
  178|      0|        return qpdf_r_ok;
  179|      0|    default:
  ------------------
  |  Branch (179:5): [True: 0, False: 25.9k]
  ------------------
  180|      0|        return qpdf_r_bad_parameter;
  181|  25.9k|    }
  182|  25.9k|}

_ZN14AES_PDF_nativeD2Ev:
   18|   187k|    ~AES_PDF_native() = default;

_ZN4qpdf4impl8AcroFormC2ERN4QPDF3DocE:
   38|  18.9k|            Common(doc)
   39|  18.9k|        {
   40|       |            // We have to analyze up front. Otherwise, when we are adding annotations and fields, we
   41|       |            // are in a temporarily unstable configuration where some widget annotations are not
   42|       |            // reachable.
   43|  18.9k|            validate();
   44|  18.9k|        }
_ZN4qpdf4impl8FormNodeC2ERK16QPDFObjectHandle:
  352|   192k|            BaseDictionary(oh)
  353|   192k|        {
  354|   192k|        }
_ZNK4qpdf4impl8FormNode2APEv:
  372|  39.5k|        {
  373|  39.5k|            return {get("/AP")};
  374|  39.5k|        }
_ZN4qpdf4impl8FormNode6ParentEv:
  386|  88.0k|        {
  387|  88.0k|            return {get("/Parent")};
  388|  88.0k|        }
_ZNK4qpdf4impl8FormNode4KidsEv:
  400|  37.4k|        {
  401|  37.4k|            return {get("/Kids")};
  402|  37.4k|        }
_ZNK4qpdf4impl8FormNode2FTEb:
  470|  42.3k|        {
  471|  42.3k|            return inheritable_value<Name>("/FT");
  472|  42.3k|        }
_ZNK4qpdf4impl8FormNode1TEv:
  480|  64.8k|        {
  481|  64.8k|            return {get("/T")};
  482|  64.8k|        }
_ZNK4qpdf4impl8FormNode5fieldEv:
  660|  15.0k|        {
  661|  15.0k|            return T() || Kids() || FT();
  ------------------
  |  Branch (661:20): [True: 9.45k, False: 5.55k]
  |  Branch (661:27): [True: 1.22k, False: 4.33k]
  |  Branch (661:37): [True: 1.39k, False: 2.94k]
  ------------------
  662|  15.0k|        }
_ZNK4qpdf4impl8FormNode6widgetEv:
  680|  15.0k|        {
  681|  15.0k|            return !Kids() && (contains("/Subtype") || contains("/Rect") || contains("/AP"));
  ------------------
  |  Branch (681:20): [True: 11.3k, False: 3.67k]
  |  Branch (681:32): [True: 7.47k, False: 3.86k]
  |  Branch (681:56): [True: 214, False: 3.64k]
  |  Branch (681:77): [True: 330, False: 3.31k]
  ------------------
  682|  15.0k|        }
_ZNK4qpdf4impl8FormNode13from_AcroFormERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  767|  17.0k|        {
  768|  17.0k|            return {qpdf() ? qpdf()->getRoot()["/AcroForm"][name] : null_oh};
  ------------------
  |  Branch (768:21): [True: 16.0k, False: 1.02k]
  ------------------
  769|  17.0k|        }
_ZN26QPDFAcroFormDocumentHelper7MembersC2ER4QPDF:
  790|  18.9k|        AcroForm(qpdf.doc())
  791|  18.9k|    {
  792|  18.9k|    }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_4NameEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  42.3k|        {
  449|  42.3k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 36.5k, False: 5.79k]
  ------------------
  450|  36.5k|                return {v};
  451|  36.5k|            }
  452|  5.79k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 5.79k, False: 0]
  ------------------
  453|  42.3k|        }
_ZN4qpdf4impl8AcroFormD2Ev:
   35|  18.9k|        ~AcroForm() = default;
_ZN4qpdf4impl8FormNodeC2ERKS1_:
  345|  29.3k|        FormNode(FormNode const&) = default;
_ZN4qpdf4impl8FormNodeaSEOS1_:
  348|  53.9k|        FormNode& operator=(FormNode&&) = default;
_ZNK4qpdf4impl8FormNode17inheritable_valueI16QPDFObjectHandleEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  5.59k|        {
  449|  5.59k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.57k, False: 4.01k]
  ------------------
  450|  1.57k|                return {v};
  451|  1.57k|            }
  452|  4.01k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 4.01k, False: 0]
  ------------------
  453|  5.59k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_6StringEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  18.5k|        {
  449|  18.5k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 8.63k, False: 9.96k]
  ------------------
  450|  8.63k|                return {v};
  451|  8.63k|            }
  452|  9.96k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 9.96k, False: 0]
  ------------------
  453|  18.5k|        }
_ZNK4qpdf4impl8FormNode1VI16QPDFObjectHandleEET_b:
  564|    670|        {
  565|    670|            return inheritable_value<T>("/V", inherit);
  566|    670|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_5ArrayEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  2.34k|        {
  449|  2.34k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.23k, False: 1.10k]
  ------------------
  450|  1.23k|                return {v};
  451|  1.23k|            }
  452|  1.10k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 1.10k, False: 0]
  ------------------
  453|  2.34k|        }

_ZN17ContentNormalizerC2Ev:
    9|  46.3k|    ContentNormalizer() = default;
_ZNK17ContentNormalizer12anyBadTokensEv:
   15|  42.2k|    {
   16|  42.2k|        return any_bad_tokens;
   17|  42.2k|    }

_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|  1.10M|        {
   49|  1.10M|            return description;
   50|  1.10M|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|   113M|        {
   55|   113M|            return pos + global_offset;
   56|   113M|        }
_ZN4qpdf2is12OffsetBuffer8unreadChEc:
   70|  20.0k|        {
   71|  20.0k|            if (pos > 0) {
  ------------------
  |  Branch (71:17): [True: 20.0k, False: 0]
  ------------------
   72|  20.0k|                --pos;
   73|  20.0k|            }
   74|  20.0k|        }
_ZN4qpdf2is12OffsetBufferD2Ev:
   42|   106k|        ~OffsetBuffer() final = default;
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|   106k|            description(description),
   22|   106k|            view_(view),
   23|   106k|            global_offset(global_offset)
   24|   106k|        {
   25|   106k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 49, False: 106k]
  ------------------
   26|     49|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     49|            }
   28|   106k|            last_offset = global_offset;
   29|   106k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  41.7k|{
   88|  41.7k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 28.0k, False: 13.7k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  28.0k|    }
   91|  41.7k|    str.resize(count);
   92|  41.7k|    str.resize(read(str.data(), count));
   93|  41.7k|    return str.size();
   94|  41.7k|}
_ZN11InputSource4readEmx:
   98|  28.0k|{
   99|  28.0k|    std::string result(count, '\0');
  100|  28.0k|    (void)read(result, count, at);
  101|  28.0k|    return result;
  102|  28.0k|}
_ZN11InputSource10loadBufferEv:
  106|  6.04M|{
  107|  6.04M|    buf_idx = 0;
  108|  6.04M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  6.04M|    buf_start = last_offset;
  111|  6.04M|}
_ZN11InputSource8fastTellEv:
  115|  55.0M|{
  116|  55.0M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 121k, False: 54.9M]
  ------------------
  117|   121k|        loadBuffer();
  118|  54.9M|    } else {
  119|  54.9M|        auto curr = tell();
  120|  54.9M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 67.4k, False: 54.8M]
  |  Branch (120:33): [True: 5.85M, False: 48.9M]
  ------------------
  121|  5.92M|            loadBuffer();
  122|  48.9M|        } else {
  123|  48.9M|            last_offset = curr;
  124|  48.9M|            buf_idx = curr - buf_start;
  125|  48.9M|        }
  126|  54.9M|    }
  127|  55.0M|    return last_offset;
  128|  55.0M|}
_ZN11InputSource8fastReadERc:
  132|   762M|{
  133|       |    // Before calling fastRead, fastTell must be called to prepare the buffer. Once reading is
  134|       |    // complete, fastUnread must be called to set the correct file position.
  135|   762M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 756M, False: 5.57M]
  ------------------
  136|   756M|        ch = buffer[buf_idx];
  137|   756M|        ++(buf_idx);
  138|   756M|        ++(last_offset);
  139|   756M|        return true;
  140|       |
  141|   756M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 81.4k, False: 5.49M]
  ------------------
  142|  81.4k|        return false;
  143|  5.49M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  5.49M|        fastTell();
  146|  5.49M|        return fastRead(ch);
  147|  5.49M|    }
  148|   762M|}
_ZN11InputSource10fastUnreadEb:
  152|  49.5M|{
  153|  49.5M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 29.2M, False: 20.3M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  49.5M|}

_ZN4JSON6WriterC2EP8Pipelinem:
   20|  19.6k|        p(p),
   21|  19.6k|        indent(2 * depth)
   22|  19.6k|    {
   23|  19.6k|    }
_ZN4JSON6Writer5writeEPKcm:
   27|  1.85M|    {
   28|  1.85M|        p->write(reinterpret_cast<unsigned char const*>(data), len);
   29|  1.85M|        return *this;
   30|  1.85M|    }
_ZN4JSON6Writer9writeNextEv:
   42|  1.55M|    {
   43|  1.55M|        auto n = indent;
   44|  1.55M|        if (first) {
  ------------------
  |  Branch (44:13): [True: 238k, False: 1.32M]
  ------------------
   45|   238k|            first = false;
   46|   238k|            write(&spaces[1], n % n_spaces + 1);
   47|  1.32M|        } else {
   48|  1.32M|            write(&spaces[0], n % n_spaces + 2);
   49|  1.32M|        }
   50|  1.58M|        while (n >= n_spaces) {
  ------------------
  |  Branch (50:16): [True: 25.4k, False: 1.55M]
  ------------------
   51|  25.4k|            write(&spaces[2], n_spaces);
   52|  25.4k|            n -= n_spaces;
   53|  25.4k|        }
   54|  1.55M|        return *this;
   55|  1.55M|    }
_ZN4JSON6Writer10writeStartERKc:
   59|   134k|    {
   60|   134k|        write(&c, 1);
   61|   134k|        first = true;
   62|   134k|        indent += 2;
   63|   134k|        return *this;
   64|   134k|    }
_ZN4JSON6Writer8writeEndERKc:
   68|   134k|    {
   69|   134k|        if (indent > 1) {
  ------------------
  |  Branch (69:13): [True: 134k, False: 0]
  ------------------
   70|   134k|            indent -= 2;
   71|   134k|        }
   72|   134k|        if (!first) {
  ------------------
  |  Branch (72:13): [True: 119k, False: 15.1k]
  ------------------
   73|   119k|            first = true;
   74|   119k|            writeNext();
   75|   119k|        }
   76|   134k|        first = false;
   77|   134k|        write(&c, 1);
   78|   134k|        return *this;
   79|   134k|    }
_ZN4JSON6WriterlsENSt3__117basic_string_viewIcNS1_11char_traitsIcEEEE:
   83|  4.44M|    {
   84|  4.44M|        p->write(reinterpret_cast<unsigned char const*>(sv.data()), sv.size());
   85|  4.44M|        return *this;
   86|  4.44M|    }
_ZN4JSON6WriterlsEPKc:
   90|  2.84M|    {
   91|  2.84M|        *this << std::string_view{s};
   92|  2.84M|        return *this;
   93|  2.84M|    }
_ZN4JSON6WriterlsEb:
   97|  3.51k|    {
   98|  3.51k|        *this << (val ? "true" : "false");
  ------------------
  |  Branch (98:19): [True: 3.00k, False: 508]
  ------------------
   99|  3.51k|        return *this;
  100|  3.51k|    }

_ZN3MD523encodeDataIncrementallyENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   36|  5.79k|    {
   37|  5.79k|        crypto->MD5_update(
   38|  5.79k|            reinterpret_cast<unsigned char*>(const_cast<char*>(input_data.data())),
   39|  5.79k|            input_data.size());
   40|  5.79k|    }
_ZN3MD523encodeDataIncrementallyEPKcm:
   29|  81.8k|    {
   30|  81.8k|        crypto->MD5_update(reinterpret_cast<unsigned char*>(const_cast<char*>(input_data)), len);
   31|  81.8k|    }

_ZNK10NNTreeImpl8itemsKeyEv:
  185|   208k|    {
  186|   208k|        return items_key;
  187|   208k|    }
_ZNK14NNTreeIterator5validEv:
   29|  65.7k|    {
   30|  65.7k|        return item_number >= 0;
   31|  65.7k|    }
_ZN14NNTreeIterator13setItemNumberERK16QPDFObjectHandlei:
  102|  21.2k|    {
  103|  21.2k|        node = a_node;
  104|  21.2k|        item_number = n;
  105|  21.2k|        updateIValue();
  106|  21.2k|    }
_ZNK10NNTreeImpl8keyValidE16QPDFObjectHandle:
  190|   225k|    {
  191|   225k|        return o.resolved_type_code() == key_type;
  192|   225k|    }
_ZN14NNTreeIteratorD2Ev:
   24|  42.4k|    ~NNTreeIterator() = default;
_ZN14NNTreeIterator14addPathElementERK16QPDFObjectHandlei:
  109|  11.1k|    {
  110|  11.1k|        path.emplace_back(a_node, kid_number);
  111|  11.1k|    }
_ZN14NNTreeIterator11PathElementC2ERKN4qpdf10DictionaryEi:
   85|  11.2k|            node(node),
   86|  11.2k|            kid_number(kid_number)
   87|  11.2k|        {
   88|  11.2k|        }
_ZN14NNTreeIteratorC2ER10NNTreeImpl:
   95|  27.9k|        impl(impl)
   96|  27.9k|    {
   97|  27.9k|    }
_ZN10NNTreeImplC2ER4QPDFN4qpdf10DictionaryE18qpdf_object_type_eNSt3__18functionIFbRK16QPDFObjectHandleEEEb:
  139|  2.15k|        qpdf(qpdf),
  140|  2.15k|        tree_root(std::move(tree_root)),
  141|  2.15k|        key_type(key_type),
  142|  2.15k|        items_key(key_type == ::ot_string ? "/Names" : "/Nums"),
  ------------------
  |  Branch (142:19): [True: 966, False: 1.19k]
  ------------------
  143|  2.15k|        value_valid(value_validator),
  144|  2.15k|        auto_repair(auto_repair)
  145|  2.15k|    {
  146|  2.15k|    }
_ZN10NNTreeImpl3endEv:
  150|  6.44k|    {
  151|  6.44k|        return {*this};
  152|  6.44k|    }
_ZNK14NNTreeIteratorneERKS_:
   73|  26.2k|    {
   74|  26.2k|        return !operator==(other);
   75|  26.2k|    }
_ZN14NNTreeIteratordeEv:
   60|  25.0k|    {
   61|  25.0k|        updateIValue(false);
   62|  25.0k|        return ivalue;
   63|  25.0k|    }
_ZN14NNTreeIteratorppEv:
   34|  24.4k|    {
   35|  24.4k|        increment(false);
   36|  24.4k|        return *this;
   37|  24.4k|    }
_ZN14NNTreeIteratorptEv:
   66|  37.8k|    {
   67|  37.8k|        updateIValue(false);
   68|  37.8k|        return &ivalue;
   69|  37.8k|    }

_ZN17OffsetInputSourceD2Ev:
   13|  1.12k|    ~OffsetInputSource() override = default;

_ZN4qpdf2pl6StringC2ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   23|  77.6k|            Pipeline("", nullptr),
   24|  77.6k|            str(str)
   25|  77.6k|        {
   26|  77.6k|        }
_ZN4qpdf2pl6String5writeEPKhm:
   32|  8.27M|        {
   33|  8.27M|            if (len) {
  ------------------
  |  Branch (33:17): [True: 8.26M, False: 7.05k]
  ------------------
   34|  8.26M|                str.append(reinterpret_cast<char const*>(buf), len);
   35|  8.26M|            }
   36|  8.27M|        }
_ZN4qpdf2pl6String6finishEv:
   40|  74.1k|        {
   41|  74.1k|        }
_ZN4qpdf2pl6StringC2EPKcP8PipelineRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
   17|  18.5k|            Pipeline(identifier, nullptr),
   18|  18.5k|            str(str)
   19|  18.5k|        {
   20|  18.5k|        }

_ZN10Pl_AES_PDFD2Ev:
   15|   187k|    ~Pl_AES_PDF() final = default;

_ZN13Pl_LZWDecoderD2Ev:
   13|  4.16k|    ~Pl_LZWDecoder() final = default;

_ZN12Pl_PNGFilterD2Ev:
   26|  1.93k|    ~Pl_PNGFilter() final = default;

_ZN6Pl_RC4D2Ev:
   16|  1.76k|    ~Pl_RC4() final = default;

_ZN7Pl_SHA2D2Ev:
   20|   181k|    ~Pl_SHA2() final = default;

_ZN16Pl_TIFFPredictorD2Ev:
   24|  1.11k|    ~Pl_TIFFPredictor() override = default;

_ZN17QPDFCrypto_nativeC2Ev:
   15|   484k|    QPDFCrypto_native() = default;
_ZN17QPDFCrypto_nativeD2Ev:
   17|   484k|    ~QPDFCrypto_native() final = default;

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  79.2M|    {
  934|  79.2M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 79.2M, False: 0]
  ------------------
  935|  79.2M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|   741k|    {
  928|   741k|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 740k, False: 1.02k]
  ------------------
  929|   741k|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  65.3k|    {
  922|  65.3k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 65.3k, False: 0]
  ------------------
  923|  65.3k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  23.4M|    {
  952|  23.4M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 199k, False: 23.2M]
  ------------------
  953|   199k|            return ::ot_uninitialized;
  954|   199k|        }
  955|  23.2M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 295k, False: 22.9M]
  ------------------
  956|   295k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   295k|        }
  958|  22.9M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 22.9M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  22.9M|        return raw_type_code();
  962|  22.9M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  4.69M|    {
  861|  4.69M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 4.68M, False: 3.58k]
  ------------------
  862|  4.69M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|  1.29M|    {
  908|  1.29M|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 154k, False: 1.13M]
  |  Branch (908:24): [True: 277k, False: 861k]
  ------------------
  909|  1.29M|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   617k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 529k, False: 88.1k]
  ------------------
   58|   617k|        {
   59|   617k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  3.30M|    {
  940|  3.30M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 150k, False: 3.15M]
  ------------------
  941|   150k|            return ::ot_uninitialized;
  942|   150k|        }
  943|  3.15M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 1.99k, False: 3.15M]
  ------------------
  944|  1.99k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|  1.99k|        }
  946|  3.15M|        return raw_type_code();
  947|  3.15M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  2.34M|        obj(oh.obj)
  789|  2.34M|    {
  790|  2.34M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   523k|            BaseDictionary(oh)
  269|   523k|        {
  270|   523k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   715k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 581k, False: 133k]
  ------------------
  239|   715k|        {
  240|   715k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|  84.3k|        {
  142|  84.3k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 55.2k, False: 29.1k]
  ------------------
  143|  55.2k|                return d->items.begin();
  144|  55.2k|            }
  145|  29.1k|            return {};
  146|  84.3k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|  2.70M|    {
  771|  2.70M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 70.7k, False: 2.63M]
  ------------------
  772|  70.7k|            return nullptr;
  773|  70.7k|        }
  774|  2.63M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2.58M, False: 52.0k]
  ------------------
  775|  2.58M|            return &std::get<T>(obj->value);
  776|  2.58M|        }
  777|  52.0k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 159, False: 51.8k]
  ------------------
  778|    159|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    159|        }
  780|  51.8k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 51.8k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  51.8k|        return nullptr;
  785|  51.8k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|  84.3k|        {
  151|  84.3k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 55.2k, False: 29.1k]
  ------------------
  152|  55.2k|                return d->items.end();
  153|  55.2k|            }
  154|  29.1k|            return {};
  155|  84.3k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  1.11M|    {
  855|  1.11M|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 1.11M, False: 0]
  ------------------
  856|  1.11M|    }
_ZNK4qpdf6Stream7getDictEv:
  554|   129k|        {
  555|   129k|            return {stream()->stream_dict};
  556|   129k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   363k|        {
  698|   363k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 363k, False: 0]
  ------------------
  699|   363k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 363k, False: 4]
  ------------------
  700|   363k|                    return ptr;
  701|   363k|                }
  702|      4|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   363k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   363k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   363k|    {
  771|   363k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 363k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   363k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 363k, False: 0]
  ------------------
  775|   363k|            return &std::get<T>(obj->value);
  776|   363k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN4qpdf7IntegerC2ERK16QPDFObjectHandle:
  319|   491k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 172k, False: 318k]
  ------------------
  320|   491k|        {
  321|   491k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   249k|        {
  331|   249k|            return obj != nullptr;
  332|   249k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   333k|        {
  474|   333k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 249k, False: 83.3k]
  |  Branch (474:27): [True: 146k, False: 103k]
  ------------------
  475|   333k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   436k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 294k, False: 141k]
  ------------------
  450|   436k|        {
  451|   436k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|   206k|    {
  806|   206k|        return {obj};
  807|   206k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   711k|{
  989|   711k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   711k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  49.9k|        {
  362|  49.9k|            try {
  363|  49.9k|                return static_cast<T>(*this);
  364|  49.9k|            } catch (std::underflow_error&) {
  365|    115|                if constexpr (std::is_same_v<T, int>) {
  366|    115|                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|       |                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|       |                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|    115|                return std::numeric_limits<T>::min();
  377|    298|            } catch (std::overflow_error&) {
  378|    298|                if constexpr (std::is_same_v<T, int>) {
  379|    298|                    warn("requested value of integer is too big; returning INT_MAX");
  380|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|       |                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|       |                } else {
  383|       |                    warn(
  384|       |                        "overflow while converting integer object; returning largest possible "
  385|       |                        "value");
  386|       |                }
  387|    298|                return std::numeric_limits<T>::max();
  388|    298|            }
  389|  49.9k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  58.1k|        {
  340|  58.1k|            auto v = value();
  341|       |
  342|  58.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 299, False: 57.8k]
  ------------------
  343|    299|                throw std::overflow_error("Integer conversion overflow");
  344|    299|            }
  345|  57.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 115, False: 57.7k]
  ------------------
  346|    115|                throw std::underflow_error("Integer conversion underflow");
  347|    115|            }
  348|  57.7k|            return static_cast<T>(v);
  349|  57.8k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  6.51k|        {
   37|  6.51k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 6.51k, False: 0]
  ------------------
   38|  6.51k|                obj = other.obj;
   39|  6.51k|            }
   40|  6.51k|            return *this;
   41|  6.51k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|   103k|            BaseHandle(obj)
   48|   103k|        {
   49|   103k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  44.5k|            BaseHandle(std::move(obj))
   53|  44.5k|        {
   54|  44.5k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  31.8k|        {
   64|  31.8k|            assign(::ot_array, oh);
   65|  31.8k|            return *this;
   66|  31.8k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|    664|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 10, False: 654]
  ------------------
   70|    664|        {
   71|    664|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  49.6k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  49.6k|        {
  222|  49.6k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|   287k|            BaseHandle(obj)
  226|   287k|        {
  227|   287k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  13.1k|            BaseHandle(
  244|  13.1k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 11.5k, False: 1.51k]
  ------------------
  245|  13.1k|        {
  246|  13.1k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  30.7k|        {
  275|  30.7k|            assign(::ot_dictionary, oh);
  276|  30.7k|            return *this;
  277|  30.7k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  13.1k|            BaseDictionary(std::move(oh))
  281|  13.1k|        {
  282|  13.1k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|    414|        {
  287|    414|            assign(::ot_dictionary, std::move(oh));
  288|    414|            return *this;
  289|    414|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  48.9k|        {
  462|  48.9k|            return value();
  463|  48.9k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf4Null4tempEv:
  496|  62.0k|        {
  497|  62.0k|            return temp_.oh();
  498|  62.0k|        }
_ZN4qpdf4Null7if_nullE16QPDFObjectHandle:
  503|  9.96k|        {
  504|  9.96k|            return oh ? std::move(oh) : Null::temp();
  ------------------
  |  Branch (504:20): [True: 6.03k, False: 3.93k]
  ------------------
  505|  9.96k|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|   133k|            BaseHandle(obj)
  516|   133k|        {
  517|   133k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|   169k|            BaseHandle(std::move(obj))
  521|   169k|        {
  522|   169k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  41.1k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 11.9k, False: 29.1k]
  ------------------
  538|  41.1k|        {
  539|  41.1k|        }
_ZNK4qpdf6Stream6LengthEv:
  563|  3.90k|        {
  564|  3.90k|            return {getDict()["/Length"]};
  565|  3.90k|        }
_ZNK4qpdf6Stream7SubtypeEv:
  592|  7.42k|        {
  593|  7.42k|            return {getDict()["/Subtype"]};
  594|  7.42k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  31.9k|        {
  602|  31.9k|            return {getDict()["/Type"]};
  603|  31.9k|        }
_ZNK4qpdf6Stream9getLengthEv:
  624|    399|        {
  625|    399|            return stream()->length;
  626|    399|        }
_ZN4qpdf6Stream11replaceDictERK16QPDFObjectHandle:
  681|  4.39k|        {
  682|  4.39k|            auto s = stream();
  683|  4.39k|            s->stream_dict = new_dict;
  684|  4.39k|            setDictDescription();
  685|  4.39k|        }
_ZN4qpdf6StringC2ERK16QPDFObjectHandle:
  732|  85.3k|            BaseHandle(oh.type_code() == ::ot_string ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (732:24): [True: 62.5k, False: 22.8k]
  ------------------
  733|  85.3k|        {
  734|  85.3k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   430k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 430k, False: 0]
  ------------------
  738|   430k|        {
  739|   430k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|   175k|    {
  800|   175k|        return obj;
  801|   175k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  62.6k|    {
  839|  62.6k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 24.9k, False: 37.7k]
  ------------------
  840|  24.9k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 23.3k, False: 1.57k]
  ------------------
  841|  24.9k|        }
  842|  62.6k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|    414|    {
  847|    414|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 339, False: 75]
  ------------------
  848|    339|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 339, False: 0]
  ------------------
  849|    339|        }
  850|    414|    }
_ZNK4qpdf10BaseHandle21no_ci_stop_damaged_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  877|  4.39k|    {
  878|  4.39k|        if (condition) {
  ------------------
  |  Branch (878:13): [True: 0, False: 4.39k]
  ------------------
  879|      0|            throw std::runtime_error(message);
  880|      0|        }
  881|  4.39k|    }
_ZNK4qpdf10BaseHandle13no_ci_warn_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  885|  10.1k|    {
  886|  10.1k|        if (condition) {
  ------------------
  |  Branch (886:13): [True: 0, False: 10.1k]
  ------------------
  887|      0|            warn(warning);
  888|      0|        }
  889|  10.1k|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|  1.20M|    {
  902|  1.20M|        return (*this)[key];
  903|  1.20M|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|   320k|{
  975|   320k|    auto n = QPDFObject::create<QPDF_Null>();
  976|   320k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|   320k|    return n;
  978|   320k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|   145k|{
 1007|   145k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 145k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|   145k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 72.6k, False: 73.2k]
  |  Branch (1010:37): [True: 28.6k, False: 44.5k]
  ------------------
 1011|   101k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 44.5k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|   101k|        return qpdf::Array(obj);
 1013|   101k|    }
 1014|  44.5k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|   145k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|   287k|{
 1020|   287k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 44.0k, False: 243k]
  |  Branch (1020:37): [True: 223k, False: 20.0k]
  ------------------
 1021|   267k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 20.0k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|   267k|        return qpdf::Dictionary(obj);
 1023|   267k|    }
 1024|  20.0k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 20.0k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  20.0k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|   287k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|   306k|{
 1033|   306k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 306k]
  |  Branch (1033:37): [True: 136k, False: 169k]
  ------------------
 1034|   169k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 169k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|   133k|        return qpdf::Stream(obj);
 1036|   133k|    }
 1037|   173k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 173k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|   173k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|   306k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  17.4k|{
  989|  17.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.4k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   281k|{
  989|   281k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   281k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   482k|        obj(std::move(oh.obj))
  794|   482k|    {
  795|   482k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  28.4k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  28.4k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|  67.2k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|  96.6k|        BaseDictionary(BaseDictionary const&) = default;
_ZN4qpdf10DictionaryaSEOS0_:
  265|  30.1k|        Dictionary& operator=(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryaSEOS0_:
  235|  84.0k|        BaseDictionary& operator=(BaseDictionary&&) = default;
_ZN4qpdf6StreamaSEOS0_:
  528|  4.80k|        Stream& operator=(Stream&&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.25k|{
  989|  1.25k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.25k|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  2.63M|{
  989|  2.63M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  2.63M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  50.7k|{
  989|  50.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  50.7k|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   133k|{
  989|   133k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   133k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   195k|{
  989|   195k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   195k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    471|{
  989|    471|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    471|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  34.8k|{
  989|  34.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  34.8k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  51.5k|{
  989|  51.5k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  51.5k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|  3.16k|    {
  771|  3.16k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 3.16k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  3.16k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 3.16k, False: 0]
  ------------------
  775|  3.16k|            return &std::get<T>(obj->value);
  776|  3.16k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf10BaseHandle2asI12QPDF_IntegerEEPT_v:
  770|   173k|    {
  771|   173k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.24k, False: 172k]
  ------------------
  772|  1.24k|            return nullptr;
  773|  1.24k|        }
  774|   172k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 172k, False: 0]
  ------------------
  775|   172k|            return &std::get<T>(obj->value);
  776|   172k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralExEEv:
  339|  66.1k|        {
  340|  66.1k|            auto v = value();
  341|       |
  342|  66.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 66.1k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  66.1k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 66.1k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  66.1k|            return static_cast<T>(v);
  349|  66.1k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  28.5k|        {
  362|  28.5k|            try {
  363|  28.5k|                return static_cast<T>(*this);
  364|  28.5k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|       |                    warn("unsigned integer value request for negative number; returning 0");
  369|    106|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    106|                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|    106|                return std::numeric_limits<T>::min();
  377|    106|            } catch (std::overflow_error&) {
  378|       |                if constexpr (std::is_same_v<T, int>) {
  379|       |                    warn("requested value of integer is too big; returning INT_MAX");
  380|       |                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|       |                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|      0|                } else {
  383|      0|                    warn(
  384|      0|                        "overflow while converting integer object; returning largest possible "
  385|      0|                        "value");
  386|      0|                }
  387|      0|                return std::numeric_limits<T>::max();
  388|      0|            }
  389|  28.5k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  28.5k|        {
  340|  28.5k|            auto v = value();
  341|       |
  342|  28.5k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 28.5k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  28.5k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 106, False: 28.4k]
  ------------------
  346|    106|                throw std::underflow_error("Integer conversion underflow");
  347|    106|            }
  348|  28.4k|            return static_cast<T>(v);
  349|  28.5k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  7.62k|        {
  362|  7.62k|            try {
  363|  7.62k|                return static_cast<T>(*this);
  364|  7.62k|            } catch (std::underflow_error&) {
  365|       |                if constexpr (std::is_same_v<T, int>) {
  366|       |                    warn("requested value of integer is too small; returning INT_MIN");
  367|    123|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    123|                    warn("unsigned integer value request for negative number; returning 0");
  369|       |                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|       |                    warn("unsigned value request for negative number; returning 0");
  371|       |                } else {
  372|       |                    warn(
  373|       |                        "underflow while converting integer object; returning smallest possible "
  374|       |                        "value");
  375|       |                }
  376|    123|                return std::numeric_limits<T>::min();
  377|    123|            } catch (std::overflow_error&) {
  378|       |                if constexpr (std::is_same_v<T, int>) {
  379|       |                    warn("requested value of integer is too big; returning INT_MAX");
  380|     86|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|     86|                    warn("requested value of unsigned integer is too big; returning UINT_MAX");
  382|       |                } else {
  383|       |                    warn(
  384|       |                        "overflow while converting integer object; returning largest possible "
  385|       |                        "value");
  386|       |                }
  387|     86|                return std::numeric_limits<T>::max();
  388|     86|            }
  389|  7.62k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  7.62k|        {
  340|  7.62k|            auto v = value();
  341|       |
  342|  7.62k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 86, False: 7.54k]
  ------------------
  343|     86|                throw std::overflow_error("Integer conversion overflow");
  344|     86|            }
  345|  7.54k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 123, False: 7.41k]
  ------------------
  346|    123|                throw std::underflow_error("Integer conversion underflow");
  347|    123|            }
  348|  7.41k|            return static_cast<T>(v);
  349|  7.54k|        }
_ZNK4qpdf10BaseHandle2asI9QPDF_RealEEPT_v:
  770|  87.2k|    {
  771|  87.2k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 87.2k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  87.2k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 87.2k, False: 0]
  ------------------
  775|  87.2k|            return &std::get<T>(obj->value);
  776|  87.2k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  2.03M|{
  989|  2.03M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  2.03M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  41.5k|{
  989|  41.5k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  41.5k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|   332k|    {
  771|   332k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 332k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   332k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 330k, False: 2.26k]
  ------------------
  775|   330k|            return &std::get<T>(obj->value);
  776|   330k|        }
  777|  2.26k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1, False: 2.26k]
  ------------------
  778|      1|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      1|        }
  780|  2.26k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 2.26k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  2.26k|        return nullptr;
  785|  2.26k|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   348k|{
  989|   348k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   348k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    580|{
  989|    580|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    580|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   474k|    {
  771|   474k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 474k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   474k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 474k, False: 0]
  ------------------
  775|   474k|            return &std::get<T>(obj->value);
  776|   474k|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZNK4qpdf10BaseHandle2asI13QPDF_OperatorEEPT_v:
  770|  16.7M|    {
  771|  16.7M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 16.7M]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  16.7M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 16.7M, False: 0]
  ------------------
  775|  16.7M|            return &std::get<T>(obj->value);
  776|  16.7M|        }
  777|      0|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 0]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|      0|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 0]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|      0|        return nullptr;
  785|      0|    }
_ZN10QPDFObject6createI9QPDF_RealJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   234k|{
  989|   234k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   234k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  58.4k|{
  989|  58.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  58.4k|}
_ZN9QPDF_RealC2Edib:
  981|  58.4k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  58.4k|{
  983|  58.4k|}
_ZN10QPDFObject6createI13QPDF_OperatorJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  17.4M|{
  989|  17.4M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  17.4M|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  27.3k|{
  989|  27.3k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  27.3k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   281k|    items(std::move(items))
  968|   281k|{
  969|   281k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  19.7k|{
  989|  19.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  19.7k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   325k|{
  989|   325k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   325k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   154k|{
  989|   154k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   154k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  1.75M|    {
  771|  1.75M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 151k, False: 1.60M]
  ------------------
  772|   151k|            return nullptr;
  773|   151k|        }
  774|  1.60M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.52M, False: 77.5k]
  ------------------
  775|  1.52M|            return &std::get<T>(obj->value);
  776|  1.52M|        }
  777|  77.5k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 77.5k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  77.5k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 77.5k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  77.5k|        return nullptr;
  785|  77.5k|    }
_ZN4qpdf6Stream6LengthITkNSt3__18integralExEEvT_:
  582|  3.90k|        {
  583|  3.90k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  3.90k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 3.90k, False: 0]
  ------------------
  584|  3.90k|            getDict().replace("/Length", Integer(val));
  585|  3.90k|        }
_ZN4qpdf6Stream6LengthITkNSt3__18integralEmEEvT_:
  582|  20.0k|        {
  583|  20.0k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  20.0k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 20.0k, False: 0]
  ------------------
  584|  20.0k|            getDict().replace("/Length", Integer(val));
  585|  20.0k|        }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  24.6k|            Integer(static_cast<long long>(value))
  308|  24.6k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  24.6k|                              std::numeric_limits<long long>::max())) {
  312|  24.6k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 24.6k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  24.6k|            }
  316|  24.6k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.75k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.75k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  7.29k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  7.29k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  6.51k|        Array() = default;

_ZNK10QPDFObject11getTypeCodeEv:
  329|  1.27M|    {
  330|  1.27M|        return static_cast<qpdf_object_type_e>(value.index());
  331|  1.27M|    }
_ZN10QPDFObjectC2I9QPDF_NullEEOT_:
  300|   711k|        value(std::forward<T>(value))
  301|   711k|    {
  302|   711k|    }
_ZN10QPDF_ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   67|  27.3k|        elements(items)
   68|  27.3k|    {
   69|  27.3k|    }
_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   73|   154k|        elements(std::move(items))
   74|   154k|    {
   75|   154k|    }
_ZNK10QPDF_Array4sizeEv:
   79|   260k|    {
   80|   260k|        return sp ? sp->size : elements.size();
  ------------------
  |  Branch (80:16): [True: 28.2k, False: 232k]
  ------------------
   81|   260k|    }
_ZN9QPDF_BoolC2Eb:
   94|  21.0k|        val(val)
   95|  21.0k|    {
   96|  21.0k|    }
_ZN15QPDF_DictionaryC2ERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  111|  68.9k|        items(items)
  112|  68.9k|    {
  113|  68.9k|    }
_ZN12QPDF_IntegerC2Ex:
  140|  2.96M|        val(val)
  141|  2.96M|    {
  142|  2.96M|    }
_ZN9QPDF_NameC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  154|  2.27M|        name(std::move(name))
  155|  2.27M|    {
  156|  2.27M|    }
_ZN13QPDF_OperatorC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  179|  17.4M|        val(std::move(val))
  180|  17.4M|    {
  181|  17.4M|    }
_ZN9QPDF_RealC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  193|   285k|        val(std::move(val))
  194|   285k|    {
  195|   285k|    }
_ZN14QPDF_ReferenceC2ENSt3__110shared_ptrI10QPDFObjectEE:
  210|     85|        obj(std::move(obj))
  211|     85|    {
  212|     85|    }
_ZN11QPDF_Stream7MembersC2E16QPDFObjectHandlem:
  232|  52.6k|            stream_dict(std::move(stream_dict)),
  233|  52.6k|            length(length)
  234|  52.6k|        {
  235|  52.6k|        }
_ZN11QPDF_StreamC2E16QPDFObjectHandlem:
  254|  52.6k|        m(std::make_unique<Members>(stream_dict, length))
  255|  52.6k|    {
  256|  52.6k|        if (!stream_dict.isDictionary()) {
  ------------------
  |  Branch (256:13): [True: 0, False: 52.6k]
  ------------------
  257|      0|            throw std::logic_error(
  258|      0|                "stream object instantiated with non-dictionary object for dictionary");
  259|      0|        }
  260|  52.6k|    }
_ZN11QPDF_StringC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  279|   481k|        val(val)
  280|   481k|    {
  281|   481k|    }
_ZN11QPDF_StringC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  283|    580|        val(std::move(val))
  284|    580|    {
  285|    580|    }
_ZN10QPDFObject11assign_nullEv:
  334|    856|    {
  335|    856|        value = QPDF_Null();
  336|    856|        qpdf = nullptr;
  337|    856|        og = QPDFObjGen();
  338|    856|        object_description = nullptr;
  339|    856|        parsed_offset = -1;
  340|    856|    }
_ZN10QPDFObject7move_toERNSt3__110shared_ptrIS_EEb:
  343|   295k|    {
  344|   295k|        o->value = std::move(value);
  345|   295k|        o->qpdf = qpdf;
  346|   295k|        o->og = og;
  347|   295k|        o->object_description = object_description;
  348|   295k|        o->parsed_offset = parsed_offset;
  349|   295k|        if (!destroy) {
  ------------------
  |  Branch (349:13): [True: 85, False: 295k]
  ------------------
  350|     85|            value = QPDF_Reference(o);
  351|     85|        }
  352|   295k|    }
_ZN10QPDFObject9setObjGenEP4QPDF10QPDFObjGen:
  364|   362k|    {
  365|   362k|        qpdf = a_qpdf;
  366|   362k|        og = a_og;
  367|   362k|    }
_ZNK10QPDFObject12isUnresolvedEv:
  371|   681k|    {
  372|   681k|        return getTypeCode() == ::ot_unresolved;
  373|   681k|    }
_ZN10QPDFObject10ChildDescrC2ENSt3__110shared_ptrIS_EERKNS1_17basic_string_viewIcNS1_11char_traitsIcEEEENS1_12basic_stringIcS6_NS1_9allocatorIcEEEE:
  393|   320k|            parent(parent),
  394|   320k|            static_descr(static_descr),
  395|   320k|            var_descr(var_descr)
  396|   320k|        {
  397|   320k|        }
_ZN10QPDFObject14ObjStreamDescrC2Eii:
  407|  20.8k|            stream_id(stream_id),
  408|  20.8k|            obj_id(obj_id) {};
_ZN10QPDFObject14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS_10JSON_DescrENS_10ChildDescrENS_14ObjStreamDescrEEEEEEx:
  419|  23.3M|    {
  420|  23.3M|        qpdf = qpdf_p;
  421|  23.3M|        object_description = description;
  422|  23.3M|        setParsedOffset(offset);
  423|  23.3M|    }
_ZN10QPDFObject21setDefaultDescriptionEP4QPDFRK10QPDFObjGen:
  426|   367k|    {
  427|   367k|        qpdf = a_qpdf;
  428|   367k|        og = a_og;
  429|   367k|    }
_ZN10QPDFObject19setChildDescriptionEP4QPDFNSt3__110shared_ptrIS_EERKNS2_17basic_string_viewIcNS2_11char_traitsIcEEEENS2_12basic_stringIcS7_NS2_9allocatorIcEEEE:
  436|   320k|    {
  437|   320k|        object_description =
  438|   320k|            std::make_shared<Description>(ChildDescr(parent, static_descr, var_descr));
  439|   320k|        qpdf = a_qpdf;
  440|   320k|    }
_ZN10QPDFObject14hasDescriptionEv:
  444|  57.0k|    {
  445|  57.0k|        return object_description || og.isIndirect();
  ------------------
  |  Branch (445:16): [True: 36.6k, False: 20.3k]
  |  Branch (445:38): [True: 0, False: 20.3k]
  ------------------
  446|  57.0k|    }
_ZN10QPDFObject15setParsedOffsetEx:
  449|  23.3M|    {
  450|  23.3M|        if (parsed_offset < 0) {
  ------------------
  |  Branch (450:13): [True: 23.3M, False: 0]
  ------------------
  451|  23.3M|            parsed_offset = offset;
  452|  23.3M|        }
  453|  23.3M|    }
_ZN10QPDFObject7getQPDFEv:
  456|   732k|    {
  457|   732k|        return qpdf;
  458|   732k|    }
_ZN10QPDFObject9getObjGenEv:
  461|  1.13M|    {
  462|  1.13M|        return og;
  463|  1.13M|    }
_ZN10QPDF_ArrayC2Ev:
   52|    471|    QPDF_Array() = default;
_ZN10QPDFObjectC2I15QPDF_DictionaryEEOT_:
  300|   350k|        value(std::forward<T>(value))
  301|   350k|    {
  302|   350k|    }
_ZN10QPDFObjectC2I9QPDF_BoolEEOT_:
  300|  21.0k|        value(std::forward<T>(value))
  301|  21.0k|    {
  302|  21.0k|    }
_ZN10QPDFObjectC2I12QPDF_IntegerEEOT_:
  300|  2.96M|        value(std::forward<T>(value))
  301|  2.96M|    {
  302|  2.96M|    }
_ZN10QPDFObjectC2I9QPDF_RealEEOT_:
  300|   343k|        value(std::forward<T>(value))
  301|   343k|    {
  302|   343k|    }
_ZN10QPDFObjectC2I11QPDF_StringEEOT_:
  300|   482k|        value(std::forward<T>(value))
  301|   482k|    {
  302|   482k|    }
_ZN10QPDFObjectC2I9QPDF_NameEEOT_:
  300|  2.27M|        value(std::forward<T>(value))
  301|  2.27M|    {
  302|  2.27M|    }
_ZN10QPDFObjectC2I10QPDF_ArrayEEOT_:
  300|   216k|        value(std::forward<T>(value))
  301|   216k|    {
  302|   216k|    }
_ZN10QPDF_ArrayC2EOS_:
   58|   218k|    QPDF_Array(QPDF_Array&&) = default;
_ZN10QPDFObjectC2I13QPDF_OperatorEEOT_:
  300|  17.4M|        value(std::forward<T>(value))
  301|  17.4M|    {
  302|  17.4M|    }
_ZN10QPDFObject6createI11QPDF_StreamJ16QPDFObjectHandleRmEEENSt3__110shared_ptrIS_EEP4QPDF10QPDFObjGenDpOT0_:
  318|  52.6k|    {
  319|  52.6k|        return std::make_shared<QPDFObject>(
  320|  52.6k|            qpdf, og, std::forward<T>(T(std::forward<Args>(args)...)));
  321|  52.6k|    }
_ZN10QPDFObjectC2I11QPDF_StreamEEP4QPDF10QPDFObjGenOT_:
  306|  52.6k|        value(std::forward<T>(value)),
  307|  52.6k|        qpdf(qpdf),
  308|  52.6k|        og(og)
  309|  52.6k|    {
  310|  52.6k|    }
_ZN10QPDF_ArrayaSEOS_:
   59|    100|    QPDF_Array& operator=(QPDF_Array&&) = default;
_ZN10QPDFObject6createI15QPDF_UnresolvedJEEENSt3__110shared_ptrIS_EEP4QPDF10QPDFObjGenDpOT0_:
  318|   307k|    {
  319|   307k|        return std::make_shared<QPDFObject>(
  320|   307k|            qpdf, og, std::forward<T>(T(std::forward<Args>(args)...)));
  321|   307k|    }
_ZN10QPDFObjectC2I15QPDF_UnresolvedEEP4QPDF10QPDFObjGenOT_:
  306|   307k|        value(std::forward<T>(value)),
  307|   307k|        qpdf(qpdf),
  308|   307k|        og(og)
  309|   307k|    {
  310|   307k|    }

_ZN4qpdf4impl6Parser16make_descriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  110|   194k|        {
  111|   194k|            using namespace std::literals;
  112|   194k|            return std::make_shared<QPDFObject::Description>(
  113|   194k|                input_name + ", " + object_description + " at offset $PO");
  114|   194k|        }
_ZN4qpdf4impl6ParserC2ER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERKSC_RNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterEP4QPDFbiib:
  139|  17.0M|            input_(input),
  140|  17.0M|            object_description_(object_description),
  141|  17.0M|            tokenizer_(tokenizer),
  142|  17.0M|            decrypter_(decrypter),
  143|  17.0M|            context_(context),
  144|  17.0M|            description_(std::move(sp_description)),
  145|  17.0M|            parse_pdf_(parse_pdf),
  146|  17.0M|            stream_id_(stream_id),
  147|  17.0M|            obj_id_(obj_id),
  148|  17.0M|            sanity_checks_(sanity_checks)
  149|  17.0M|        {
  150|  17.0M|        }
_ZN4qpdf4impl6Parser10StackFrameC2ER11InputSourceNS1_14parser_state_eE:
  160|   526k|                state(state),
  161|   526k|                offset(input.tell())
  162|   526k|            {
  163|   526k|            }
_ZN4qpdf4impl6Parser5ErrorC2Ev:
   31|  10.6k|            Error() = default;

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  28.2M|        {
   65|  28.2M|            return this->type;
   66|  28.2M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  25.9M|        {
   70|  25.9M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 3.00M, False: 22.9M]
  |  Branch (70:61): [True: 319k, False: 22.6M]
  ------------------
   71|  25.9M|                ? this->val
   72|  25.9M|                : this->raw_val;
   73|  25.9M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  59.3k|        {
   82|  59.3k|            return this->error_message;
   83|  59.3k|        }

_ZN4QPDF3DocC2ERS_PNS_7MembersE:
  351|  25.9k|        qpdf(qpdf),
  352|  25.9k|        m(m)
  353|  25.9k|    {
  354|  25.9k|    }
_ZN4qpdf3Doc6ConfigC2Ev:
   43|  25.9k|                log_(QPDFLogger::defaultLogger())
   44|  25.9k|            {
   45|  25.9k|            }
_ZN4QPDF3Doc6CommonC2ERS_PNS_7MembersE:
 1285|   122k|    qpdf(qpdf),
 1286|   122k|    m(m),
 1287|   122k|    cf(m->cf),
 1288|   122k|    pages(m->pages),
 1289|   122k|    objects(m->objects)
 1290|   122k|{
 1291|   122k|}
_ZN4QPDF3Doc13LinearizationC2ERS0_:
  601|  25.9k|        Common(doc)
  602|  25.9k|    {
  603|  25.9k|    }
_ZN4QPDF3Doc6CommonC2ERS0_:
 1294|  96.7k|    Common(doc.qpdf, doc.m)
 1295|  96.7k|{
 1296|  96.7k|}
_ZN4QPDF3Doc7ObjectsC2ERS0_:
  995|  25.9k|        Common(doc),
  996|  25.9k|        foreign_(*this),
  997|  25.9k|        streams_(*this)
  998|  25.9k|    {
  999|  25.9k|    }
_ZN4QPDF3Doc7Objects7ForeignC2ERNS0_6CommonE:
  910|  25.9k|            Common(common)
  911|  25.9k|        {
  912|  25.9k|        }
_ZN4QPDF3Doc7Objects7ForeignD2Ev:
  919|  25.9k|        ~Foreign() = default;
_ZN4QPDF3Doc5PagesC2ERS0_:
 1138|  25.9k|        Common(doc)
 1139|  25.9k|    {
 1140|  25.9k|    }
_ZN4QPDF3Doc5PagesD2Ev:
 1135|  25.9k|    ~Pages() = default;
_ZN4QPDF3Doc7ObjectsD2Ev:
  992|  25.9k|    ~Objects() = default;
_ZN4QPDF3Doc7Objects7StreamsD2Ev:
  948|  25.9k|        ~Streams() = default;
_ZN4QPDF3Doc13LinearizationD2Ev:
  598|  25.9k|    ~Linearization() = default;
_ZN4QPDF3DocD2Ev:
  348|  25.9k|    ~Doc() = default;
_ZN4qpdf3Doc6Config12max_warningsEm:
  107|  9.83k|            {
  108|  9.83k|                max_warnings_ = val;
  109|  9.83k|                return *this;
  110|  9.83k|            }
_ZNK4qpdf3Doc6Config3logEv:
   75|  1.02M|            {
   76|  1.02M|                return log_;
   77|  1.02M|            }
_ZNK4qpdf3Doc6Config12max_warningsEv:
  101|  1.95M|            {
  102|  1.95M|                return max_warnings_;
  103|  1.95M|            }
_ZNK4qpdf3Doc6Config17suppress_warningsEv:
   88|  1.02M|            {
   89|  1.02M|                return suppress_warnings_;
   90|  1.02M|            }
_ZN4QPDF3docEv:
 1324|  16.9M|{
 1325|  16.9M|    return *m;
 1326|  16.9M|}
_ZN4QPDF3Doc8Resolver8resolvedEPS_10QPDFObjGen:
 1279|   297k|    {
 1280|   297k|        return qpdf->m->objects.resolve(og);
 1281|   297k|    }
_ZNK4QPDF3Doc7Objects12root_checkedEv:
 1027|   144k|    {
 1028|   144k|        return root_checked_;
 1029|   144k|    }
_ZN4QPDF3Doc7Objects12root_checkedEb:
 1033|  11.5k|    {
 1034|  11.5k|        root_checked_ = val;
 1035|  11.5k|    }
_ZN4QPDF20EncryptionParametersC2Ev:
  191|  25.9k|    EncryptionParameters() = default;
_ZN4QPDF7MembersD2Ev:
 1238|  25.9k|    ~Members() = default;
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  11.1k|    {
  241|  11.1k|        qpdf->decryptString(val, og);
  242|  11.1k|    }
_ZNK4qpdf3Doc6Config19password_is_hex_keyEv:
   49|  1.24k|            {
   50|  1.24k|                return password_is_hex_key_;
   51|  1.24k|            }
_ZNK4qpdf3Doc6Config19ignore_xref_streamsEv:
   62|  11.2k|            {
   63|  11.2k|                return ignore_xref_streams_;
   64|  11.2k|            }
_ZNK4qpdf3Doc6Config17surpress_recoveryEv:
  114|   199k|            {
  115|   199k|                return surpress_recovery_;
  116|   199k|            }
_ZNK4qpdf3Doc6Config19immediate_copy_fromEv:
  127|    411|            {
  128|    411|                return immediate_copy_from_;
  129|    411|            }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  175|   400k|        object(std::move(object)),
  176|   400k|        end_before_space(end_before_space),
  177|   400k|        end_after_space(end_after_space)
  178|   400k|    {
  179|   400k|    }
_ZN4QPDF20EncryptionParameters1REv:
  204|  4.36k|    {
  205|  4.36k|        return R_;
  206|  4.36k|    }
_ZN4QPDF3Doc6configEv:
  358|    411|    {
  359|    411|        return cf;
  360|    411|    }
_ZN4QPDF3Doc8acroformEv:
  400|  9.16k|    {
  401|  9.16k|        if (!acroform_) {
  ------------------
  |  Branch (401:13): [True: 9.16k, False: 0]
  ------------------
  402|  9.16k|            no_inspection();
  403|  9.16k|            init_acroform();
  404|  9.16k|        }
  405|  9.16k|        return *acroform_;
  406|  9.16k|    }
_ZN4QPDF3Doc13no_inspectionEv:
  451|  9.16k|    {
  452|  9.16k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (452:13): [True: 0, False: 9.16k]
  ------------------
  453|      0|            throw std::logic_error("Attempted unsupported operation in inspection mode");
  454|      0|        }
  455|  9.16k|    }
_ZN4QPDF3Doc10EncryptionC2EiiiiRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_SA_SA_SA_b:
  490|  1.24k|        V(V),
  491|  1.24k|        R(R),
  492|  1.24k|        Length_bytes(Length_bytes),
  493|  1.24k|        P(static_cast<unsigned long long>(P)),
  494|  1.24k|        O(O),
  495|  1.24k|        U(U),
  496|  1.24k|        OE(OE),
  497|  1.24k|        UE(UE),
  498|  1.24k|        Perms(Perms),
  499|  1.24k|        id1(id1),
  500|  1.24k|        encrypt_metadata(encrypt_metadata)
  501|  1.24k|    {
  502|  1.24k|    }
_ZN4QPDF3Doc7Objects7Streams14pipeStreamDataEPS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  962|  28.0k|        {
  963|  28.0k|            return qpdf->pipeStreamData(
  964|  28.0k|                og,
  965|  28.0k|                offset,
  966|  28.0k|                length,
  967|  28.0k|                dict,
  968|  28.0k|                is_root_metadata,
  969|  28.0k|                pipeline,
  970|  28.0k|                suppress_warnings,
  971|  28.0k|                will_retry);
  972|  28.0k|        }
_ZN4QPDF3Doc7Objects7Streams6copierEv:
  976|    798|        {
  977|    798|            return copier_;
  978|    798|        }
_ZN4QPDF3Doc7Objects7streamsEv:
 1009|    411|    {
 1010|    411|        return streams_;
 1011|    411|    }
_ZN4QPDF3Doc5Pages3allEv:
 1144|  73.5k|    {
 1145|  73.5k|        return !all_pages.empty() ? all_pages : cache();
  ------------------
  |  Branch (1145:16): [True: 56.4k, False: 17.0k]
  ------------------
 1146|  73.5k|    }
_ZN4QPDF3Doc5Pages5emptyEv:
 1150|  26.1k|    {
 1151|  26.1k|        return all().empty();
 1152|  26.1k|    }
_ZN4QPDF3Doc5Pages5beginEv:
 1162|  19.1k|    {
 1163|  19.1k|        return all().cbegin();
 1164|  19.1k|    }
_ZN4QPDF3Doc5Pages3endEv:
 1168|  19.1k|    {
 1169|  19.1k|        return all().cend();
 1170|  19.1k|    }
_ZN4QPDF3Doc7objectsEv:
 1306|    411|{
 1307|    411|    return m->objects;
 1308|    411|};
_ZN4QPDF3Doc5pagesEv:
 1312|  21.3k|{
 1313|  21.3k|    return m->pages;
 1314|  21.3k|}
_ZNK4QPDF3Doc18reconstructed_xrefEv:
 1318|  16.8M|{
 1319|  16.8M|    return m->reconstructed_xref;
 1320|  16.8M|}
_ZN4QPDF3Doc6Common3toOImEExRKT_:
  313|  2.07M|        {
  314|  2.07M|            return QIntC::to_offset(i);
  315|  2.07M|        }
_ZN4QPDF3Doc6Common3toIIlEEiRKT_:
  325|  8.32k|        {
  326|  8.32k|            return QIntC::to_int(i);
  327|  8.32k|        }
_ZN4QPDF3Doc6Common3toIIxEEiRKT_:
  325|  3.28M|        {
  326|  3.28M|            return QIntC::to_int(i);
  327|  3.28M|        }
_ZN4QPDF3Doc6Common3toSIiEEmRKT_:
  319|  12.0k|        {
  320|  12.0k|            return QIntC::to_size(i);
  321|  12.0k|        }
_ZN4QPDF3Doc6Common3toSIyEEmRKT_:
  319|  18.1k|        {
  320|  18.1k|            return QIntC::to_size(i);
  321|  18.1k|        }
_ZN4QPDF3Doc6Common3toSIxEEmRKT_:
  319|  22.4k|        {
  320|  22.4k|            return QIntC::to_size(i);
  321|  22.4k|        }
_ZN4QPDF8ObjCacheC2Ev:
  170|  93.3k|    ObjCache() = default;
_ZN4QPDF3Doc6Common3toIImEEiRKT_:
  325|  60.5k|        {
  326|  60.5k|            return QIntC::to_int(i);
  327|  60.5k|        }

_ZN16SF_ASCII85Decode7factoryEv:
   23|  3.80k|    {
   24|  3.80k|        return std::make_shared<SF_ASCII85Decode>();
   25|  3.80k|    }
_ZN16SF_ASCII85DecodeC2Ev:
   11|  3.80k|    SF_ASCII85Decode() = default;
_ZN16SF_ASCII85DecodeD2Ev:
   12|  3.80k|    ~SF_ASCII85Decode() override = default;
_ZN16SF_ASCII85Decode17getDecodePipelineEP8Pipeline:
   16|  3.72k|    {
   17|  3.72k|        this->pipeline = std::make_shared<Pl_ASCII85Decoder>("ascii85 decode", next);
   18|  3.72k|        return this->pipeline.get();
   19|  3.72k|    }

_ZN17SF_ASCIIHexDecode7factoryEv:
   23|    620|    {
   24|    620|        return std::make_shared<SF_ASCIIHexDecode>();
   25|    620|    }
_ZN17SF_ASCIIHexDecodeC2Ev:
   11|    620|    SF_ASCIIHexDecode() = default;
_ZN17SF_ASCIIHexDecodeD2Ev:
   12|    620|    ~SF_ASCIIHexDecode() override = default;
_ZN17SF_ASCIIHexDecode17getDecodePipelineEP8Pipeline:
   16|    505|    {
   17|    505|        this->pipeline = std::make_shared<Pl_ASCIIHexDecoder>("asciiHex decode", next);
   18|    505|        return this->pipeline.get();
   19|    505|    }

_ZN12SF_DCTDecode7factoryEv:
   23|    831|    {
   24|    831|        return std::make_shared<SF_DCTDecode>();
   25|    831|    }
_ZN12SF_DCTDecodeC2Ev:
   11|    831|    SF_DCTDecode() = default;
_ZN12SF_DCTDecodeD2Ev:
   12|    831|    ~SF_DCTDecode() override = default;
_ZN12SF_DCTDecode17getDecodePipelineEP8Pipeline:
   16|    551|    {
   17|    551|        this->pipeline = std::make_shared<Pl_DCT>("DCT decode", next);
   18|    551|        return this->pipeline.get();
   19|    551|    }
_ZN12SF_DCTDecode18isLossyCompressionEv:
   35|     20|    {
   36|     20|        return true;
   37|     20|    }

_ZN17SF_FlateLzwDecode13flate_factoryEv:
   22|  23.0k|    {
   23|  23.0k|        return std::make_shared<SF_FlateLzwDecode>(false);
   24|  23.0k|    }
_ZN17SF_FlateLzwDecodeC2Eb:
   12|  27.7k|        lzw(lzw)
   13|  27.7k|    {
   14|  27.7k|    }
_ZN17SF_FlateLzwDecodeD2Ev:
   15|  27.7k|    ~SF_FlateLzwDecode() final = default;
_ZN17SF_FlateLzwDecode11lzw_factoryEv:
   27|  4.66k|    {
   28|  4.66k|        return std::make_shared<SF_FlateLzwDecode>(true);
   29|  4.66k|    }

_ZN18SF_RunLengthDecode7factoryEv:
   24|  12.4k|    {
   25|  12.4k|        return std::make_shared<SF_RunLengthDecode>();
   26|  12.4k|    }
_ZN18SF_RunLengthDecodeC2Ev:
   11|  12.4k|    SF_RunLengthDecode() = default;
_ZN18SF_RunLengthDecodeD2Ev:
   12|  12.4k|    ~SF_RunLengthDecode() override = default;
_ZN18SF_RunLengthDecode17getDecodePipelineEP8Pipeline:
   16|  12.1k|    {
   17|  12.1k|        this->pipeline =
   18|  12.1k|            std::make_shared<Pl_RunLength>("runlength decode", next, Pl_RunLength::a_decode);
   19|  12.1k|        return this->pipeline.get();
   20|  12.1k|    }

_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  9.03M|    {
   37|  9.03M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 9.03M]
  ------------------
   38|      0|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      0|                                       .append(
   40|      0|                                           "\nThis is a qpdf bug. Please report at "
   41|      0|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      0|        }
   43|  9.03M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|   136k|    {
   28|   136k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 136k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   136k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|   114M|    {
  100|   114M|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 107M, False: 7.47M]
  |  Branch (100:32): [True: 104M, False: 2.09M]
  ------------------
  101|   114M|            ? char(digit - '0')
  102|   114M|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 7.20M, False: 2.36M]
  ------------------
  103|  9.57M|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 111k, False: 2.25M]
  ------------------
  104|   114M|    }
_ZN4qpdf4util8is_spaceEc:
  114|  60.8M|    {
  115|  60.8M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 9.27M, False: 51.5M]
  |  Branch (115:29): [True: 1.09M, False: 50.4M]
  |  Branch (115:43): [True: 205k, False: 50.2M]
  |  Branch (115:57): [True: 414k, False: 49.8M]
  |  Branch (115:71): [True: 121k, False: 49.7M]
  |  Branch (115:85): [True: 71.4k, False: 49.6M]
  ------------------
  116|  60.8M|    }
_ZN4qpdf4util8is_digitEc:
  120|  14.6M|    {
  121|  14.6M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 8.90M, False: 5.73M]
  |  Branch (121:30): [True: 8.62M, False: 278k]
  ------------------
  122|  14.6M|    }
_ZN4qpdf4util15hex_encode_charEc:
  127|   125M|    {
  128|   125M|        static auto constexpr hexchars = "0123456789abcdef";
  129|   125M|        return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  130|   125M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   623k|    {
  150|   623k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 83.4k, False: 539k]
  |  Branch (150:47): [True: 4.28k, False: 535k]
  ------------------
  151|   623k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   535k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   535k|        return str.starts_with("\xef\xbb\xbf");
  158|   535k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|  99.9k|    {
   28|  99.9k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 99.9k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  99.9k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   260k|    {
   28|   260k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 260k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   260k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|  97.2k|    {
   28|  97.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 97.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  97.2k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|  3.72k|    {
   28|  3.72k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.72k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.72k|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|  1.12k|    {
   28|  1.12k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.12k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.12k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  25.9k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  25.9k|                          std::numeric_limits<T>::min())) {
   67|  25.9k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 25.9k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  25.9k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  25.9k|                          std::numeric_limits<T>::max())) {
   74|  25.9k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 25.9k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  25.9k|        }
   78|  25.9k|        return true;
   79|  25.9k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  25.9k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  25.9k|                          std::numeric_limits<T>::min())) {
   67|  25.9k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 25.9k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  25.9k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  25.9k|        return true;
   79|  25.9k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|   109k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|       |                          std::numeric_limits<T>::min())) {
   67|       |            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
   68|       |                return false;
   69|       |            }
   70|       |        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|   109k|                          std::numeric_limits<T>::max())) {
   74|   109k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 109k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|   109k|        }
   78|   109k|        return true;
   79|   109k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   950k|    {
   28|   950k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 950k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   950k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  4.16k|    {
   28|  4.16k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.16k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.16k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  4.89k|    {
   28|  4.89k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.89k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.89k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|  34.1M|    {
   37|  34.1M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 3, False: 34.1M]
  ------------------
   38|      3|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      3|                                       .append(
   40|      3|                                           "\nThis is a qpdf bug. Please report at "
   41|      3|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      3|        }
   43|  34.1M|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  5.76k|    {
   28|  5.76k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.76k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.76k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.50k|    {
   28|  2.50k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.50k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.50k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  6.51k|    {
   28|  6.51k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 6.51k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  6.51k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  6.90k|    {
   28|  6.90k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 6.90k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  6.90k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  1.68M|    {
   49|  1.68M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 1.68M]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|  1.68M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   368k|    {
   28|   368k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 368k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   368k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|   697k|    {
   49|   697k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 8, False: 697k]
  ------------------
   50|      8|            throw std::runtime_error(std::forward<T>(msg));
   51|      8|        }
   52|   697k|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  51.9M|    {
   28|  51.9M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 51.9M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  51.9M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  3.55k|    {
   49|  3.55k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 45, False: 3.51k]
  ------------------
   50|     45|            throw std::runtime_error(std::forward<T>(msg));
   51|     45|        }
   52|  3.55k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    505|    {
   28|    505|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 505]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    505|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  27.5k|    {
   28|  27.5k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 27.5k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  27.5k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA73_KcEEvbOT_:
   48|     76|    {
   49|     76|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 76]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|     76|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|  2.31k|    {
   28|  2.31k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.31k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.31k|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  6.60k|    {
   49|  6.60k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 6.60k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  6.60k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  24.8k|    {
   49|  24.8k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 24.8k]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|  24.8k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|  81.2k|    {
   49|  81.2k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 81.2k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  81.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  3.29k|    {
   49|  3.29k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 3.29k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  3.29k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  3.09k|    {
   49|  3.09k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 3.09k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  3.09k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.94k|    {
   49|  1.94k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.94k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.94k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.94k|    {
   49|  1.94k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.94k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.94k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.94k|    {
   49|  1.94k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 8, False: 1.93k]
  ------------------
   50|      8|            throw std::runtime_error(std::forward<T>(msg));
   51|      8|        }
   52|  1.94k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  95.7k|    {
   49|  95.7k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 30, False: 95.7k]
  ------------------
   50|     30|            throw std::runtime_error(std::forward<T>(msg));
   51|     30|        }
   52|  95.7k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|   181k|    {
   28|   181k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 181k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   181k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|  1.13k|    {
   28|  1.13k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.13k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.13k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|  1.13k|    {
   49|  1.13k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.13k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.13k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|  1.12k|    {
   49|  1.12k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.12k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.12k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|  1.12k|    {
   49|  1.12k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 12, False: 1.11k]
  ------------------
   50|     12|            throw std::runtime_error(std::forward<T>(msg));
   51|     12|        }
   52|  1.12k|    }

BitStream.cc:_ZL9read_bitsRPKhRmS2_m:
   21|   678k|{
   22|       |    // View p as a stream of bits:
   23|       |
   24|       |    // 76543210 76543210 ....
   25|       |
   26|       |    // bit_offset is the bit number within the first byte that marks
   27|       |    // the first bit that we would read.
   28|       |
   29|   678k|    if (bits_wanted > bits_available) {
  ------------------
  |  Branch (29:9): [True: 0, False: 678k]
  ------------------
   30|      0|        throw std::runtime_error(
   31|      0|            "overflow reading bit stream: wanted = " + std::to_string(bits_wanted) +
   32|      0|            "; available = " + std::to_string(bits_available));
   33|      0|    }
   34|   678k|    if (bits_wanted > 32) {
  ------------------
  |  Branch (34:9): [True: 46, False: 678k]
  ------------------
   35|     46|        throw std::out_of_range("read_bits: too many bits requested");
   36|     46|    }
   37|       |
   38|   678k|    unsigned long result = 0;
   39|       |# ifdef BITS_TESTING
   40|       |    if (bits_wanted == 0) {
   41|       |        QTC::TC("libtests", "bits zero bits wanted");
   42|       |    }
   43|       |# endif
   44|  2.88M|    while (bits_wanted > 0) {
  ------------------
  |  Branch (44:12): [True: 2.20M, False: 678k]
  ------------------
   45|       |        // Grab bits from the first byte clearing anything before
   46|       |        // bit_offset.
   47|  2.20M|        unsigned char byte = static_cast<unsigned char>(*p & ((1U << (bit_offset + 1U)) - 1U));
   48|       |
   49|       |        // There are bit_offset + 1 bits available in the first byte.
   50|  2.20M|        size_t to_copy = std::min(bits_wanted, bit_offset + 1);
   51|  2.20M|        size_t leftover = (bit_offset + 1) - to_copy;
   52|       |
   53|       |# ifdef BITS_TESTING
   54|       |        QTC::TC("libtests", "bits bit_offset", ((bit_offset == 0) ? 0 : (bit_offset == 7) ? 1 : 2));
   55|       |        QTC::TC("libtests", "bits leftover", (leftover > 0) ? 1 : 0);
   56|       |# endif
   57|       |
   58|       |        // Right shift so that all the bits we want are right justified.
   59|  2.20M|        byte = static_cast<unsigned char>(byte >> leftover);
   60|       |
   61|       |        // Copy the bits into result
   62|  2.20M|        result <<= to_copy;
   63|  2.20M|        result |= byte;
   64|       |
   65|       |        // Update pointers
   66|  2.20M|        if (leftover) {
  ------------------
  |  Branch (66:13): [True: 371k, False: 1.83M]
  ------------------
   67|   371k|            bit_offset = leftover - 1;
   68|  1.83M|        } else {
   69|  1.83M|            bit_offset = 7;
   70|  1.83M|            ++p;
   71|  1.83M|        }
   72|  2.20M|        bits_wanted -= to_copy;
   73|  2.20M|        bits_available -= to_copy;
   74|       |
   75|       |# ifdef BITS_TESTING
   76|       |        QTC::TC("libtests", "bits iterations", ((bits_wanted > 8) ? 0 : (bits_wanted > 0) ? 1 : 2));
   77|       |# endif
   78|  2.20M|    }
   79|       |
   80|   678k|    return result;
   81|   678k|}
BitWriter.cc:_ZL10write_bitsRhRmymP8Pipeline:
   88|   679k|{
   89|   679k|    if (bits > 32) {
  ------------------
  |  Branch (89:9): [True: 0, False: 679k]
  ------------------
   90|      0|        throw std::out_of_range("write_bits: too many bits requested");
   91|      0|    }
   92|       |
   93|       |    // bit_offset + 1 is the number of bits left in ch
   94|       |# ifdef BITS_TESTING
   95|       |    if (bits == 0) {
   96|       |        QTC::TC("libtests", "bits write zero bits");
   97|       |    }
   98|       |# endif
   99|  2.88M|    while (bits > 0) {
  ------------------
  |  Branch (99:12): [True: 2.20M, False: 679k]
  ------------------
  100|  2.20M|        size_t bits_to_write = std::min(bits, bit_offset + 1);
  101|  2.20M|        unsigned char newval = static_cast<unsigned char>(
  102|  2.20M|            (val >> (bits - bits_to_write)) & ((1U << bits_to_write) - 1));
  103|  2.20M|        size_t bits_left_in_ch = bit_offset + 1 - bits_to_write;
  104|  2.20M|        newval = static_cast<unsigned char>(newval << bits_left_in_ch);
  105|  2.20M|        ch |= newval;
  106|  2.20M|        if (bits_left_in_ch == 0) {
  ------------------
  |  Branch (106:13): [True: 1.83M, False: 371k]
  ------------------
  107|       |# ifdef BITS_TESTING
  108|       |            QTC::TC("libtests", "bits write pipeline");
  109|       |# endif
  110|  1.83M|            pipeline->write(&ch, 1);
  111|  1.83M|            bit_offset = 7;
  112|  1.83M|            ch = 0;
  113|  1.83M|        } else {
  114|       |# ifdef BITS_TESTING
  115|       |            QTC::TC("libtests", "bits write leftover");
  116|       |# endif
  117|   371k|            bit_offset -= bits_to_write;
  118|   371k|        }
  119|  2.20M|        bits -= bits_to_write;
  120|       |# ifdef BITS_TESTING
  121|       |        QTC::TC("libtests", "bits write iterations", ((bits > 8) ? 0 : (bits > 0) ? 1 : 2));
  122|       |# endif
  123|  2.20M|    }
  124|   679k|}

_ZN4qpdf6global6Limits16doc_max_warningsEv:
   22|  25.9k|        {
   23|  25.9k|            return l.doc_max_warnings_;
   24|  25.9k|        }
_ZN4qpdf6global7Options15inspection_modeEv:
  197|  36.9k|        {
  198|  36.9k|            return static_cast<bool>(o.inspection_mode_);
  199|  36.9k|        }
_ZN4qpdf6global6Limits16doc_max_warningsEj:
   28|  25.9k|        {
   29|  25.9k|            l.doc_max_warnings_ = value;
   30|  25.9k|        }
_ZN4qpdf6global6Limits18parser_max_nestingEv:
   34|      2|        {
   35|      2|            return l.parser_max_nesting_;
   36|      2|        }
_ZN4qpdf6global6Limits17parser_max_errorsEv:
   46|  17.0M|        {
   47|  17.0M|            return l.parser_max_errors_;
   48|  17.0M|        }
_ZN4qpdf6global6Limits25parser_max_container_sizeEb:
   59|  3.82M|        {
   60|  3.82M|            return damaged ? l.parser_max_container_size_damaged_ : l.parser_max_container_size_;
  ------------------
  |  Branch (60:20): [True: 3.77M, False: 53.2k]
  ------------------
   61|  3.82M|        }
_ZN4qpdf6global6Limits18max_stream_filtersEv:
   67|  19.7k|        {
   68|  19.7k|            return l.max_stream_filters_;
   69|  19.7k|        }
_ZN4qpdf6global6Limits14dct_max_memoryEv:
   80|      2|        {
   81|      2|            return l.dct_max_memory_;
   82|      2|        }
_ZN4qpdf6global6Limits14dct_max_memoryEl:
   86|  25.9k|        {
   87|  25.9k|            l.dct_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (87:33): [True: 25.9k, False: 0]
  ------------------
   88|  25.9k|        }
_ZN4qpdf6global6Limits25dct_max_progressive_scansEv:
   92|      2|        {
   93|      2|            return l.dct_max_progressive_scans_;
   94|      2|        }
_ZN4qpdf6global6Limits25dct_max_progressive_scansEi:
   98|  25.9k|        {
   99|  25.9k|            l.dct_max_progressive_scans_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (99:44): [True: 25.9k, False: 0]
  ------------------
  100|  25.9k|        }
_ZN4qpdf6global6Limits16flate_max_memoryEv:
  104|      2|        {
  105|      2|            return l.flate_max_memory_;
  106|      2|        }
_ZN4qpdf6global6Limits16flate_max_memoryEy:
  110|  25.9k|        {
  111|  25.9k|            l.flate_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (111:35): [True: 25.9k, False: 0]
  ------------------
  112|  25.9k|        }
_ZN4qpdf6global6Limits14png_max_memoryEv:
  116|      2|        {
  117|      2|            return l.png_max_memory_;
  118|      2|        }
_ZN4qpdf6global6Limits14png_max_memoryEy:
  122|  25.9k|        {
  123|  25.9k|            l.png_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (123:33): [True: 25.9k, False: 0]
  ------------------
  124|  25.9k|        }
_ZN4qpdf6global6Limits21run_length_max_memoryEv:
  128|      2|        {
  129|      2|            return l.run_length_max_memory_;
  130|      2|        }
_ZN4qpdf6global6Limits21run_length_max_memoryEy:
  134|  25.9k|        {
  135|  25.9k|            l.run_length_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (135:40): [True: 25.9k, False: 0]
  ------------------
  136|  25.9k|        }
_ZN4qpdf6global6Limits15tiff_max_memoryEv:
  140|      2|        {
  141|      2|            return l.tiff_max_memory_;
  142|      2|        }
_ZN4qpdf6global6Limits15tiff_max_memoryEy:
  146|  25.9k|        {
  147|  25.9k|            l.tiff_max_memory_ = util::fits<uint32_t>(value) ? value : 0;
  ------------------
  |  Branch (147:34): [True: 25.9k, False: 0]
  ------------------
  148|  25.9k|        }
_ZN4qpdf6global6Limits5errorEv:
  153|  2.61k|        {
  154|  2.61k|            if (l.errors_ < std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (154:17): [True: 2.61k, False: 0]
  ------------------
  155|  2.61k|                ++l.errors_;
  156|  2.61k|            }
  157|  2.61k|        }
_ZN4qpdf6global7Options25dct_throw_on_corrupt_dataEv:
  234|      2|        {
  235|      2|            return o.dct_throw_on_corrupt_data_;
  236|      2|        }
_ZN4qpdf6global7Options25dct_throw_on_corrupt_dataEb:
  240|  25.9k|        {
  241|  25.9k|            o.dct_throw_on_corrupt_data_ = value;
  242|  25.9k|        }

_Z20rijndaelSetupEncryptPjPKhm:
  715|   187k|{
  716|   187k|  int i = 0;
  717|   187k|  u32 temp;
  718|       |
  719|   187k|  rk[0] = GETU32(key     );
  ------------------
  |  |  698|   187k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   187k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   187k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   187k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  720|   187k|  rk[1] = GETU32(key +  4);
  ------------------
  |  |  698|   187k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   187k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   187k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   187k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  721|   187k|  rk[2] = GETU32(key +  8);
  ------------------
  |  |  698|   187k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   187k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   187k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   187k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  722|   187k|  rk[3] = GETU32(key + 12);
  ------------------
  |  |  698|   187k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   187k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   187k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   187k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  723|   187k|  if (keybits == 128)
  ------------------
  |  Branch (723:7): [True: 181k, False: 5.72k]
  ------------------
  724|   181k|  {
  725|   181k|    for (;;)
  726|  1.81M|    {
  727|  1.81M|      temp  = rk[3];
  728|  1.81M|      rk[4] = rk[0] ^
  729|  1.81M|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  730|  1.81M|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  731|  1.81M|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  732|  1.81M|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  733|  1.81M|        rcon[i];
  734|  1.81M|      rk[5] = rk[1] ^ rk[4];
  735|  1.81M|      rk[6] = rk[2] ^ rk[5];
  736|  1.81M|      rk[7] = rk[3] ^ rk[6];
  737|  1.81M|      if (++i == 10)
  ------------------
  |  Branch (737:11): [True: 181k, False: 1.63M]
  ------------------
  738|   181k|        return 10;
  739|  1.63M|      rk += 4;
  740|  1.63M|    }
  741|   181k|  }
  742|  5.72k|  rk[4] = GETU32(key + 16);
  ------------------
  |  |  698|  5.72k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.72k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.72k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.72k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  743|  5.72k|  rk[5] = GETU32(key + 20);
  ------------------
  |  |  698|  5.72k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.72k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.72k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.72k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  744|  5.72k|  if (keybits == 192)
  ------------------
  |  Branch (744:7): [True: 0, False: 5.72k]
  ------------------
  745|      0|  {
  746|      0|    for (;;)
  747|      0|    {
  748|      0|      temp = rk[ 5];
  749|      0|      rk[ 6] = rk[ 0] ^
  750|      0|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  751|      0|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  752|      0|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  753|      0|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  754|      0|        rcon[i];
  755|      0|      rk[ 7] = rk[ 1] ^ rk[ 6];
  756|      0|      rk[ 8] = rk[ 2] ^ rk[ 7];
  757|      0|      rk[ 9] = rk[ 3] ^ rk[ 8];
  758|      0|      if (++i == 8)
  ------------------
  |  Branch (758:11): [True: 0, False: 0]
  ------------------
  759|      0|        return 12;
  760|      0|      rk[10] = rk[ 4] ^ rk[ 9];
  761|      0|      rk[11] = rk[ 5] ^ rk[10];
  762|      0|      rk += 6;
  763|      0|    }
  764|      0|  }
  765|  5.72k|  rk[6] = GETU32(key + 24);
  ------------------
  |  |  698|  5.72k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.72k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.72k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.72k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  766|  5.72k|  rk[7] = GETU32(key + 28);
  ------------------
  |  |  698|  5.72k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.72k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.72k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.72k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  767|  5.72k|  if (keybits == 256)
  ------------------
  |  Branch (767:7): [True: 5.72k, False: 0]
  ------------------
  768|  5.72k|  {
  769|  5.72k|    for (;;)
  770|  40.0k|    {
  771|  40.0k|      temp = rk[ 7];
  772|  40.0k|      rk[ 8] = rk[ 0] ^
  773|  40.0k|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  774|  40.0k|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  775|  40.0k|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  776|  40.0k|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  777|  40.0k|        rcon[i];
  778|  40.0k|      rk[ 9] = rk[ 1] ^ rk[ 8];
  779|  40.0k|      rk[10] = rk[ 2] ^ rk[ 9];
  780|  40.0k|      rk[11] = rk[ 3] ^ rk[10];
  781|  40.0k|      if (++i == 7)
  ------------------
  |  Branch (781:11): [True: 5.72k, False: 34.3k]
  ------------------
  782|  5.72k|        return 14;
  783|  34.3k|      temp = rk[11];
  784|  34.3k|      rk[12] = rk[ 4] ^
  785|  34.3k|        (Te4[(temp >> 24)       ] & 0xff000000) ^
  786|  34.3k|        (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
  787|  34.3k|        (Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
  788|  34.3k|        (Te4[(temp      ) & 0xff] & 0x000000ff);
  789|  34.3k|      rk[13] = rk[ 5] ^ rk[12];
  790|  34.3k|      rk[14] = rk[ 6] ^ rk[13];
  791|  34.3k|      rk[15] = rk[ 7] ^ rk[14];
  792|  34.3k|      rk += 8;
  793|  34.3k|    }
  794|  5.72k|  }
  795|      0|  return 0;
  796|  5.72k|}
_Z20rijndaelSetupDecryptPjPKhm:
  804|  7.91k|{
  805|  7.91k|  unsigned int nrounds, i, j;
  806|  7.91k|  u32 temp;
  807|       |
  808|       |  /* expand the cipher key: */
  809|  7.91k|  nrounds = rijndaelSetupEncrypt(rk, key, keybits);
  810|       |  /* invert the order of the round keys: */
  811|  58.9k|  for (i = 0, j = 4*nrounds; i < j; i += 4, j -= 4)
  ------------------
  |  Branch (811:30): [True: 51.0k, False: 7.91k]
  ------------------
  812|  51.0k|  {
  813|  51.0k|    temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
  814|  51.0k|    temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
  815|  51.0k|    temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
  816|  51.0k|    temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
  817|  51.0k|  }
  818|       |  /* apply the inverse MixColumn transform to all round keys but the first and the last: */
  819|   102k|  for (i = 1; i < nrounds; i++)
  ------------------
  |  Branch (819:15): [True: 94.1k, False: 7.91k]
  ------------------
  820|  94.1k|  {
  821|  94.1k|    rk += 4;
  822|  94.1k|    rk[0] =
  823|  94.1k|      Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
  824|  94.1k|      Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
  825|  94.1k|      Td2[Te4[(rk[0] >>  8) & 0xff] & 0xff] ^
  826|  94.1k|      Td3[Te4[(rk[0]      ) & 0xff] & 0xff];
  827|  94.1k|    rk[1] =
  828|  94.1k|      Td0[Te4[(rk[1] >> 24)       ] & 0xff] ^
  829|  94.1k|      Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
  830|  94.1k|      Td2[Te4[(rk[1] >>  8) & 0xff] & 0xff] ^
  831|  94.1k|      Td3[Te4[(rk[1]      ) & 0xff] & 0xff];
  832|  94.1k|    rk[2] =
  833|  94.1k|      Td0[Te4[(rk[2] >> 24)       ] & 0xff] ^
  834|  94.1k|      Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
  835|  94.1k|      Td2[Te4[(rk[2] >>  8) & 0xff] & 0xff] ^
  836|  94.1k|      Td3[Te4[(rk[2]      ) & 0xff] & 0xff];
  837|  94.1k|    rk[3] =
  838|  94.1k|      Td0[Te4[(rk[3] >> 24)       ] & 0xff] ^
  839|  94.1k|      Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
  840|  94.1k|      Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
  841|  94.1k|      Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
  842|  94.1k|  }
  843|  7.91k|  return nrounds;
  844|  7.91k|}
_Z15rijndaelEncryptPKjjPKhPh:
  849|  51.3M|{
  850|  51.3M|  u32 s0, s1, s2, s3, t0, t1, t2, t3;
  851|       |#ifndef FULL_UNROLL
  852|       |    int r;
  853|       |#endif /* ?FULL_UNROLL */
  854|       |  /*
  855|       |   * map byte array block to cipher state
  856|       |   * and add initial round key:
  857|       |  */
  858|  51.3M|  s0 = GETU32(plaintext     ) ^ rk[0];
  ------------------
  |  |  698|  51.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  51.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  51.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  51.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  859|  51.3M|  s1 = GETU32(plaintext +  4) ^ rk[1];
  ------------------
  |  |  698|  51.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  51.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  51.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  51.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  860|  51.3M|  s2 = GETU32(plaintext +  8) ^ rk[2];
  ------------------
  |  |  698|  51.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  51.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  51.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  51.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  861|  51.3M|  s3 = GETU32(plaintext + 12) ^ rk[3];
  ------------------
  |  |  698|  51.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  51.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  51.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  51.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  862|  51.3M|#ifdef FULL_UNROLL
  863|       |    /* round 1: */
  864|  51.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
  865|  51.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
  866|  51.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
  867|  51.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
  868|       |    /* round 2: */
  869|  51.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
  870|  51.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
  871|  51.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
  872|  51.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
  873|       |    /* round 3: */
  874|  51.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
  875|  51.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
  876|  51.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
  877|  51.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
  878|       |    /* round 4: */
  879|  51.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
  880|  51.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
  881|  51.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
  882|  51.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
  883|       |    /* round 5: */
  884|  51.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
  885|  51.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
  886|  51.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
  887|  51.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
  888|       |    /* round 6: */
  889|  51.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
  890|  51.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
  891|  51.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
  892|  51.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
  893|       |    /* round 7: */
  894|  51.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
  895|  51.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
  896|  51.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
  897|  51.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
  898|       |    /* round 8: */
  899|  51.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
  900|  51.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
  901|  51.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
  902|  51.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
  903|       |    /* round 9: */
  904|  51.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
  905|  51.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
  906|  51.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
  907|  51.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
  908|  51.3M|    if (nrounds > 10)
  ------------------
  |  Branch (908:9): [True: 0, False: 51.3M]
  ------------------
  909|      0|    {
  910|       |      /* round 10: */
  911|      0|      s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
  912|      0|      s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
  913|      0|      s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42];
  914|      0|      s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43];
  915|       |      /* round 11: */
  916|      0|      t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44];
  917|      0|      t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
  918|      0|      t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
  919|      0|      t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
  920|      0|      if (nrounds > 12)
  ------------------
  |  Branch (920:11): [True: 0, False: 0]
  ------------------
  921|      0|      {
  922|       |        /* round 12: */
  923|      0|        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
  924|      0|        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
  925|      0|        s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50];
  926|      0|        s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51];
  927|       |        /* round 13: */
  928|      0|        t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52];
  929|      0|        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53];
  930|      0|        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54];
  931|      0|        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
  932|      0|      }
  933|      0|    }
  934|  51.3M|    rk += nrounds << 2;
  935|       |#else  /* !FULL_UNROLL */
  936|       |    /*
  937|       |    * nrounds - 1 full rounds:
  938|       |    */
  939|       |    r = nrounds >> 1;
  940|       |    for (;;)
  941|       |    {
  942|       |      t0 =
  943|       |        Te0[(s0 >> 24)       ] ^
  944|       |        Te1[(s1 >> 16) & 0xff] ^
  945|       |        Te2[(s2 >>  8) & 0xff] ^
  946|       |        Te3[(s3      ) & 0xff] ^
  947|       |        rk[4];
  948|       |      t1 =
  949|       |        Te0[(s1 >> 24)       ] ^
  950|       |        Te1[(s2 >> 16) & 0xff] ^
  951|       |        Te2[(s3 >>  8) & 0xff] ^
  952|       |        Te3[(s0      ) & 0xff] ^
  953|       |        rk[5];
  954|       |      t2 =
  955|       |        Te0[(s2 >> 24)       ] ^
  956|       |        Te1[(s3 >> 16) & 0xff] ^
  957|       |        Te2[(s0 >>  8) & 0xff] ^
  958|       |        Te3[(s1      ) & 0xff] ^
  959|       |        rk[6];
  960|       |      t3 =
  961|       |        Te0[(s3 >> 24)       ] ^
  962|       |        Te1[(s0 >> 16) & 0xff] ^
  963|       |        Te2[(s1 >>  8) & 0xff] ^
  964|       |        Te3[(s2      ) & 0xff] ^
  965|       |        rk[7];
  966|       |        rk += 8;
  967|       |        if (--r == 0)
  968|       |            break;
  969|       |      s0 =
  970|       |        Te0[(t0 >> 24)       ] ^
  971|       |        Te1[(t1 >> 16) & 0xff] ^
  972|       |        Te2[(t2 >>  8) & 0xff] ^
  973|       |        Te3[(t3      ) & 0xff] ^
  974|       |        rk[0];
  975|       |      s1 =
  976|       |        Te0[(t1 >> 24)       ] ^
  977|       |        Te1[(t2 >> 16) & 0xff] ^
  978|       |        Te2[(t3 >>  8) & 0xff] ^
  979|       |        Te3[(t0      ) & 0xff] ^
  980|       |        rk[1];
  981|       |      s2 =
  982|       |        Te0[(t2 >> 24)       ] ^
  983|       |        Te1[(t3 >> 16) & 0xff] ^
  984|       |        Te2[(t0 >>  8) & 0xff] ^
  985|       |        Te3[(t1      ) & 0xff] ^
  986|       |        rk[2];
  987|       |      s3 =
  988|       |        Te0[(t3 >> 24)       ] ^
  989|       |        Te1[(t0 >> 16) & 0xff] ^
  990|       |        Te2[(t1 >>  8) & 0xff] ^
  991|       |        Te3[(t2      ) & 0xff] ^
  992|       |        rk[3];
  993|       |     }
  994|       |#endif /* ?FULL_UNROLL */
  995|       |  /*
  996|       |  * apply last round and
  997|       |  * map cipher state to byte array block:
  998|       |  */
  999|  51.3M|  s0 =
 1000|  51.3M|    (Te4[(t0 >> 24)       ] & 0xff000000) ^
 1001|  51.3M|    (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1002|  51.3M|    (Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1003|  51.3M|    (Te4[(t3      ) & 0xff] & 0x000000ff) ^
 1004|  51.3M|    rk[0];
 1005|  51.3M|  PUTU32(ciphertext     , s0);
  ------------------
  |  |  703|  51.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  51.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  51.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  51.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  51.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1006|  51.3M|  s1 =
 1007|  51.3M|    (Te4[(t1 >> 24)       ] & 0xff000000) ^
 1008|  51.3M|    (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1009|  51.3M|    (Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1010|  51.3M|    (Te4[(t0      ) & 0xff] & 0x000000ff) ^
 1011|  51.3M|    rk[1];
 1012|  51.3M|  PUTU32(ciphertext +  4, s1);
  ------------------
  |  |  703|  51.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  51.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  51.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  51.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  51.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1013|  51.3M|  s2 =
 1014|  51.3M|    (Te4[(t2 >> 24)       ] & 0xff000000) ^
 1015|  51.3M|    (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1016|  51.3M|    (Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1017|  51.3M|    (Te4[(t1      ) & 0xff] & 0x000000ff) ^
 1018|  51.3M|    rk[2];
 1019|  51.3M|  PUTU32(ciphertext +  8, s2);
  ------------------
  |  |  703|  51.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  51.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  51.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  51.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  51.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1020|  51.3M|  s3 =
 1021|  51.3M|    (Te4[(t3 >> 24)       ] & 0xff000000) ^
 1022|  51.3M|    (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1023|  51.3M|    (Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1024|  51.3M|    (Te4[(t2      ) & 0xff] & 0x000000ff) ^
 1025|  51.3M|    rk[3];
 1026|  51.3M|  PUTU32(ciphertext + 12, s3);
  ------------------
  |  |  703|  51.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  51.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  51.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  51.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  51.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1027|  51.3M|}
_Z15rijndaelDecryptPKjjPKhPh:
 1032|   589k|{
 1033|   589k|  u32 s0, s1, s2, s3, t0, t1, t2, t3;
 1034|       |#ifndef FULL_UNROLL
 1035|       |    int r;
 1036|       |#endif /* ?FULL_UNROLL */
 1037|       |
 1038|       |  /*
 1039|       |  * map byte array block to cipher state
 1040|       |  * and add initial round key:
 1041|       |  */
 1042|   589k|    s0 = GETU32(ciphertext     ) ^ rk[0];
  ------------------
  |  |  698|   589k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   589k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   589k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   589k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1043|   589k|    s1 = GETU32(ciphertext +  4) ^ rk[1];
  ------------------
  |  |  698|   589k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   589k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   589k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   589k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1044|   589k|    s2 = GETU32(ciphertext +  8) ^ rk[2];
  ------------------
  |  |  698|   589k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   589k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   589k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   589k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1045|   589k|    s3 = GETU32(ciphertext + 12) ^ rk[3];
  ------------------
  |  |  698|   589k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   589k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   589k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   589k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1046|   589k|#ifdef FULL_UNROLL
 1047|       |    /* round 1: */
 1048|   589k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
 1049|   589k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
 1050|   589k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
 1051|   589k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
 1052|       |    /* round 2: */
 1053|   589k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
 1054|   589k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
 1055|   589k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
 1056|   589k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
 1057|       |    /* round 3: */
 1058|   589k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
 1059|   589k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
 1060|   589k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
 1061|   589k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
 1062|       |    /* round 4: */
 1063|   589k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
 1064|   589k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
 1065|   589k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
 1066|   589k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
 1067|       |    /* round 5: */
 1068|   589k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
 1069|   589k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
 1070|   589k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
 1071|   589k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
 1072|       |    /* round 6: */
 1073|   589k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
 1074|   589k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
 1075|   589k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
 1076|   589k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
 1077|       |    /* round 7: */
 1078|   589k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
 1079|   589k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
 1080|   589k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
 1081|   589k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
 1082|       |    /* round 8: */
 1083|   589k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
 1084|   589k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
 1085|   589k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
 1086|   589k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
 1087|       |    /* round 9: */
 1088|   589k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
 1089|   589k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
 1090|   589k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
 1091|   589k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
 1092|   589k|    if (nrounds > 10)
  ------------------
  |  Branch (1092:9): [True: 456k, False: 133k]
  ------------------
 1093|   456k|    {
 1094|       |      /* round 10: */
 1095|   456k|      s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
 1096|   456k|      s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
 1097|   456k|      s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
 1098|   456k|      s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
 1099|       |      /* round 11: */
 1100|   456k|      t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
 1101|   456k|      t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
 1102|   456k|      t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
 1103|   456k|      t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
 1104|   456k|      if (nrounds > 12)
  ------------------
  |  Branch (1104:11): [True: 456k, False: 0]
  ------------------
 1105|   456k|      {
 1106|       |        /* round 12: */
 1107|   456k|        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
 1108|   456k|        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
 1109|   456k|        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
 1110|   456k|        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
 1111|       |        /* round 13: */
 1112|   456k|        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
 1113|   456k|        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
 1114|   456k|        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
 1115|   456k|        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
 1116|   456k|      }
 1117|   456k|    }
 1118|   589k|    rk += nrounds << 2;
 1119|       |#else  /* !FULL_UNROLL */
 1120|       |    /*
 1121|       |    * nrounds - 1 full rounds:
 1122|       |    */
 1123|       |    r = nrounds >> 1;
 1124|       |    for (;;)
 1125|       |    {
 1126|       |      t0 =
 1127|       |        Td0[(s0 >> 24)       ] ^
 1128|       |        Td1[(s3 >> 16) & 0xff] ^
 1129|       |        Td2[(s2 >>  8) & 0xff] ^
 1130|       |        Td3[(s1      ) & 0xff] ^
 1131|       |        rk[4];
 1132|       |      t1 =
 1133|       |        Td0[(s1 >> 24)       ] ^
 1134|       |        Td1[(s0 >> 16) & 0xff] ^
 1135|       |        Td2[(s3 >>  8) & 0xff] ^
 1136|       |        Td3[(s2      ) & 0xff] ^
 1137|       |        rk[5];
 1138|       |      t2 =
 1139|       |        Td0[(s2 >> 24)       ] ^
 1140|       |        Td1[(s1 >> 16) & 0xff] ^
 1141|       |        Td2[(s0 >>  8) & 0xff] ^
 1142|       |        Td3[(s3      ) & 0xff] ^
 1143|       |        rk[6];
 1144|       |      t3 =
 1145|       |        Td0[(s3 >> 24)       ] ^
 1146|       |        Td1[(s2 >> 16) & 0xff] ^
 1147|       |        Td2[(s1 >>  8) & 0xff] ^
 1148|       |        Td3[(s0      ) & 0xff] ^
 1149|       |        rk[7];
 1150|       |      rk += 8;
 1151|       |      if (--r == 0)
 1152|       |          break;
 1153|       |      s0 =
 1154|       |        Td0[(t0 >> 24)       ] ^
 1155|       |        Td1[(t3 >> 16) & 0xff] ^
 1156|       |        Td2[(t2 >>  8) & 0xff] ^
 1157|       |        Td3[(t1      ) & 0xff] ^
 1158|       |        rk[0];
 1159|       |      s1 =
 1160|       |        Td0[(t1 >> 24)       ] ^
 1161|       |        Td1[(t0 >> 16) & 0xff] ^
 1162|       |        Td2[(t3 >>  8) & 0xff] ^
 1163|       |        Td3[(t2      ) & 0xff] ^
 1164|       |        rk[1];
 1165|       |      s2 =
 1166|       |        Td0[(t2 >> 24)       ] ^
 1167|       |        Td1[(t1 >> 16) & 0xff] ^
 1168|       |        Td2[(t0 >>  8) & 0xff] ^
 1169|       |        Td3[(t3      ) & 0xff] ^
 1170|       |        rk[2];
 1171|       |      s3 =
 1172|       |        Td0[(t3 >> 24)       ] ^
 1173|       |        Td1[(t2 >> 16) & 0xff] ^
 1174|       |        Td2[(t1 >>  8) & 0xff] ^
 1175|       |        Td3[(t0      ) & 0xff] ^
 1176|       |        rk[3];
 1177|       |    }
 1178|       |#endif /* ?FULL_UNROLL */
 1179|       |  /*
 1180|       |  * apply last round and
 1181|       |  * map cipher state to byte array block:
 1182|       |  */
 1183|   589k|  s0 =
 1184|   589k|    (Td4[(t0 >> 24)       ] & 0xff000000) ^
 1185|   589k|    (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1186|   589k|    (Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1187|   589k|    (Td4[(t1      ) & 0xff] & 0x000000ff) ^
 1188|   589k|    rk[0];
 1189|   589k|  PUTU32(plaintext     , s0);
  ------------------
  |  |  703|   589k|#define PUTU32(ciphertext, st) { \
  |  |  704|   589k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   589k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   589k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   589k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1190|   589k|  s1 =
 1191|   589k|    (Td4[(t1 >> 24)       ] & 0xff000000) ^
 1192|   589k|    (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1193|   589k|    (Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1194|   589k|    (Td4[(t2      ) & 0xff] & 0x000000ff) ^
 1195|   589k|    rk[1];
 1196|   589k|  PUTU32(plaintext +  4, s1);
  ------------------
  |  |  703|   589k|#define PUTU32(ciphertext, st) { \
  |  |  704|   589k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   589k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   589k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   589k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1197|   589k|  s2 =
 1198|   589k|    (Td4[(t2 >> 24)       ] & 0xff000000) ^
 1199|   589k|    (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1200|   589k|    (Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1201|   589k|    (Td4[(t3      ) & 0xff] & 0x000000ff) ^
 1202|   589k|    rk[2];
 1203|   589k|  PUTU32(plaintext +  8, s2);
  ------------------
  |  |  703|   589k|#define PUTU32(ciphertext, st) { \
  |  |  704|   589k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   589k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   589k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   589k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1204|   589k|  s3 =
 1205|   589k|    (Td4[(t3 >> 24)       ] & 0xff000000) ^
 1206|   589k|    (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1207|   589k|    (Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1208|   589k|    (Td4[(t0      ) & 0xff] & 0x000000ff) ^
 1209|   589k|    rk[3];
 1210|   589k|  PUTU32(plaintext + 12, s3);
  ------------------
  |  |  703|   589k|#define PUTU32(ciphertext, st) { \
  |  |  704|   589k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   589k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   589k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   589k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1211|   589k|}

sph_sha256_init:
  635|   127k|{
  636|   127k|        sph_sha256_context *sc;
  637|       |
  638|   127k|        sc = cc;
  639|   127k|        memcpy(sc->val, H256, sizeof H256);
  640|   127k|#if SPH_64
  641|   127k|        sc->count = 0;
  642|       |#else
  643|       |        sc->count_high = sc->count_low = 0;
  644|       |#endif
  645|   127k|}
sph_sha256_close:
  671|  63.9k|{
  672|  63.9k|        sha224_close(cc, dst, 8);
  673|  63.9k|        sph_sha256_init(cc);
  674|  63.9k|}
sha2.c:sha2_round:
  611|  4.42M|{
  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  ------------------
  |  |  197|  4.42M|#define SHA2_ROUND_BODY(in, r)   do { \
  |  |  198|  4.42M|                sph_u32 A, B, C, D, E, F, G, H, T1, T2; \
  |  |  199|  4.42M|                sph_u32 W00, W01, W02, W03, W04, W05, W06, W07; \
  |  |  200|  4.42M|                sph_u32 W08, W09, W10, W11, W12, W13, W14, W15; \
  |  |  201|  4.42M| \
  |  |  202|  4.42M|                A = (r)[0]; \
  |  |  203|  4.42M|                B = (r)[1]; \
  |  |  204|  4.42M|                C = (r)[2]; \
  |  |  205|  4.42M|                D = (r)[3]; \
  |  |  206|  4.42M|                E = (r)[4]; \
  |  |  207|  4.42M|                F = (r)[5]; \
  |  |  208|  4.42M|                G = (r)[6]; \
  |  |  209|  4.42M|                H = (r)[7]; \
  |  |  210|  4.42M|                W00 = in(0); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  211|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  212|  4.42M|                        + SPH_C32(0x428A2F98) + W00); \
  |  |  213|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  214|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  215|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  216|  4.42M|                W01 = in(1); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  217|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  218|  4.42M|                        + SPH_C32(0x71374491) + W01); \
  |  |  219|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  220|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  221|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  222|  4.42M|                W02 = in(2); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  223|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  224|  4.42M|                        + SPH_C32(0xB5C0FBCF) + W02); \
  |  |  225|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  226|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  227|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  228|  4.42M|                W03 = in(3); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  229|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  230|  4.42M|                        + SPH_C32(0xE9B5DBA5) + W03); \
  |  |  231|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  232|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  233|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  234|  4.42M|                W04 = in(4); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  235|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  236|  4.42M|                        + SPH_C32(0x3956C25B) + W04); \
  |  |  237|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  238|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  239|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  240|  4.42M|                W05 = in(5); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  241|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  242|  4.42M|                        + SPH_C32(0x59F111F1) + W05); \
  |  |  243|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  244|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  245|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  246|  4.42M|                W06 = in(6); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  247|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  248|  4.42M|                        + SPH_C32(0x923F82A4) + W06); \
  |  |  249|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  250|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  251|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  252|  4.42M|                W07 = in(7); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  253|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  254|  4.42M|                        + SPH_C32(0xAB1C5ED5) + W07); \
  |  |  255|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  256|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  257|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  258|  4.42M|                W08 = in(8); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  259|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  260|  4.42M|                        + SPH_C32(0xD807AA98) + W08); \
  |  |  261|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  262|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  263|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  264|  4.42M|                W09 = in(9); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  265|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  266|  4.42M|                        + SPH_C32(0x12835B01) + W09); \
  |  |  267|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  268|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  269|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  270|  4.42M|                W10 = in(10); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  271|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  272|  4.42M|                        + SPH_C32(0x243185BE) + W10); \
  |  |  273|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  274|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  275|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  276|  4.42M|                W11 = in(11); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  277|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  278|  4.42M|                        + SPH_C32(0x550C7DC3) + W11); \
  |  |  279|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  280|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  281|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  282|  4.42M|                W12 = in(12); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  283|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  284|  4.42M|                        + SPH_C32(0x72BE5D74) + W12); \
  |  |  285|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  286|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  287|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  288|  4.42M|                W13 = in(13); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  289|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  290|  4.42M|                        + SPH_C32(0x80DEB1FE) + W13); \
  |  |  291|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  292|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  293|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  294|  4.42M|                W14 = in(14); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  295|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  296|  4.42M|                        + SPH_C32(0x9BDC06A7) + W14); \
  |  |  297|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  298|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  299|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  300|  4.42M|                W15 = in(15); \
  |  |  ------------------
  |  |  |  |  613|  4.42M|        SHA2_ROUND_BODY(SHA2_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  612|  4.42M|#define SHA2_IN(x)   sph_dec32be_aligned(data + (4 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  301|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  302|  4.42M|                        + SPH_C32(0xC19BF174) + W15); \
  |  |  303|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  304|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  305|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  306|  4.42M|                W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  307|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  308|  4.42M|                        + SPH_C32(0xE49B69C1) + W00); \
  |  |  309|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  311|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  312|  4.42M|                W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  313|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  314|  4.42M|                        + SPH_C32(0xEFBE4786) + W01); \
  |  |  315|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  316|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  317|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  318|  4.42M|                W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  319|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|  4.42M|                        + SPH_C32(0x0FC19DC6) + W02); \
  |  |  321|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  322|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  323|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  324|  4.42M|                W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  325|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  4.42M|                        + SPH_C32(0x240CA1CC) + W03); \
  |  |  327|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  328|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  329|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  330|  4.42M|                W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  331|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  332|  4.42M|                        + SPH_C32(0x2DE92C6F) + W04); \
  |  |  333|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  334|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  335|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  336|  4.42M|                W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  337|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  338|  4.42M|                        + SPH_C32(0x4A7484AA) + W05); \
  |  |  339|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  340|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  341|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  342|  4.42M|                W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  343|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  344|  4.42M|                        + SPH_C32(0x5CB0A9DC) + W06); \
  |  |  345|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  346|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  347|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  348|  4.42M|                W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  349|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  350|  4.42M|                        + SPH_C32(0x76F988DA) + W07); \
  |  |  351|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  352|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  353|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  354|  4.42M|                W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  355|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  356|  4.42M|                        + SPH_C32(0x983E5152) + W08); \
  |  |  357|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  358|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  359|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  360|  4.42M|                W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  361|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  362|  4.42M|                        + SPH_C32(0xA831C66D) + W09); \
  |  |  363|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  364|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  365|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  366|  4.42M|                W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  367|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  368|  4.42M|                        + SPH_C32(0xB00327C8) + W10); \
  |  |  369|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  370|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  371|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  4.42M|                W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  373|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  374|  4.42M|                        + SPH_C32(0xBF597FC7) + W11); \
  |  |  375|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  376|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  377|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  378|  4.42M|                W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  379|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  4.42M|                        + SPH_C32(0xC6E00BF3) + W12); \
  |  |  381|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  382|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  383|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  384|  4.42M|                W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  385|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  386|  4.42M|                        + SPH_C32(0xD5A79147) + W13); \
  |  |  387|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  388|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  389|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  390|  4.42M|                W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  391|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  392|  4.42M|                        + SPH_C32(0x06CA6351) + W14); \
  |  |  393|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  394|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  395|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  396|  4.42M|                W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  397|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  398|  4.42M|                        + SPH_C32(0x14292967) + W15); \
  |  |  399|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  400|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  401|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  402|  4.42M|                W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  403|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  404|  4.42M|                        + SPH_C32(0x27B70A85) + W00); \
  |  |  405|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  406|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  407|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  408|  4.42M|                W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  409|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|  4.42M|                        + SPH_C32(0x2E1B2138) + W01); \
  |  |  411|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  412|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  413|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  414|  4.42M|                W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  415|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  416|  4.42M|                        + SPH_C32(0x4D2C6DFC) + W02); \
  |  |  417|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  418|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  419|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  420|  4.42M|                W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  421|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  422|  4.42M|                        + SPH_C32(0x53380D13) + W03); \
  |  |  423|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  424|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  425|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  426|  4.42M|                W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  427|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  428|  4.42M|                        + SPH_C32(0x650A7354) + W04); \
  |  |  429|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  430|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  431|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  432|  4.42M|                W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  433|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  434|  4.42M|                        + SPH_C32(0x766A0ABB) + W05); \
  |  |  435|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  436|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  437|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  438|  4.42M|                W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  439|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  440|  4.42M|                        + SPH_C32(0x81C2C92E) + W06); \
  |  |  441|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  442|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  443|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  444|  4.42M|                W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  445|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  446|  4.42M|                        + SPH_C32(0x92722C85) + W07); \
  |  |  447|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  448|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  449|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  450|  4.42M|                W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  451|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  452|  4.42M|                        + SPH_C32(0xA2BFE8A1) + W08); \
  |  |  453|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  454|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  455|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  456|  4.42M|                W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  457|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  458|  4.42M|                        + SPH_C32(0xA81A664B) + W09); \
  |  |  459|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  460|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  461|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  462|  4.42M|                W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  463|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  464|  4.42M|                        + SPH_C32(0xC24B8B70) + W10); \
  |  |  465|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  466|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  467|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  468|  4.42M|                W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  469|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  470|  4.42M|                        + SPH_C32(0xC76C51A3) + W11); \
  |  |  471|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  472|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  473|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  474|  4.42M|                W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  475|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  476|  4.42M|                        + SPH_C32(0xD192E819) + W12); \
  |  |  477|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  478|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  479|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  480|  4.42M|                W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  481|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  482|  4.42M|                        + SPH_C32(0xD6990624) + W13); \
  |  |  483|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  484|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  485|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  486|  4.42M|                W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  487|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  488|  4.42M|                        + SPH_C32(0xF40E3585) + W14); \
  |  |  489|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  490|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  491|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  492|  4.42M|                W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  493|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  494|  4.42M|                        + SPH_C32(0x106AA070) + W15); \
  |  |  495|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  496|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  497|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  498|  4.42M|                W00 = SPH_T32(SSG2_1(W14) + W09 + SSG2_0(W01) + W00); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  499|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  500|  4.42M|                        + SPH_C32(0x19A4C116) + W00); \
  |  |  501|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  502|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  503|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  504|  4.42M|                W01 = SPH_T32(SSG2_1(W15) + W10 + SSG2_0(W02) + W01); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  505|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  506|  4.42M|                        + SPH_C32(0x1E376C08) + W01); \
  |  |  507|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  508|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  509|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  510|  4.42M|                W02 = SPH_T32(SSG2_1(W00) + W11 + SSG2_0(W03) + W02); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  511|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  512|  4.42M|                        + SPH_C32(0x2748774C) + W02); \
  |  |  513|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  514|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  515|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  516|  4.42M|                W03 = SPH_T32(SSG2_1(W01) + W12 + SSG2_0(W04) + W03); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  517|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  518|  4.42M|                        + SPH_C32(0x34B0BCB5) + W03); \
  |  |  519|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  520|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  521|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  522|  4.42M|                W04 = SPH_T32(SSG2_1(W02) + W13 + SSG2_0(W05) + W04); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  523|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  524|  4.42M|                        + SPH_C32(0x391C0CB3) + W04); \
  |  |  525|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  526|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  527|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  528|  4.42M|                W05 = SPH_T32(SSG2_1(W03) + W14 + SSG2_0(W06) + W05); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  529|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  530|  4.42M|                        + SPH_C32(0x4ED8AA4A) + W05); \
  |  |  531|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  532|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  533|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  534|  4.42M|                W06 = SPH_T32(SSG2_1(W04) + W15 + SSG2_0(W07) + W06); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  535|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  536|  4.42M|                        + SPH_C32(0x5B9CCA4F) + W06); \
  |  |  537|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  538|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  539|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  540|  4.42M|                W07 = SPH_T32(SSG2_1(W05) + W00 + SSG2_0(W08) + W07); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  541|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  542|  4.42M|                        + SPH_C32(0x682E6FF3) + W07); \
  |  |  543|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  544|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  545|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  546|  4.42M|                W08 = SPH_T32(SSG2_1(W06) + W01 + SSG2_0(W09) + W08); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  547|  4.42M|                T1 = SPH_T32(H + BSG2_1(E) + CH(E, F, G) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  548|  4.42M|                        + SPH_C32(0x748F82EE) + W08); \
  |  |  549|  4.42M|                T2 = SPH_T32(BSG2_0(A) + MAJ(A, B, C)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  550|  4.42M|                D = SPH_T32(D + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  551|  4.42M|                H = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  552|  4.42M|                W09 = SPH_T32(SSG2_1(W07) + W02 + SSG2_0(W10) + W09); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  553|  4.42M|                T1 = SPH_T32(G + BSG2_1(D) + CH(D, E, F) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  554|  4.42M|                        + SPH_C32(0x78A5636F) + W09); \
  |  |  555|  4.42M|                T2 = SPH_T32(BSG2_0(H) + MAJ(H, A, B)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  556|  4.42M|                C = SPH_T32(C + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  557|  4.42M|                G = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  558|  4.42M|                W10 = SPH_T32(SSG2_1(W08) + W03 + SSG2_0(W11) + W10); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  559|  4.42M|                T1 = SPH_T32(F + BSG2_1(C) + CH(C, D, E) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  560|  4.42M|                        + SPH_C32(0x84C87814) + W10); \
  |  |  561|  4.42M|                T2 = SPH_T32(BSG2_0(G) + MAJ(G, H, A)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  562|  4.42M|                B = SPH_T32(B + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  563|  4.42M|                F = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  564|  4.42M|                W11 = SPH_T32(SSG2_1(W09) + W04 + SSG2_0(W12) + W11); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  565|  4.42M|                T1 = SPH_T32(E + BSG2_1(B) + CH(B, C, D) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  566|  4.42M|                        + SPH_C32(0x8CC70208) + W11); \
  |  |  567|  4.42M|                T2 = SPH_T32(BSG2_0(F) + MAJ(F, G, H)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  568|  4.42M|                A = SPH_T32(A + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  569|  4.42M|                E = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  570|  4.42M|                W12 = SPH_T32(SSG2_1(W10) + W05 + SSG2_0(W13) + W12); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  571|  4.42M|                T1 = SPH_T32(D + BSG2_1(A) + CH(A, B, C) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  572|  4.42M|                        + SPH_C32(0x90BEFFFA) + W12); \
  |  |  573|  4.42M|                T2 = SPH_T32(BSG2_0(E) + MAJ(E, F, G)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  574|  4.42M|                H = SPH_T32(H + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  575|  4.42M|                D = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  576|  4.42M|                W13 = SPH_T32(SSG2_1(W11) + W06 + SSG2_0(W14) + W13); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  577|  4.42M|                T1 = SPH_T32(C + BSG2_1(H) + CH(H, A, B) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  578|  4.42M|                        + SPH_C32(0xA4506CEB) + W13); \
  |  |  579|  4.42M|                T2 = SPH_T32(BSG2_0(D) + MAJ(D, E, F)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  580|  4.42M|                G = SPH_T32(G + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  581|  4.42M|                C = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  582|  4.42M|                W14 = SPH_T32(SSG2_1(W12) + W07 + SSG2_0(W15) + W14); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  583|  4.42M|                T1 = SPH_T32(B + BSG2_1(G) + CH(G, H, A) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  584|  4.42M|                        + SPH_C32(0xBEF9A3F7) + W14); \
  |  |  585|  4.42M|                T2 = SPH_T32(BSG2_0(C) + MAJ(C, D, E)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  586|  4.42M|                F = SPH_T32(F + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  587|  4.42M|                B = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  588|  4.42M|                W15 = SPH_T32(SSG2_1(W13) + W08 + SSG2_0(W00) + W15); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  589|  4.42M|                T1 = SPH_T32(A + BSG2_1(F) + CH(F, G, H) \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  590|  4.42M|                        + SPH_C32(0xC67178F2) + W15); \
  |  |  591|  4.42M|                T2 = SPH_T32(BSG2_0(B) + MAJ(B, C, D)); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  592|  4.42M|                E = SPH_T32(E + T1); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  593|  4.42M|                A = SPH_T32(T1 + T2); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  594|  4.42M|                (r)[0] = SPH_T32((r)[0] + A); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  595|  4.42M|                (r)[1] = SPH_T32((r)[1] + B); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  596|  4.42M|                (r)[2] = SPH_T32((r)[2] + C); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  597|  4.42M|                (r)[3] = SPH_T32((r)[3] + D); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  598|  4.42M|                (r)[4] = SPH_T32((r)[4] + E); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  599|  4.42M|                (r)[5] = SPH_T32((r)[5] + F); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  600|  4.42M|                (r)[6] = SPH_T32((r)[6] + G); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  601|  4.42M|                (r)[7] = SPH_T32((r)[7] + H); \
  |  |  ------------------
  |  |  |  |  938|  4.42M|#define SPH_T32(x)    ((x) & SPH_C32(0xFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  852|  4.42M|#define SPH_C32(x)    ((sph_u32)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  602|  4.42M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (602:18): [Folded, False: 4.42M]
  |  |  ------------------
  ------------------
  614|  4.42M|#undef SHA2_IN
  615|  4.42M|}

sph_sha384_init:
  183|   117k|{
  184|   117k|        sph_sha384_context *sc;
  185|       |
  186|   117k|        sc = cc;
  187|   117k|        memcpy(sc->val, H384, sizeof H384);
  188|   117k|        sc->count = 0;
  189|   117k|}
sph_sha512_init:
  194|   118k|{
  195|   118k|        sph_sha512_context *sc;
  196|       |
  197|   118k|        sc = cc;
  198|   118k|        memcpy(sc->val, H512, sizeof H512);
  199|   118k|        sc->count = 0;
  200|   118k|}
sph_sha384_close:
  210|  58.8k|{
  211|  58.8k|        sha384_close(cc, dst, 6);
  212|  58.8k|        sph_sha384_init(cc);
  213|  58.8k|}
sph_sha512_close:
  226|  59.1k|{
  227|  59.1k|        sha384_close(cc, dst, 8);
  228|  59.1k|        sph_sha512_init(cc);
  229|  59.1k|}
sha2big.c:sha3_round:
  174|  4.35M|{
  175|  4.35M|#define SHA3_IN(x)   sph_dec64be_aligned(data + (8 * (x)))
  176|  4.35M|        SHA3_ROUND_BODY(SHA3_IN, r);
  ------------------
  |  |  131|  4.35M|#define SHA3_ROUND_BODY(in, r)   do { \
  |  |  132|  4.35M|                int i; \
  |  |  133|  4.35M|                sph_u64 A, B, C, D, E, F, G, H; \
  |  |  134|  4.35M|                sph_u64 W[80]; \
  |  |  135|  4.35M| \
  |  |  136|  74.0M|                for (i = 0; i < 16; i ++) \
  |  |  ------------------
  |  |  |  Branch (136:29): [True: 69.7M, False: 4.35M]
  |  |  ------------------
  |  |  137|  69.7M|                        W[i] = in(i); \
  |  |  ------------------
  |  |  |  |  176|  69.7M|        SHA3_ROUND_BODY(SHA3_IN, r);
  |  |  |  |  ------------------
  |  |  |  |  |  |  175|  69.7M|#define SHA3_IN(x)   sph_dec64be_aligned(data + (8 * (x)))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  138|   283M|                for (i = 16; i < 80; i ++) \
  |  |  ------------------
  |  |  |  Branch (138:30): [True: 278M, False: 4.35M]
  |  |  ------------------
  |  |  139|   278M|                        W[i] = SPH_T64(SSG5_1(W[i - 2]) + W[i - 7] \
  |  |  ------------------
  |  |  |  |  944|   278M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|   278M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  140|  4.35M|                                + SSG5_0(W[i - 15]) + W[i - 16]); \
  |  |  141|  4.35M|                A = (r)[0]; \
  |  |  142|  4.35M|                B = (r)[1]; \
  |  |  143|  4.35M|                C = (r)[2]; \
  |  |  144|  4.35M|                D = (r)[3]; \
  |  |  145|  4.35M|                E = (r)[4]; \
  |  |  146|  4.35M|                F = (r)[5]; \
  |  |  147|  4.35M|                G = (r)[6]; \
  |  |  148|  4.35M|                H = (r)[7]; \
  |  |  149|  47.9M|                for (i = 0; i < 80; i += 8) { \
  |  |  ------------------
  |  |  |  Branch (149:29): [True: 43.5M, False: 4.35M]
  |  |  ------------------
  |  |  150|  43.5M|                        SHA3_STEP(A, B, C, D, E, F, G, H, i + 0); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  151|  43.5M|                        SHA3_STEP(H, A, B, C, D, E, F, G, i + 1); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  152|  43.5M|                        SHA3_STEP(G, H, A, B, C, D, E, F, i + 2); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  153|  43.5M|                        SHA3_STEP(F, G, H, A, B, C, D, E, i + 3); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  154|  43.5M|                        SHA3_STEP(E, F, G, H, A, B, C, D, i + 4); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  43.5M|                        SHA3_STEP(D, E, F, G, H, A, B, C, i + 5); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  156|  43.5M|                        SHA3_STEP(C, D, E, F, G, H, A, B, i + 6); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  157|  43.5M|                        SHA3_STEP(B, C, D, E, F, G, H, A, i + 7); \
  |  |  ------------------
  |  |  |  |  123|  43.5M|#define SHA3_STEP(A, B, C, D, E, F, G, H, i)   do { \
  |  |  |  |  124|  43.5M|                sph_u64 T1, T2; \
  |  |  |  |  125|  43.5M|                T1 = SPH_T64(H + BSG5_1(E) + CH(E, F, G) + K512[i] + W[i]); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  126|  43.5M|                T2 = SPH_T64(BSG5_0(A) + MAJ(A, B, C)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  127|  43.5M|                D = SPH_T64(D + T1); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  128|  43.5M|                H = SPH_T64(T1 + T2); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  944|  43.5M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  854|  43.5M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  129|  43.5M|        } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (129:18): [Folded, False: 43.5M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  158|  43.5M|                } \
  |  |  159|  4.35M|                (r)[0] = SPH_T64((r)[0] + A); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  160|  4.35M|                (r)[1] = SPH_T64((r)[1] + B); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  161|  4.35M|                (r)[2] = SPH_T64((r)[2] + C); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  162|  4.35M|                (r)[3] = SPH_T64((r)[3] + D); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  4.35M|                (r)[4] = SPH_T64((r)[4] + E); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  164|  4.35M|                (r)[5] = SPH_T64((r)[5] + F); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  165|  4.35M|                (r)[6] = SPH_T64((r)[6] + G); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  166|  4.35M|                (r)[7] = SPH_T64((r)[7] + H); \
  |  |  ------------------
  |  |  |  |  944|  4.35M|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  |  |  ------------------
  |  |  |  |  |  |  854|  4.35M|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  167|  4.35M|        } while (0)
  |  |  ------------------
  |  |  |  Branch (167:18): [Folded, False: 4.35M]
  |  |  ------------------
  ------------------
  177|  4.35M|#undef SHA3_IN
  178|  4.35M|}

sph_sha224:
  173|  65.4k|{
  174|  65.4k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  65.4k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  65.4k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  65.4k|        unsigned current;
  176|  65.4k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  65.4k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  65.4k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 4.28k, False: 61.1k]
  ------------------
  182|  4.28k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  4.28k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  4.28k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  4.28k|                return;
  184|  4.28k|        }
  185|  61.1k|        sc = cc;
  186|  61.1k|#if SPH_64
  187|  61.1k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  61.1k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  61.1k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 61.1k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   95|      0|#define SPH_BLEN     64U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|  61.1k|        orig_len = len;
  206|  4.42M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  4.42M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 4.36M, False: 61.1k]
  ------------------
  207|  4.36M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  4.36M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  4.36M|#define SPH_VAL   sc->val
  ------------------
  208|  4.36M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  4.36M|#define SPH_BLEN     64U
  ------------------
  209|  4.36M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  4.36M|#define SPH_BLEN     64U
  ------------------
  210|  4.36M|        }
  211|  61.1k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 61.1k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  61.1k|#if SPH_64
  214|  61.1k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|  61.1k|}
sha2.c:sha224_short:
  131|  4.28k|{
  132|  4.28k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  4.28k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  4.28k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  4.28k|        unsigned current;
  134|       |
  135|  4.28k|        sc = cc;
  136|  4.28k|#if SPH_64
  137|  4.28k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  4.28k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  8.57k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 4.28k, False: 4.28k]
  ------------------
  142|  4.28k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  4.28k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  4.28k|#define SPH_BLEN     64U
  ------------------
  148|  4.28k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 4.28k, False: 0]
  ------------------
  149|  4.28k|                        clen = (unsigned)len;
  150|  4.28k|                memcpy(sc->buf + current, data, clen);
  151|  4.28k|                data = (const unsigned char *)data + clen;
  152|  4.28k|                current += clen;
  153|  4.28k|                len -= clen;
  154|  4.28k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  4.28k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 4.28k]
  ------------------
  155|      0|                        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|      0|#define RFUN   sha2_round
  ------------------
                                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|      0|#define SPH_VAL   sc->val
  ------------------
  156|      0|                        current = 0;
  157|      0|                }
  158|  4.28k|#if SPH_64
  159|  4.28k|                sc->count += clen;
  160|       |#else
  161|       |                clow = sc->count_low;
  162|       |                clow2 = SPH_T32(clow + clen);
  163|       |                sc->count_low = clow2;
  164|       |                if (clow2 < clow)
  165|       |                        sc->count_high ++;
  166|       |#endif
  167|  4.28k|        }
  168|  4.28k|}
sha2.c:sha224_close:
  345|  63.9k|{
  346|  63.9k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  63.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  63.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  63.9k|}
sha2.c:sha224_addbits_and_close:
  242|  63.9k|{
  243|  63.9k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  63.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  63.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  63.9k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  63.9k|        sc = cc;
  250|  63.9k|#if SPH_64
  251|  63.9k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  63.9k|#define SPH_BLEN     64U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|  63.9k|        {
  259|  63.9k|                unsigned z;
  260|       |
  261|  63.9k|                z = 0x80U >> n;
  262|  63.9k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  63.9k|        }
  264|  63.9k|#endif
  265|  63.9k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  63.9k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  63.9k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  63.9k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 1.44k, False: 62.5k]
  ------------------
  266|  1.44k|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|  1.44k|#define SPH_BLEN     64U
  ------------------
  267|  1.44k|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  1.44k|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  1.44k|#define SPH_VAL   sc->val
  ------------------
  268|  1.44k|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|  1.44k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  1.44k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  1.44k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  62.5k|        } else {
  270|  62.5k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  62.5k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  62.5k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  62.5k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  62.5k|        }
  272|       |#if defined BE64
  273|       |#if defined PLW1
  274|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  275|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  276|       |#elif defined PLW4
  277|       |        memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN);
  278|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN,
  279|       |                sc->count >> 61);
  280|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN,
  281|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  282|       |#else
  283|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  284|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  285|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  286|       |#endif
  287|       |#elif defined LE64
  288|       |#if defined PLW1
  289|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  290|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  291|       |#elif defined PLW1
  292|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  293|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  294|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  295|       |        memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN);
  296|       |#else
  297|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  298|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  299|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  300|       |#endif
  301|       |#else
  302|  63.9k|#if SPH_64
  303|  63.9k|#ifdef BE32
  304|  63.9k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  63.9k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  63.9k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  63.9k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  63.9k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  63.9k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  63.9k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|  63.9k|#endif
  323|  63.9k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  63.9k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  63.9k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   575k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 511k, False: 63.9k]
  ------------------
  330|       |#if defined BE64
  331|       |                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|   511k|        }
  340|  63.9k|#endif
  341|  63.9k|}
sph_sha384:
  173|   117k|{
  174|   117k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   117k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   117k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|   117k|        unsigned current;
  176|   117k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|   117k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|   117k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 117k]
  ------------------
  182|      0|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|      0|                return;
  184|      0|        }
  185|   117k|        sc = cc;
  186|   117k|#if SPH_64
  187|   117k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|   117k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|   117k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 117k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   92|      0|#define SPH_BLEN    128U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|   117k|        orig_len = len;
  206|  4.35M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  4.35M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 4.23M, False: 117k]
  ------------------
  207|  4.23M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  4.23M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  4.23M|#define SPH_VAL   sc->val
  ------------------
  208|  4.23M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  4.23M|#define SPH_BLEN    128U
  ------------------
  209|  4.23M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  4.23M|#define SPH_BLEN    128U
  ------------------
  210|  4.23M|        }
  211|   117k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 117k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|   117k|#if SPH_64
  214|   117k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|   117k|}
sha2big.c:sha384_close:
  345|   117k|{
  346|   117k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|   117k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   117k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|   117k|}
sha2big.c:sha384_addbits_and_close:
  242|   117k|{
  243|   117k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|   117k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|   117k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|   117k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|   117k|        sc = cc;
  250|   117k|#if SPH_64
  251|   117k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|   117k|#define SPH_BLEN    128U
  ------------------
  252|       |#else
  253|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  254|       |#endif
  255|       |#ifdef PW01
  256|       |        sc->buf[current ++] = (0x100 | (ub & 0xFF)) >> (8 - n);
  257|       |#else
  258|   117k|        {
  259|   117k|                unsigned z;
  260|       |
  261|   117k|                z = 0x80U >> n;
  262|   117k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|   117k|        }
  264|   117k|#endif
  265|   117k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|   117k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   117k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   117k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 117k]
  ------------------
  266|      0|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   92|      0|#define SPH_BLEN    128U
  ------------------
  267|      0|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|      0|#define RFUN   sha3_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|      0|#define SPH_VAL   sc->val
  ------------------
  268|      0|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|      0|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|      0|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|      0|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  269|   117k|        } else {
  270|   117k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|   117k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   117k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   117k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|   117k|        }
  272|   117k|#if defined BE64
  273|       |#if defined PLW1
  274|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  275|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  276|       |#elif defined PLW4
  277|       |        memset(sc->buf + SPH_MAXPAD, 0, 2 * SPH_WLEN);
  278|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN,
  279|       |                sc->count >> 61);
  280|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + 3 * SPH_WLEN,
  281|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  282|       |#else
  283|   117k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|   117k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   117k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   117k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|   117k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|   117k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|   117k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|   117k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|   117k|#define SPH_WLEN      8U
  ------------------
  285|   117k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|   117k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|   117k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|   117k|#endif
  287|       |#elif defined LE64
  288|       |#if defined PLW1
  289|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  290|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  291|       |#elif defined PLW1
  292|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  293|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  294|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  295|       |        memset(sc->buf + SPH_MAXPAD + 2 * SPH_WLEN, 0, 2 * SPH_WLEN);
  296|       |#else
  297|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  298|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  299|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN, sc->count >> 61);
  300|       |#endif
  301|       |#else
  302|       |#if SPH_64
  303|       |#ifdef BE32
  304|       |        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  305|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  306|       |#else
  307|       |        sph_enc64le_aligned(sc->buf + SPH_MAXPAD,
  308|       |                SPH_T64(sc->count << 3) + (sph_u64)n);
  309|       |#endif
  310|       |#else
  311|       |        low = sc->count_low;
  312|       |        high = SPH_T32((sc->count_high << 3) | (low >> 29));
  313|       |        low = SPH_T32(low << 3) + (sph_u32)n;
  314|       |#ifdef BE32
  315|       |        sph_enc32be(sc->buf + SPH_MAXPAD, high);
  316|       |        sph_enc32be(sc->buf + SPH_MAXPAD + SPH_WLEN, low);
  317|       |#else
  318|       |        sph_enc32le(sc->buf + SPH_MAXPAD, low);
  319|       |        sph_enc32le(sc->buf + SPH_MAXPAD + SPH_WLEN, high);
  320|       |#endif
  321|       |#endif
  322|       |#endif
  323|   117k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|   117k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|   117k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   944k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 826k, False: 117k]
  ------------------
  330|   826k|#if defined BE64
  331|   826k|                sph_enc64be((unsigned char *)dst + 8 * u, sc->val[u]);
  332|       |#elif defined LE64
  333|       |                sph_enc64le((unsigned char *)dst + 8 * u, sc->val[u]);
  334|       |#elif defined BE32
  335|       |                sph_enc32be((unsigned char *)dst + 4 * u, sc->val[u]);
  336|       |#else
  337|       |                sph_enc32le((unsigned char *)dst + 4 * u, sc->val[u]);
  338|       |#endif
  339|   826k|        }
  340|   117k|#endif
  341|   117k|}

sha2.c:sph_dec32be_aligned:
 1471|  70.8M|{
 1472|  70.8M|#if SPH_LITTLE_ENDIAN
 1473|  70.8M|        return sph_bswap32(*(const sph_u32 *)src);
 1474|       |#elif SPH_BIG_ENDIAN
 1475|       |        return *(const sph_u32 *)src;
 1476|       |#else
 1477|       |        return ((sph_u32)(((const unsigned char *)src)[0]) << 24)
 1478|       |                | ((sph_u32)(((const unsigned char *)src)[1]) << 16)
 1479|       |                | ((sph_u32)(((const unsigned char *)src)[2]) << 8)
 1480|       |                | (sph_u32)(((const unsigned char *)src)[3]);
 1481|       |#endif
 1482|  70.8M|}
sha2.c:sph_bswap32:
 1220|  71.3M|{
 1221|  71.3M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  71.3M|        return x;
 1223|  71.3M|}
sha2.c:sph_enc64be_aligned:
 1706|  63.9k|{
 1707|  63.9k|#if SPH_LITTLE_ENDIAN
 1708|  63.9k|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|  63.9k|}
sha2.c:sph_bswap64:
 1229|  63.9k|{
 1230|  63.9k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  63.9k|        return x;
 1232|  63.9k|}
sha2.c:sph_enc32be:
 1374|   511k|{
 1375|   511k|#if defined SPH_UPTR
 1376|   511k|#if SPH_UNALIGNED
 1377|   511k|#if SPH_LITTLE_ENDIAN
 1378|   511k|        val = sph_bswap32(val);
 1379|   511k|#endif
 1380|   511k|        *(sph_u32 *)dst = val;
 1381|       |#else
 1382|       |        if (((SPH_UPTR)dst & 3) == 0) {
 1383|       |#if SPH_LITTLE_ENDIAN
 1384|       |                val = sph_bswap32(val);
 1385|       |#endif
 1386|       |                *(sph_u32 *)dst = val;
 1387|       |        } else {
 1388|       |                ((unsigned char *)dst)[0] = (unsigned char)(val >> 24);
 1389|       |                ((unsigned char *)dst)[1] = (unsigned char)(val >> 16);
 1390|       |                ((unsigned char *)dst)[2] = (unsigned char)(val >> 8);
 1391|       |                ((unsigned char *)dst)[3] = (unsigned char)(val);
 1392|       |        }
 1393|       |#endif
 1394|       |#else
 1395|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 24);
 1396|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 16);
 1397|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 8);
 1398|       |        ((unsigned char *)dst)[3] = (unsigned char)(val);
 1399|       |#endif
 1400|   511k|}
sha2big.c:sph_dec64be_aligned:
 1778|  69.7M|{
 1779|  69.7M|#if SPH_LITTLE_ENDIAN
 1780|  69.7M|        return sph_bswap64(*(const sph_u64 *)src);
 1781|       |#elif SPH_BIG_ENDIAN
 1782|       |        return *(const sph_u64 *)src;
 1783|       |#else
 1784|       |        return ((sph_u64)(((const unsigned char *)src)[0]) << 56)
 1785|       |                | ((sph_u64)(((const unsigned char *)src)[1]) << 48)
 1786|       |                | ((sph_u64)(((const unsigned char *)src)[2]) << 40)
 1787|       |                | ((sph_u64)(((const unsigned char *)src)[3]) << 32)
 1788|       |                | ((sph_u64)(((const unsigned char *)src)[4]) << 24)
 1789|       |                | ((sph_u64)(((const unsigned char *)src)[5]) << 16)
 1790|       |                | ((sph_u64)(((const unsigned char *)src)[6]) << 8)
 1791|       |                | (sph_u64)(((const unsigned char *)src)[7]);
 1792|       |#endif
 1793|  69.7M|}
sha2big.c:sph_bswap64:
 1229|  70.7M|{
 1230|  70.7M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  70.7M|        return x;
 1232|  70.7M|}
sha2big.c:sph_enc64be_aligned:
 1706|   235k|{
 1707|   235k|#if SPH_LITTLE_ENDIAN
 1708|   235k|        *(sph_u64 *)dst = sph_bswap64(val);
 1709|       |#elif SPH_BIG_ENDIAN
 1710|       |        *(sph_u64 *)dst = val;
 1711|       |#else
 1712|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1713|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1714|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1715|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1716|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1717|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1718|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1719|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1720|       |#endif
 1721|   235k|}
sha2big.c:sph_enc64be:
 1661|   826k|{
 1662|   826k|#if defined SPH_UPTR
 1663|   826k|#if SPH_UNALIGNED
 1664|   826k|#if SPH_LITTLE_ENDIAN
 1665|   826k|        val = sph_bswap64(val);
 1666|   826k|#endif
 1667|   826k|        *(sph_u64 *)dst = val;
 1668|       |#else
 1669|       |        if (((SPH_UPTR)dst & 7) == 0) {
 1670|       |#if SPH_LITTLE_ENDIAN
 1671|       |                val = sph_bswap64(val);
 1672|       |#endif
 1673|       |                *(sph_u64 *)dst = val;
 1674|       |        } else {
 1675|       |                ((unsigned char *)dst)[0] = (val >> 56);
 1676|       |                ((unsigned char *)dst)[1] = (val >> 48);
 1677|       |                ((unsigned char *)dst)[2] = (val >> 40);
 1678|       |                ((unsigned char *)dst)[3] = (val >> 32);
 1679|       |                ((unsigned char *)dst)[4] = (val >> 24);
 1680|       |                ((unsigned char *)dst)[5] = (val >> 16);
 1681|       |                ((unsigned char *)dst)[6] = (val >> 8);
 1682|       |                ((unsigned char *)dst)[7] = val;
 1683|       |        }
 1684|       |#endif
 1685|       |#else
 1686|       |        ((unsigned char *)dst)[0] = (unsigned char)(val >> 56);
 1687|       |        ((unsigned char *)dst)[1] = (unsigned char)(val >> 48);
 1688|       |        ((unsigned char *)dst)[2] = (unsigned char)(val >> 40);
 1689|       |        ((unsigned char *)dst)[3] = (unsigned char)(val >> 32);
 1690|       |        ((unsigned char *)dst)[4] = (unsigned char)(val >> 24);
 1691|       |        ((unsigned char *)dst)[5] = (unsigned char)(val >> 16);
 1692|       |        ((unsigned char *)dst)[6] = (unsigned char)(val >> 8);
 1693|       |        ((unsigned char *)dst)[7] = (unsigned char)(val);
 1694|       |#endif
 1695|   826k|}

adler32_z:
   61|  70.7k|uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
   62|  70.7k|    unsigned long sum2;
   63|  70.7k|    unsigned n;
   64|       |
   65|       |    /* split Adler-32 into component sums */
   66|  70.7k|    sum2 = (adler >> 16) & 0xffff;
   67|  70.7k|    adler &= 0xffff;
   68|       |
   69|       |    /* in case user likes doing a byte at a time, keep it fast */
   70|  70.7k|    if (len == 1) {
  ------------------
  |  Branch (70:9): [True: 1.30k, False: 69.4k]
  ------------------
   71|  1.30k|        adler += buf[0];
   72|  1.30k|        if (adler >= BASE)
  ------------------
  |  |   10|  1.30k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (72:13): [True: 18, False: 1.28k]
  ------------------
   73|     18|            adler -= BASE;
  ------------------
  |  |   10|     18|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   74|  1.30k|        sum2 += adler;
   75|  1.30k|        if (sum2 >= BASE)
  ------------------
  |  |   10|  1.30k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (75:13): [True: 574, False: 731]
  ------------------
   76|    574|            sum2 -= BASE;
  ------------------
  |  |   10|    574|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   77|  1.30k|        return adler | (sum2 << 16);
   78|  1.30k|    }
   79|       |
   80|       |    /* initial Adler-32 value (deferred check for len == 1 speed) */
   81|  69.4k|    if (buf == Z_NULL)
  ------------------
  |  |  216|  69.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (81:9): [True: 10.2k, False: 59.2k]
  ------------------
   82|  10.2k|        return 1L;
   83|       |
   84|       |    /* in case short lengths are provided, keep it somewhat fast */
   85|  59.2k|    if (len < 16) {
  ------------------
  |  Branch (85:9): [True: 22.6k, False: 36.6k]
  ------------------
   86|   151k|        while (len--) {
  ------------------
  |  Branch (86:16): [True: 128k, False: 22.6k]
  ------------------
   87|   128k|            adler += *buf++;
   88|   128k|            sum2 += adler;
   89|   128k|        }
   90|  22.6k|        if (adler >= BASE)
  ------------------
  |  |   10|  22.6k|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
  |  Branch (90:13): [True: 247, False: 22.3k]
  ------------------
   91|    247|            adler -= BASE;
  ------------------
  |  |   10|    247|#define BASE 65521U     /* largest prime smaller than 65536 */
  ------------------
   92|  22.6k|        MOD28(sum2);            /* only added so many BASE's */
  ------------------
  |  |   56|  22.6k|#  define MOD28(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  22.6k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
   93|  22.6k|        return adler | (sum2 << 16);
   94|  22.6k|    }
   95|       |
   96|       |    /* do length NMAX blocks -- requires just one modulo operation */
   97|  59.6k|    while (len >= NMAX) {
  ------------------
  |  |   11|  59.6k|#define NMAX 5552
  ------------------
  |  Branch (97:12): [True: 23.0k, False: 36.6k]
  ------------------
   98|  23.0k|        len -= NMAX;
  ------------------
  |  |   11|  23.0k|#define NMAX 5552
  ------------------
   99|  23.0k|        n = NMAX / 16;          /* NMAX is divisible by 16 */
  ------------------
  |  |   11|  23.0k|#define NMAX 5552
  ------------------
  100|  7.98M|        do {
  101|  7.98M|            DO16(buf);          /* 16 sums unrolled */
  ------------------
  |  |   18|  7.98M|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  7.98M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  7.98M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  7.98M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  7.98M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  7.98M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  7.98M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  7.98M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  7.98M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  102|  7.98M|            buf += 16;
  103|  7.98M|        } while (--n);
  ------------------
  |  Branch (103:18): [True: 7.96M, False: 23.0k]
  ------------------
  104|  23.0k|        MOD(adler);
  ------------------
  |  |   55|  23.0k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  23.0k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  105|  23.0k|        MOD(sum2);
  ------------------
  |  |   55|  23.0k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  23.0k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  106|  23.0k|    }
  107|       |
  108|       |    /* do remaining bytes (less than NMAX, still just one modulo) */
  109|  36.6k|    if (len) {                  /* avoid modulos if none remaining */
  ------------------
  |  Branch (109:9): [True: 36.5k, False: 70]
  ------------------
  110|  2.11M|        while (len >= 16) {
  ------------------
  |  Branch (110:16): [True: 2.07M, False: 36.5k]
  ------------------
  111|  2.07M|            len -= 16;
  112|  2.07M|            DO16(buf);
  ------------------
  |  |   18|  2.07M|#define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  2.07M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  2.07M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  2.07M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define DO16(buf)   DO8(buf,0); DO8(buf,8);
  |  |  ------------------
  |  |  |  |   17|  2.07M|#define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  2.07M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |               #define DO8(buf,i)  DO4(buf,i); DO4(buf,i+4);
  |  |  |  |  ------------------
  |  |  |  |  |  |   16|  2.07M|#define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |               #define DO4(buf,i)  DO2(buf,i); DO2(buf,i+2);
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   15|  2.07M|#define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |               #define DO2(buf,i)  DO1(buf,i); DO1(buf,i+1);
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |   14|  2.07M|#define DO1(buf,i)  {adler += (buf)[i]; sum2 += adler;}
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  113|  2.07M|            buf += 16;
  114|  2.07M|        }
  115|   289k|        while (len--) {
  ------------------
  |  Branch (115:16): [True: 252k, False: 36.5k]
  ------------------
  116|   252k|            adler += *buf++;
  117|   252k|            sum2 += adler;
  118|   252k|        }
  119|  36.5k|        MOD(adler);
  ------------------
  |  |   55|  36.5k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  36.5k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  120|  36.5k|        MOD(sum2);
  ------------------
  |  |   55|  36.5k|#  define MOD(a) a %= BASE
  |  |  ------------------
  |  |  |  |   10|  36.5k|#define BASE 65521U     /* largest prime smaller than 65536 */
  |  |  ------------------
  ------------------
  121|  36.5k|    }
  122|       |
  123|       |    /* return recombined sums */
  124|  36.6k|    return adler | (sum2 << 16);
  125|  59.2k|}
adler32:
  128|  70.7k|uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
  129|  70.7k|    return adler32_z(adler, buf, len);
  130|  70.7k|}

inflate_fast:
   50|  45.1k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  45.1k|    struct inflate_state FAR *state;
   52|  45.1k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  45.1k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  45.1k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  45.1k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  45.1k|    unsigned char FAR *end;     /* while out < end, enough space available */
   57|       |#ifdef INFLATE_STRICT
   58|       |    unsigned dmax;              /* maximum distance from zlib header */
   59|       |#endif
   60|  45.1k|    unsigned wsize;             /* window size or zero if not using window */
   61|  45.1k|    unsigned whave;             /* valid bytes in the window */
   62|  45.1k|    unsigned wnext;             /* window write index */
   63|  45.1k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  45.1k|    unsigned long hold;         /* local strm->hold */
   65|  45.1k|    unsigned bits;              /* local strm->bits */
   66|  45.1k|    code const FAR *lcode;      /* local strm->lencode */
   67|  45.1k|    code const FAR *dcode;      /* local strm->distcode */
   68|  45.1k|    unsigned lmask;             /* mask for first level of length codes */
   69|  45.1k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  45.1k|    code const *here;           /* retrieved table entry */
   71|  45.1k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  45.1k|    unsigned len;               /* match length, unused bytes */
   74|  45.1k|    unsigned dist;              /* match distance */
   75|  45.1k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  45.1k|    state = (struct inflate_state FAR *)strm->state;
   79|  45.1k|    in = strm->next_in;
   80|  45.1k|    last = in + (strm->avail_in - 5);
   81|  45.1k|    out = strm->next_out;
   82|  45.1k|    beg = out - (start - strm->avail_out);
   83|  45.1k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  45.1k|    wsize = state->wsize;
   88|  45.1k|    whave = state->whave;
   89|  45.1k|    wnext = state->wnext;
   90|  45.1k|    window = state->window;
   91|  45.1k|    hold = state->hold;
   92|  45.1k|    bits = state->bits;
   93|  45.1k|    lcode = state->lencode;
   94|  45.1k|    dcode = state->distcode;
   95|  45.1k|    lmask = (1U << state->lenbits) - 1;
   96|  45.1k|    dmask = (1U << state->distbits) - 1;
   97|       |
   98|       |    /* decode literals and length/distances until end-of-block or not enough
   99|       |       input data or output space */
  100|  3.15M|    do {
  101|  3.15M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 1.58M, False: 1.57M]
  ------------------
  102|  1.58M|            hold += (unsigned long)(*in++) << bits;
  103|  1.58M|            bits += 8;
  104|  1.58M|            hold += (unsigned long)(*in++) << bits;
  105|  1.58M|            bits += 8;
  106|  1.58M|        }
  107|  3.15M|        here = lcode + (hold & lmask);
  108|  3.44M|      dolen:
  109|  3.44M|        op = (unsigned)(here->bits);
  110|  3.44M|        hold >>= op;
  111|  3.44M|        bits -= op;
  112|  3.44M|        op = (unsigned)(here->op);
  113|  3.44M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 1.94M, False: 1.50M]
  ------------------
  114|  1.94M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  1.94M|                    "inflate:         literal '%c'\n" :
  116|  1.94M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  1.94M|            *out++ = (unsigned char)(here->val);
  118|  1.94M|        }
  119|  1.50M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 1.21M, False: 293k]
  ------------------
  120|  1.21M|            len = (unsigned)(here->val);
  121|  1.21M|            op &= 15;                           /* number of extra bits */
  122|  1.21M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 274k, False: 937k]
  ------------------
  123|   274k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 3.59k, False: 270k]
  ------------------
  124|  3.59k|                    hold += (unsigned long)(*in++) << bits;
  125|  3.59k|                    bits += 8;
  126|  3.59k|                }
  127|   274k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   274k|                hold >>= op;
  129|   274k|                bits -= op;
  130|   274k|            }
  131|  1.21M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  1.21M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 284k, False: 927k]
  ------------------
  133|   284k|                hold += (unsigned long)(*in++) << bits;
  134|   284k|                bits += 8;
  135|   284k|                hold += (unsigned long)(*in++) << bits;
  136|   284k|                bits += 8;
  137|   284k|            }
  138|  1.21M|            here = dcode + (hold & dmask);
  139|  1.25M|          dodist:
  140|  1.25M|            op = (unsigned)(here->bits);
  141|  1.25M|            hold >>= op;
  142|  1.25M|            bits -= op;
  143|  1.25M|            op = (unsigned)(here->op);
  144|  1.25M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 1.21M, False: 43.3k]
  ------------------
  145|  1.21M|                dist = (unsigned)(here->val);
  146|  1.21M|                op &= 15;                       /* number of extra bits */
  147|  1.21M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 1.41k, False: 1.20M]
  ------------------
  148|  1.41k|                    hold += (unsigned long)(*in++) << bits;
  149|  1.41k|                    bits += 8;
  150|  1.41k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 1.41k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  1.41k|                }
  155|  1.21M|                dist += (unsigned)hold & ((1U << op) - 1);
  156|       |#ifdef INFLATE_STRICT
  157|       |                if (dist > dmax) {
  158|       |                    strm->msg = (z_const char *)
  159|       |                        "invalid distance too far back";
  160|       |                    state->mode = BAD;
  161|       |                    break;
  162|       |                }
  163|       |#endif
  164|  1.21M|                hold >>= op;
  165|  1.21M|                bits -= op;
  166|  1.21M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  1.21M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  1.21M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 58.1k, False: 1.15M]
  ------------------
  169|  58.1k|                    op = dist - op;             /* distance back in window */
  170|  58.1k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 192, False: 57.9k]
  ------------------
  171|    192|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 192, False: 0]
  ------------------
  172|    192|                            strm->msg = (z_const char *)
  173|    192|                                "invalid distance too far back";
  174|    192|                            state->mode = BAD;
  175|    192|                            break;
  176|    192|                        }
  177|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
  178|       |                        if (len <= op - whave) {
  179|       |                            do {
  180|       |                                *out++ = 0;
  181|       |                            } while (--len);
  182|       |                            continue;
  183|       |                        }
  184|       |                        len -= op - whave;
  185|       |                        do {
  186|       |                            *out++ = 0;
  187|       |                        } while (--op > whave);
  188|       |                        if (op == 0) {
  189|       |                            from = out - dist;
  190|       |                            do {
  191|       |                                *out++ = *from++;
  192|       |                            } while (--len);
  193|       |                            continue;
  194|       |                        }
  195|       |#endif
  196|    192|                    }
  197|  57.9k|                    from = window;
  198|  57.9k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 8.33k, False: 49.6k]
  ------------------
  199|  8.33k|                        from += wsize - op;
  200|  8.33k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 892, False: 7.44k]
  ------------------
  201|    892|                            len -= op;
  202|   126k|                            do {
  203|   126k|                                *out++ = *from++;
  204|   126k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 125k, False: 892]
  ------------------
  205|    892|                            from = out - dist;  /* rest from output */
  206|    892|                        }
  207|  8.33k|                    }
  208|  49.6k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 678, False: 48.9k]
  ------------------
  209|    678|                        from += wsize + wnext - op;
  210|    678|                        op -= wnext;
  211|    678|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 129, False: 549]
  ------------------
  212|    129|                            len -= op;
  213|  5.89k|                            do {
  214|  5.89k|                                *out++ = *from++;
  215|  5.89k|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 5.76k, False: 129]
  ------------------
  216|    129|                            from = window;
  217|    129|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 42, False: 87]
  ------------------
  218|     42|                                op = wnext;
  219|     42|                                len -= op;
  220|  1.10k|                                do {
  221|  1.10k|                                    *out++ = *from++;
  222|  1.10k|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 1.06k, False: 42]
  ------------------
  223|     42|                                from = out - dist;      /* rest from output */
  224|     42|                            }
  225|    129|                        }
  226|    678|                    }
  227|  48.9k|                    else {                      /* contiguous in window */
  228|  48.9k|                        from += wnext - op;
  229|  48.9k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 12.7k, False: 36.1k]
  ------------------
  230|  12.7k|                            len -= op;
  231|   568k|                            do {
  232|   568k|                                *out++ = *from++;
  233|   568k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 555k, False: 12.7k]
  ------------------
  234|  12.7k|                            from = out - dist;  /* rest from output */
  235|  12.7k|                        }
  236|  48.9k|                    }
  237|   909k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 851k, False: 57.9k]
  ------------------
  238|   851k|                        *out++ = *from++;
  239|   851k|                        *out++ = *from++;
  240|   851k|                        *out++ = *from++;
  241|   851k|                        len -= 3;
  242|   851k|                    }
  243|  57.9k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 20.3k, False: 37.6k]
  ------------------
  244|  20.3k|                        *out++ = *from++;
  245|  20.3k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 13.8k, False: 6.51k]
  ------------------
  246|  13.8k|                            *out++ = *from++;
  247|  20.3k|                    }
  248|  57.9k|                }
  249|  1.15M|                else {
  250|  1.15M|                    from = out - dist;          /* copy direct from output */
  251|  46.0M|                    do {                        /* minimum length is three */
  252|  46.0M|                        *out++ = *from++;
  253|  46.0M|                        *out++ = *from++;
  254|  46.0M|                        *out++ = *from++;
  255|  46.0M|                        len -= 3;
  256|  46.0M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 44.9M, False: 1.15M]
  ------------------
  257|  1.15M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 333k, False: 820k]
  ------------------
  258|   333k|                        *out++ = *from++;
  259|   333k|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 180k, False: 152k]
  ------------------
  260|   180k|                            *out++ = *from++;
  261|   333k|                    }
  262|  1.15M|                }
  263|  1.21M|            }
  264|  43.3k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 43.3k, False: 25]
  ------------------
  265|  43.3k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  43.3k|                goto dodist;
  267|  43.3k|            }
  268|     25|            else {
  269|     25|                strm->msg = (z_const char *)"invalid distance code";
  270|     25|                state->mode = BAD;
  271|     25|                break;
  272|     25|            }
  273|  1.25M|        }
  274|   293k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 289k, False: 4.25k]
  ------------------
  275|   289k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|   289k|            goto dolen;
  277|   289k|        }
  278|  4.25k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 4.23k, False: 22]
  ------------------
  279|  4.23k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  4.23k|            state->mode = TYPE;
  281|  4.23k|            break;
  282|  4.23k|        }
  283|     22|        else {
  284|     22|            strm->msg = (z_const char *)"invalid literal/length code";
  285|     22|            state->mode = BAD;
  286|     22|            break;
  287|     22|        }
  288|  3.44M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 3.11M, False: 39.4k]
  |  Branch (288:27): [True: 3.11M, False: 1.14k]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|  45.1k|    len = bits >> 3;
  292|  45.1k|    in -= len;
  293|  45.1k|    bits -= len << 3;
  294|  45.1k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|  45.1k|    strm->next_in = in;
  298|  45.1k|    strm->next_out = out;
  299|  45.1k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 21.9k, False: 23.1k]
  ------------------
  300|  45.1k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 43.9k, False: 1.16k]
  ------------------
  301|  43.9k|                                 257 + (end - out) : 257 - (out - end));
  302|  45.1k|    state->hold = hold;
  303|  45.1k|    state->bits = bits;
  304|  45.1k|    return;
  305|  45.1k|}

inflateResetKeep:
  100|  10.5k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|  10.5k|    struct inflate_state FAR *state;
  102|       |
  103|  10.5k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 10.5k]
  ------------------
  104|  10.5k|    state = (struct inflate_state FAR *)strm->state;
  105|  10.5k|    strm->total_in = strm->total_out = state->total = 0;
  106|  10.5k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|  10.5k|    strm->data_type = 0;
  108|  10.5k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 10.5k, False: 0]
  ------------------
  109|  10.5k|        strm->adler = state->wrap & 1;
  110|  10.5k|    state->mode = HEAD;
  111|  10.5k|    state->last = 0;
  112|  10.5k|    state->havedict = 0;
  113|  10.5k|    state->flags = -1;
  114|  10.5k|    state->dmax = 32768U;
  115|  10.5k|    state->head = Z_NULL;
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|  10.5k|    state->hold = 0;
  117|  10.5k|    state->bits = 0;
  118|  10.5k|    state->lencode = state->distcode = state->next = state->codes;
  119|  10.5k|    state->sane = 1;
  120|  10.5k|    state->back = -1;
  121|  10.5k|    Tracev((stderr, "inflate: reset\n"));
  122|  10.5k|    return Z_OK;
  ------------------
  |  |  181|  10.5k|#define Z_OK            0
  ------------------
  123|  10.5k|}
inflateReset:
  125|  10.5k|int ZEXPORT inflateReset(z_streamp strm) {
  126|  10.5k|    struct inflate_state FAR *state;
  127|       |
  128|  10.5k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 10.5k]
  ------------------
  129|  10.5k|    state = (struct inflate_state FAR *)strm->state;
  130|  10.5k|    state->wsize = 0;
  131|  10.5k|    state->whave = 0;
  132|  10.5k|    state->wnext = 0;
  133|  10.5k|    return inflateResetKeep(strm);
  134|  10.5k|}
inflateReset2:
  136|  10.5k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  137|  10.5k|    int wrap;
  138|  10.5k|    struct inflate_state FAR *state;
  139|       |
  140|       |    /* get the state */
  141|  10.5k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (141:9): [True: 0, False: 10.5k]
  ------------------
  142|  10.5k|    state = (struct inflate_state FAR *)strm->state;
  143|       |
  144|       |    /* extract wrap request from windowBits parameter */
  145|  10.5k|    if (windowBits < 0) {
  ------------------
  |  Branch (145:9): [True: 0, False: 10.5k]
  ------------------
  146|      0|        if (windowBits < -15)
  ------------------
  |  Branch (146:13): [True: 0, False: 0]
  ------------------
  147|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  148|      0|        wrap = 0;
  149|      0|        windowBits = -windowBits;
  150|      0|    }
  151|  10.5k|    else {
  152|  10.5k|        wrap = (windowBits >> 4) + 5;
  153|  10.5k|#ifdef GUNZIP
  154|  10.5k|        if (windowBits < 48)
  ------------------
  |  Branch (154:13): [True: 10.5k, False: 0]
  ------------------
  155|  10.5k|            windowBits &= 15;
  156|  10.5k|#endif
  157|  10.5k|    }
  158|       |
  159|       |    /* set number of window bits, free window if different */
  160|  10.5k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (160:9): [True: 10.5k, False: 0]
  |  Branch (160:24): [True: 0, False: 10.5k]
  |  Branch (160:42): [True: 0, False: 10.5k]
  ------------------
  161|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  162|  10.5k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|  21.1k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (162:9): [True: 0, False: 10.5k]
  |  Branch (162:36): [True: 0, False: 0]
  ------------------
  163|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  164|      0|        state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  165|      0|    }
  166|       |
  167|       |    /* update state and reset the rest of it */
  168|  10.5k|    state->wrap = wrap;
  169|  10.5k|    state->wbits = (unsigned)windowBits;
  170|  10.5k|    return inflateReset(strm);
  171|  10.5k|}
inflateInit2_:
  174|  10.5k|                          const char *version, int stream_size) {
  175|  10.5k|    int ret;
  176|  10.5k|    struct inflate_state FAR *state;
  177|       |
  178|  10.5k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|  21.1k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|  10.5k|#define ZLIB_VERSION "1.3.2.1-motley"
  ------------------
  |  Branch (178:9): [True: 0, False: 10.5k]
  |  Branch (178:30): [True: 0, False: 10.5k]
  ------------------
  179|  10.5k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (179:9): [True: 0, False: 10.5k]
  ------------------
  180|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  181|  10.5k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (181:9): [True: 0, False: 10.5k]
  ------------------
  182|  10.5k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  183|  10.5k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (183:9): [True: 10.5k, False: 0]
  ------------------
  184|       |#ifdef Z_SOLO
  185|       |        return Z_STREAM_ERROR;
  186|       |#else
  187|  10.5k|        strm->zalloc = zcalloc;
  188|  10.5k|        strm->opaque = (voidpf)0;
  189|  10.5k|#endif
  190|  10.5k|    }
  191|  10.5k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (191:9): [True: 10.5k, False: 0]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|  10.5k|        strm->zfree = zcfree;
  196|  10.5k|#endif
  197|  10.5k|    state = (struct inflate_state FAR *)
  198|  10.5k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|  10.5k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  199|  10.5k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
  |  Branch (199:9): [True: 0, False: 10.5k]
  ------------------
  200|  10.5k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|  10.5k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  201|  10.5k|    Tracev((stderr, "inflate: allocated\n"));
  202|  10.5k|    strm->state = (struct internal_state FAR *)state;
  203|  10.5k|    state->strm = strm;
  204|  10.5k|    state->window = Z_NULL;
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  205|  10.5k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  206|  10.5k|    ret = inflateReset2(strm, windowBits);
  207|  10.5k|    if (ret != Z_OK) {
  ------------------
  |  |  181|  10.5k|#define Z_OK            0
  ------------------
  |  Branch (207:9): [True: 0, False: 10.5k]
  ------------------
  208|      0|        ZFREE(strm, state);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  209|      0|        strm->state = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  210|      0|    }
  211|  10.5k|    return ret;
  212|  10.5k|}
inflateInit_:
  215|  10.5k|                         int stream_size) {
  216|  10.5k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   76|  10.5k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  287|  10.5k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  217|  10.5k|}
inflate:
  474|  82.5k|int ZEXPORT inflate(z_streamp strm, int flush) {
  475|  82.5k|    struct inflate_state FAR *state;
  476|  82.5k|    z_const unsigned char FAR *next;    /* next input */
  477|  82.5k|    unsigned char FAR *put;     /* next output */
  478|  82.5k|    unsigned have, left;        /* available input and output */
  479|  82.5k|    unsigned long hold;         /* bit buffer */
  480|  82.5k|    unsigned bits;              /* bits in bit buffer */
  481|  82.5k|    unsigned in, out;           /* save starting available input and output */
  482|  82.5k|    unsigned copy;              /* number of stored or match bytes to copy */
  483|  82.5k|    unsigned char FAR *from;    /* where to copy match bytes from */
  484|  82.5k|    code here;                  /* current decoding table entry */
  485|  82.5k|    code last;                  /* parent table entry */
  486|  82.5k|    unsigned len;               /* length to copy for repeats, bits to drop */
  487|  82.5k|    int ret;                    /* return code */
  488|  82.5k|#ifdef GUNZIP
  489|  82.5k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  490|  82.5k|#endif
  491|  82.5k|    static const unsigned short order[19] = /* permutation of code lengths */
  492|  82.5k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  493|       |
  494|  82.5k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   165k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (494:9): [True: 0, False: 82.5k]
  |  Branch (494:36): [True: 0, False: 82.5k]
  ------------------
  495|  82.5k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   165k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (495:10): [True: 0, False: 82.5k]
  |  Branch (495:37): [True: 0, False: 0]
  ------------------
  496|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  497|       |
  498|  82.5k|    state = (struct inflate_state FAR *)strm->state;
  499|  82.5k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (499:9): [True: 241, False: 82.2k]
  ------------------
  500|  82.5k|    LOAD();
  ------------------
  |  |  329|  82.5k|    do { \
  |  |  330|  82.5k|        put = strm->next_out; \
  |  |  331|  82.5k|        left = strm->avail_out; \
  |  |  332|  82.5k|        next = strm->next_in; \
  |  |  333|  82.5k|        have = strm->avail_in; \
  |  |  334|  82.5k|        hold = state->hold; \
  |  |  335|  82.5k|        bits = state->bits; \
  |  |  336|  82.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 82.5k]
  |  |  ------------------
  ------------------
  501|  82.5k|    in = have;
  502|  82.5k|    out = left;
  503|  82.5k|    ret = Z_OK;
  ------------------
  |  |  181|  82.5k|#define Z_OK            0
  ------------------
  504|  82.5k|    for (;;)
  505|   498k|        switch (state->mode) {
  506|  10.6k|        case HEAD:
  ------------------
  |  Branch (506:9): [True: 10.6k, False: 488k]
  ------------------
  507|  10.6k|            if (state->wrap == 0) {
  ------------------
  |  Branch (507:17): [True: 0, False: 10.6k]
  ------------------
  508|      0|                state->mode = TYPEDO;
  509|      0|                break;
  510|      0|            }
  511|  10.6k|            NEEDBITS(16);
  ------------------
  |  |  369|  10.6k|    do { \
  |  |  370|  31.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 21.2k, False: 10.5k]
  |  |  ------------------
  |  |  371|  21.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  21.2k|    do { \
  |  |  |  |  360|  21.2k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 187, False: 21.0k]
  |  |  |  |  ------------------
  |  |  |  |  361|  21.2k|        have--; \
  |  |  |  |  362|  21.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  21.0k|        bits += 8; \
  |  |  |  |  364|  21.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 21.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  10.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  512|  10.5k|#ifdef GUNZIP
  513|  10.5k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (513:17): [True: 0, False: 10.5k]
  |  Branch (513:38): [True: 0, False: 0]
  ------------------
  514|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (514:21): [True: 0, False: 0]
  ------------------
  515|      0|                    state->wbits = 15;
  516|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  517|      0|                CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  518|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  519|      0|                state->mode = FLAGS;
  520|      0|                break;
  521|      0|            }
  522|  10.5k|            if (state->head != Z_NULL)
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (522:17): [True: 0, False: 10.5k]
  ------------------
  523|      0|                state->head->done = -1;
  524|  10.5k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (524:17): [True: 0, False: 10.5k]
  ------------------
  525|       |#else
  526|       |            if (
  527|       |#endif
  528|  10.5k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  376|  10.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (528:17): [True: 219, False: 10.2k]
  ------------------
  529|    219|                strm->msg = (z_const char *)"incorrect header check";
  530|    219|                state->mode = BAD;
  531|    219|                break;
  532|    219|            }
  533|  10.2k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  376|  10.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|  10.2k|#define Z_DEFLATED   8
  ------------------
  |  Branch (533:17): [True: 52, False: 10.2k]
  ------------------
  534|     52|                strm->msg = (z_const char *)"unknown compression method";
  535|     52|                state->mode = BAD;
  536|     52|                break;
  537|     52|            }
  538|  10.2k|            DROPBITS(4);
  ------------------
  |  |  380|  10.2k|    do { \
  |  |  381|  10.2k|        hold >>= (n); \
  |  |  382|  10.2k|        bits -= (unsigned)(n); \
  |  |  383|  10.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 10.2k]
  |  |  ------------------
  ------------------
  539|  10.2k|            len = BITS(4) + 8;
  ------------------
  |  |  376|  10.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  540|  10.2k|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 10.2k]
  ------------------
  541|      0|                state->wbits = len;
  542|  10.2k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (542:17): [True: 10, False: 10.2k]
  |  Branch (542:29): [True: 0, False: 10.2k]
  ------------------
  543|     10|                strm->msg = (z_const char *)"invalid window size";
  544|     10|                state->mode = BAD;
  545|     10|                break;
  546|     10|            }
  547|  10.2k|            state->dmax = 1U << len;
  548|  10.2k|            state->flags = 0;               /* indicate zlib header */
  549|  10.2k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  550|  10.2k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|  10.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  551|  10.2k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (551:27): [True: 111, False: 10.1k]
  ------------------
  552|  10.2k|            INITBITS();
  ------------------
  |  |  351|  10.2k|    do { \
  |  |  352|  10.2k|        hold = 0; \
  |  |  353|  10.2k|        bits = 0; \
  |  |  354|  10.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 10.2k]
  |  |  ------------------
  ------------------
  553|  10.2k|            break;
  554|      0|#ifdef GUNZIP
  555|      0|        case FLAGS:
  ------------------
  |  Branch (555:9): [True: 0, False: 498k]
  ------------------
  556|      0|            NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  557|      0|            state->flags = (int)(hold);
  558|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  213|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (558:17): [True: 0, False: 0]
  ------------------
  559|      0|                strm->msg = (z_const char *)"unknown compression method";
  560|      0|                state->mode = BAD;
  561|      0|                break;
  562|      0|            }
  563|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (563:17): [True: 0, False: 0]
  ------------------
  564|      0|                strm->msg = (z_const char *)"unknown header flags set";
  565|      0|                state->mode = BAD;
  566|      0|                break;
  567|      0|            }
  568|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (568:17): [True: 0, False: 0]
  ------------------
  569|      0|                state->head->text = (int)((hold >> 8) & 1);
  570|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (570:17): [True: 0, False: 0]
  |  Branch (570:44): [True: 0, False: 0]
  ------------------
  571|      0|                CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  572|      0|            INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  573|      0|            state->mode = TIME;
  574|       |                /* fallthrough */
  575|      0|        case TIME:
  ------------------
  |  Branch (575:9): [True: 0, False: 498k]
  ------------------
  576|      0|            NEEDBITS(32);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  577|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (577:17): [True: 0, False: 0]
  ------------------
  578|      0|                state->head->time = hold;
  579|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (579:17): [True: 0, False: 0]
  |  Branch (579:44): [True: 0, False: 0]
  ------------------
  580|      0|                CRC4(state->check, hold);
  ------------------
  |  |  318|      0|    do { \
  |  |  319|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  320|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  321|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  322|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  323|      0|        check = crc32(check, hbuf, 4); \
  |  |  324|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (324:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  581|      0|            INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  582|      0|            state->mode = OS;
  583|       |                /* fallthrough */
  584|      0|        case OS:
  ------------------
  |  Branch (584:9): [True: 0, False: 498k]
  ------------------
  585|      0|            NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  586|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (586:17): [True: 0, False: 0]
  ------------------
  587|      0|                state->head->xflags = (int)(hold & 0xff);
  588|      0|                state->head->os = (int)(hold >> 8);
  589|      0|            }
  590|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (590:17): [True: 0, False: 0]
  |  Branch (590:44): [True: 0, False: 0]
  ------------------
  591|      0|                CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  592|      0|            INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  593|      0|            state->mode = EXLEN;
  594|       |                /* fallthrough */
  595|      0|        case EXLEN:
  ------------------
  |  Branch (595:9): [True: 0, False: 498k]
  ------------------
  596|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (596:17): [True: 0, False: 0]
  ------------------
  597|      0|                NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  598|      0|                state->length = (unsigned)(hold);
  599|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (599:21): [True: 0, False: 0]
  ------------------
  600|      0|                    state->head->extra_len = (unsigned)hold;
  601|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (601:21): [True: 0, False: 0]
  |  Branch (601:48): [True: 0, False: 0]
  ------------------
  602|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  311|      0|    do { \
  |  |  312|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  313|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  314|      0|        check = crc32(check, hbuf, 2); \
  |  |  315|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (315:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  603|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  604|      0|            }
  605|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (605:22): [True: 0, False: 0]
  ------------------
  606|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  607|      0|            state->mode = EXTRA;
  608|       |                /* fallthrough */
  609|      0|        case EXTRA:
  ------------------
  |  Branch (609:9): [True: 0, False: 498k]
  ------------------
  610|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (610:17): [True: 0, False: 0]
  ------------------
  611|      0|                copy = state->length;
  612|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (612:21): [True: 0, False: 0]
  ------------------
  613|      0|                if (copy) {
  ------------------
  |  Branch (613:21): [True: 0, False: 0]
  ------------------
  614|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (614:25): [True: 0, False: 0]
  ------------------
  615|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (615:25): [True: 0, False: 0]
  ------------------
  616|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (616:25): [True: 0, False: 0]
  ------------------
  617|      0|                            state->head->extra_max) {
  618|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  216|      0|#    define zmemcpy memcpy
  ------------------
  619|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (619:33): [True: 0, False: 0]
  ------------------
  620|      0|                                state->head->extra_max - len : copy);
  621|      0|                    }
  622|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (622:25): [True: 0, False: 0]
  |  Branch (622:52): [True: 0, False: 0]
  ------------------
  623|      0|                        state->check = crc32(state->check, next, copy);
  624|      0|                    have -= copy;
  625|      0|                    next += copy;
  626|      0|                    state->length -= copy;
  627|      0|                }
  628|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (628:21): [True: 0, False: 0]
  ------------------
  629|      0|            }
  630|      0|            state->length = 0;
  631|      0|            state->mode = NAME;
  632|       |                /* fallthrough */
  633|      0|        case NAME:
  ------------------
  |  Branch (633:9): [True: 0, False: 498k]
  ------------------
  634|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (634:17): [True: 0, False: 0]
  ------------------
  635|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (635:21): [True: 0, False: 0]
  ------------------
  636|      0|                copy = 0;
  637|      0|                do {
  638|      0|                    len = (unsigned)(next[copy++]);
  639|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (639:25): [True: 0, False: 0]
  ------------------
  640|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (640:29): [True: 0, False: 0]
  ------------------
  641|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (641:29): [True: 0, False: 0]
  ------------------
  642|      0|                        state->head->name[state->length++] = (Bytef)len;
  643|      0|                } while (len && copy < have);
  ------------------
  |  Branch (643:26): [True: 0, False: 0]
  |  Branch (643:33): [True: 0, False: 0]
  ------------------
  644|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (644:21): [True: 0, False: 0]
  |  Branch (644:48): [True: 0, False: 0]
  ------------------
  645|      0|                    state->check = crc32(state->check, next, copy);
  646|      0|                have -= copy;
  647|      0|                next += copy;
  648|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (648:21): [True: 0, False: 0]
  ------------------
  649|      0|            }
  650|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (650:22): [True: 0, False: 0]
  ------------------
  651|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  652|      0|            state->length = 0;
  653|      0|            state->mode = COMMENT;
  654|       |                /* fallthrough */
  655|      0|        case COMMENT:
  ------------------
  |  Branch (655:9): [True: 0, False: 498k]
  ------------------
  656|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (656:17): [True: 0, False: 0]
  ------------------
  657|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (657:21): [True: 0, False: 0]
  ------------------
  658|      0|                copy = 0;
  659|      0|                do {
  660|      0|                    len = (unsigned)(next[copy++]);
  661|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (661:25): [True: 0, False: 0]
  ------------------
  662|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (662:29): [True: 0, False: 0]
  ------------------
  663|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (663:29): [True: 0, False: 0]
  ------------------
  664|      0|                        state->head->comment[state->length++] = (Bytef)len;
  665|      0|                } while (len && copy < have);
  ------------------
  |  Branch (665:26): [True: 0, False: 0]
  |  Branch (665:33): [True: 0, False: 0]
  ------------------
  666|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (666:21): [True: 0, False: 0]
  |  Branch (666:48): [True: 0, False: 0]
  ------------------
  667|      0|                    state->check = crc32(state->check, next, copy);
  668|      0|                have -= copy;
  669|      0|                next += copy;
  670|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (670:21): [True: 0, False: 0]
  ------------------
  671|      0|            }
  672|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (672:22): [True: 0, False: 0]
  ------------------
  673|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  674|      0|            state->mode = HCRC;
  675|       |                /* fallthrough */
  676|      0|        case HCRC:
  ------------------
  |  Branch (676:9): [True: 0, False: 498k]
  ------------------
  677|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (677:17): [True: 0, False: 0]
  ------------------
  678|      0|                NEEDBITS(16);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  679|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (679:21): [True: 0, False: 0]
  |  Branch (679:42): [True: 0, False: 0]
  ------------------
  680|      0|                    strm->msg = (z_const char *)"header crc mismatch";
  681|      0|                    state->mode = BAD;
  682|      0|                    break;
  683|      0|                }
  684|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  685|      0|            }
  686|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (686:17): [True: 0, False: 0]
  ------------------
  687|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  688|      0|                state->head->done = 1;
  689|      0|            }
  690|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  691|      0|            state->mode = TYPE;
  692|      0|            break;
  693|      0|#endif
  694|    250|        case DICTID:
  ------------------
  |  Branch (694:9): [True: 250, False: 498k]
  ------------------
  695|    250|            NEEDBITS(32);
  ------------------
  |  |  369|    250|    do { \
  |  |  370|    604|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 566, False: 38]
  |  |  ------------------
  |  |  371|    566|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|    566|    do { \
  |  |  |  |  360|    566|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 212, False: 354]
  |  |  |  |  ------------------
  |  |  |  |  361|    566|        have--; \
  |  |  |  |  362|    354|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|    354|        bits += 8; \
  |  |  |  |  364|    354|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 354]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|    250|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  696|     38|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|     38|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|     38|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  697|     38|            INITBITS();
  ------------------
  |  |  351|     38|    do { \
  |  |  352|     38|        hold = 0; \
  |  |  353|     38|        bits = 0; \
  |  |  354|     38|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 38]
  |  |  ------------------
  ------------------
  698|     38|            state->mode = DICT;
  699|       |                /* fallthrough */
  700|     74|        case DICT:
  ------------------
  |  Branch (700:9): [True: 36, False: 498k]
  ------------------
  701|     74|            if (state->havedict == 0) {
  ------------------
  |  Branch (701:17): [True: 74, False: 0]
  ------------------
  702|     74|                RESTORE();
  ------------------
  |  |  340|     74|    do { \
  |  |  341|     74|        strm->next_out = put; \
  |  |  342|     74|        strm->avail_out = left; \
  |  |  343|     74|        strm->next_in = next; \
  |  |  344|     74|        strm->avail_in = have; \
  |  |  345|     74|        state->hold = hold; \
  |  |  346|     74|        state->bits = bits; \
  |  |  347|     74|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 74]
  |  |  ------------------
  ------------------
  703|     74|                return Z_NEED_DICT;
  ------------------
  |  |  183|     74|#define Z_NEED_DICT     2
  ------------------
  704|     74|            }
  705|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  706|      0|            state->mode = TYPE;
  707|       |                /* fallthrough */
  708|  18.7k|        case TYPE:
  ------------------
  |  Branch (708:9): [True: 18.7k, False: 480k]
  ------------------
  709|  18.7k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|  37.4k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  18.7k|#define Z_TREES         6
  ------------------
  |  Branch (709:17): [True: 0, False: 18.7k]
  |  Branch (709:37): [True: 0, False: 18.7k]
  ------------------
  710|       |                /* fallthrough */
  711|  18.9k|        case TYPEDO:
  ------------------
  |  Branch (711:9): [True: 242, False: 498k]
  ------------------
  712|  18.9k|            if (state->last) {
  ------------------
  |  Branch (712:17): [True: 4.02k, False: 14.9k]
  ------------------
  713|  4.02k|                BYTEBITS();
  ------------------
  |  |  387|  4.02k|    do { \
  |  |  388|  4.02k|        hold >>= bits & 7; \
  |  |  389|  4.02k|        bits -= bits & 7; \
  |  |  390|  4.02k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 4.02k]
  |  |  ------------------
  ------------------
  714|  4.02k|                state->mode = CHECK;
  715|  4.02k|                break;
  716|  4.02k|            }
  717|  14.9k|            NEEDBITS(3);
  ------------------
  |  |  369|  14.9k|    do { \
  |  |  370|  26.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 12.0k, False: 14.6k]
  |  |  ------------------
  |  |  371|  14.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  12.0k|    do { \
  |  |  |  |  360|  12.0k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 267, False: 11.8k]
  |  |  |  |  ------------------
  |  |  |  |  361|  12.0k|        have--; \
  |  |  |  |  362|  11.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  11.8k|        bits += 8; \
  |  |  |  |  364|  11.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 11.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  14.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 14.6k]
  |  |  ------------------
  ------------------
  718|  14.6k|            state->last = BITS(1);
  ------------------
  |  |  376|  14.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  719|  14.6k|            DROPBITS(1);
  ------------------
  |  |  380|  14.6k|    do { \
  |  |  381|  14.6k|        hold >>= (n); \
  |  |  382|  14.6k|        bits -= (unsigned)(n); \
  |  |  383|  14.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 14.6k]
  |  |  ------------------
  ------------------
  720|  14.6k|            switch (BITS(2)) {
  ------------------
  |  |  376|  14.6k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  721|    612|            case 0:                             /* stored block */
  ------------------
  |  Branch (721:13): [True: 612, False: 14.0k]
  ------------------
  722|    612|                Tracev((stderr, "inflate:     stored block%s\n",
  723|    612|                        state->last ? " (last)" : ""));
  724|    612|                state->mode = STORED;
  725|    612|                break;
  726|  7.11k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (726:13): [True: 7.11k, False: 7.54k]
  ------------------
  727|  7.11k|                inflate_fixed(state);
  728|  7.11k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  729|  7.11k|                        state->last ? " (last)" : ""));
  730|  7.11k|                state->mode = LEN_;             /* decode codes */
  731|  7.11k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  7.11k|#define Z_TREES         6
  ------------------
  |  Branch (731:21): [True: 0, False: 7.11k]
  ------------------
  732|      0|                    DROPBITS(2);
  ------------------
  |  |  380|      0|    do { \
  |  |  381|      0|        hold >>= (n); \
  |  |  382|      0|        bits -= (unsigned)(n); \
  |  |  383|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  733|      0|                    goto inf_leave;
  734|      0|                }
  735|  7.11k|                break;
  736|  7.11k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (736:13): [True: 6.88k, False: 7.76k]
  ------------------
  737|  6.88k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  738|  6.88k|                        state->last ? " (last)" : ""));
  739|  6.88k|                state->mode = TABLE;
  740|  6.88k|                break;
  741|     44|            default:
  ------------------
  |  Branch (741:13): [True: 44, False: 14.6k]
  ------------------
  742|     44|                strm->msg = (z_const char *)"invalid block type";
  743|     44|                state->mode = BAD;
  744|  14.6k|            }
  745|  14.6k|            DROPBITS(2);
  ------------------
  |  |  380|  14.6k|    do { \
  |  |  381|  14.6k|        hold >>= (n); \
  |  |  382|  14.6k|        bits -= (unsigned)(n); \
  |  |  383|  14.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 14.6k]
  |  |  ------------------
  ------------------
  746|  14.6k|            break;
  747|  1.06k|        case STORED:
  ------------------
  |  Branch (747:9): [True: 1.06k, False: 497k]
  ------------------
  748|  1.06k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  387|  1.06k|    do { \
  |  |  388|  1.06k|        hold >>= bits & 7; \
  |  |  389|  1.06k|        bits -= bits & 7; \
  |  |  390|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 1.06k]
  |  |  ------------------
  ------------------
  749|  1.06k|            NEEDBITS(32);
  ------------------
  |  |  369|  1.06k|    do { \
  |  |  370|  2.98k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 2.63k, False: 346]
  |  |  ------------------
  |  |  371|  2.63k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  2.63k|    do { \
  |  |  |  |  360|  2.63k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 722, False: 1.91k]
  |  |  |  |  ------------------
  |  |  |  |  361|  2.63k|        have--; \
  |  |  |  |  362|  1.91k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  1.91k|        bits += 8; \
  |  |  |  |  364|  1.91k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 1.91k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  1.06k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 346]
  |  |  ------------------
  ------------------
  750|    346|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (750:17): [True: 81, False: 265]
  ------------------
  751|     81|                strm->msg = (z_const char *)"invalid stored block lengths";
  752|     81|                state->mode = BAD;
  753|     81|                break;
  754|     81|            }
  755|    265|            state->length = (unsigned)hold & 0xffff;
  756|    265|            Tracev((stderr, "inflate:       stored length %u\n",
  757|    265|                    state->length));
  758|    265|            INITBITS();
  ------------------
  |  |  351|    265|    do { \
  |  |  352|    265|        hold = 0; \
  |  |  353|    265|        bits = 0; \
  |  |  354|    265|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 265]
  |  |  ------------------
  ------------------
  759|    265|            state->mode = COPY_;
  760|    265|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|    265|#define Z_TREES         6
  ------------------
  |  Branch (760:17): [True: 0, False: 265]
  ------------------
  761|       |                /* fallthrough */
  762|    265|        case COPY_:
  ------------------
  |  Branch (762:9): [True: 0, False: 498k]
  ------------------
  763|    265|            state->mode = COPY;
  764|       |                /* fallthrough */
  765|  1.09k|        case COPY:
  ------------------
  |  Branch (765:9): [True: 831, False: 498k]
  ------------------
  766|  1.09k|            copy = state->length;
  767|  1.09k|            if (copy) {
  ------------------
  |  Branch (767:17): [True: 859, False: 237]
  ------------------
  768|    859|                if (copy > have) copy = have;
  ------------------
  |  Branch (768:21): [True: 622, False: 237]
  ------------------
  769|    859|                if (copy > left) copy = left;
  ------------------
  |  Branch (769:21): [True: 31, False: 828]
  ------------------
  770|    859|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (770:21): [True: 333, False: 526]
  ------------------
  771|    526|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|    526|#    define zmemcpy memcpy
  ------------------
  772|    526|                have -= copy;
  773|    526|                next += copy;
  774|    526|                left -= copy;
  775|    526|                put += copy;
  776|    526|                state->length -= copy;
  777|    526|                break;
  778|    859|            }
  779|    237|            Tracev((stderr, "inflate:       stored end\n"));
  780|    237|            state->mode = TYPE;
  781|    237|            break;
  782|  8.00k|        case TABLE:
  ------------------
  |  Branch (782:9): [True: 8.00k, False: 490k]
  ------------------
  783|  8.00k|            NEEDBITS(14);
  ------------------
  |  |  369|  8.00k|    do { \
  |  |  370|  21.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 14.8k, False: 6.56k]
  |  |  ------------------
  |  |  371|  14.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  14.8k|    do { \
  |  |  |  |  360|  14.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.43k, False: 13.3k]
  |  |  |  |  ------------------
  |  |  |  |  361|  14.8k|        have--; \
  |  |  |  |  362|  13.3k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  13.3k|        bits += 8; \
  |  |  |  |  364|  13.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 13.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  8.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 6.56k]
  |  |  ------------------
  ------------------
  784|  6.56k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  376|  6.56k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  785|  6.56k|            DROPBITS(5);
  ------------------
  |  |  380|  6.56k|    do { \
  |  |  381|  6.56k|        hold >>= (n); \
  |  |  382|  6.56k|        bits -= (unsigned)(n); \
  |  |  383|  6.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 6.56k]
  |  |  ------------------
  ------------------
  786|  6.56k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  376|  6.56k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  787|  6.56k|            DROPBITS(5);
  ------------------
  |  |  380|  6.56k|    do { \
  |  |  381|  6.56k|        hold >>= (n); \
  |  |  382|  6.56k|        bits -= (unsigned)(n); \
  |  |  383|  6.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 6.56k]
  |  |  ------------------
  ------------------
  788|  6.56k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  376|  6.56k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  789|  6.56k|            DROPBITS(4);
  ------------------
  |  |  380|  6.56k|    do { \
  |  |  381|  6.56k|        hold >>= (n); \
  |  |  382|  6.56k|        bits -= (unsigned)(n); \
  |  |  383|  6.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 6.56k]
  |  |  ------------------
  ------------------
  790|  6.56k|#ifndef PKZIP_BUG_WORKAROUND
  791|  6.56k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (791:17): [True: 10, False: 6.55k]
  |  Branch (791:38): [True: 15, False: 6.54k]
  ------------------
  792|     25|                strm->msg = (z_const char *)
  793|     25|                    "too many length or distance symbols";
  794|     25|                state->mode = BAD;
  795|     25|                break;
  796|     25|            }
  797|  6.54k|#endif
  798|  6.54k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  799|  6.54k|            state->have = 0;
  800|  6.54k|            state->mode = LENLENS;
  801|       |                /* fallthrough */
  802|  7.37k|        case LENLENS:
  ------------------
  |  Branch (802:9): [True: 832, False: 498k]
  ------------------
  803|   112k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (803:20): [True: 106k, False: 6.30k]
  ------------------
  804|   106k|                NEEDBITS(3);
  ------------------
  |  |  369|   106k|    do { \
  |  |  370|   141k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 36.8k, False: 105k]
  |  |  ------------------
  |  |  371|   106k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  36.8k|    do { \
  |  |  |  |  360|  36.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.07k, False: 35.7k]
  |  |  |  |  ------------------
  |  |  |  |  361|  36.8k|        have--; \
  |  |  |  |  362|  35.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  35.7k|        bits += 8; \
  |  |  |  |  364|  35.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 35.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   106k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 105k]
  |  |  ------------------
  ------------------
  805|   105k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  376|   105k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  806|   105k|                DROPBITS(3);
  ------------------
  |  |  380|   105k|    do { \
  |  |  381|   105k|        hold >>= (n); \
  |  |  382|   105k|        bits -= (unsigned)(n); \
  |  |  383|   105k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 105k]
  |  |  ------------------
  ------------------
  807|   105k|            }
  808|  21.6k|            while (state->have < 19)
  ------------------
  |  Branch (808:20): [True: 15.3k, False: 6.30k]
  ------------------
  809|  15.3k|                state->lens[order[state->have++]] = 0;
  810|  6.30k|            state->next = state->codes;
  811|  6.30k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  812|  6.30k|            state->lenbits = 7;
  813|  6.30k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  814|  6.30k|                                &(state->lenbits), state->work);
  815|  6.30k|            if (ret) {
  ------------------
  |  Branch (815:17): [True: 118, False: 6.18k]
  ------------------
  816|    118|                strm->msg = (z_const char *)"invalid code lengths set";
  817|    118|                state->mode = BAD;
  818|    118|                break;
  819|    118|            }
  820|  6.18k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  821|  6.18k|            state->have = 0;
  822|  6.18k|            state->mode = CODELENS;
  823|       |                /* fallthrough */
  824|  12.3k|        case CODELENS:
  ------------------
  |  Branch (824:9): [True: 6.16k, False: 492k]
  ------------------
  825|   489k|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (825:20): [True: 483k, False: 5.53k]
  ------------------
  826|   647k|                for (;;) {
  827|   647k|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|   647k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  828|   647k|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (828:25): [True: 478k, False: 169k]
  ------------------
  829|   169k|                    PULLBYTE();
  ------------------
  |  |  359|   169k|    do { \
  |  |  360|   169k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 4.92k, False: 164k]
  |  |  ------------------
  |  |  361|   169k|        have--; \
  |  |  362|   164k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   164k|        bits += 8; \
  |  |  364|   164k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 164k]
  |  |  ------------------
  ------------------
  830|   169k|                }
  831|   478k|                if (here.val < 16) {
  ------------------
  |  Branch (831:21): [True: 415k, False: 63.5k]
  ------------------
  832|   415k|                    DROPBITS(here.bits);
  ------------------
  |  |  380|   415k|    do { \
  |  |  381|   415k|        hold >>= (n); \
  |  |  382|   415k|        bits -= (unsigned)(n); \
  |  |  383|   415k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 415k]
  |  |  ------------------
  ------------------
  833|   415k|                    state->lens[state->have++] = here.val;
  834|   415k|                }
  835|  63.5k|                else {
  836|  63.5k|                    if (here.val == 16) {
  ------------------
  |  Branch (836:25): [True: 18.8k, False: 44.6k]
  ------------------
  837|  18.8k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  369|  18.8k|    do { \
  |  |  370|  22.8k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 4.70k, False: 18.1k]
  |  |  ------------------
  |  |  371|  18.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  4.70k|    do { \
  |  |  |  |  360|  4.70k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 692, False: 4.01k]
  |  |  |  |  ------------------
  |  |  |  |  361|  4.70k|        have--; \
  |  |  |  |  362|  4.01k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  4.01k|        bits += 8; \
  |  |  |  |  364|  4.01k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 4.01k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  18.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 18.1k]
  |  |  ------------------
  ------------------
  838|  18.1k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  18.1k|    do { \
  |  |  381|  18.1k|        hold >>= (n); \
  |  |  382|  18.1k|        bits -= (unsigned)(n); \
  |  |  383|  18.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 18.1k]
  |  |  ------------------
  ------------------
  839|  18.1k|                        if (state->have == 0) {
  ------------------
  |  Branch (839:29): [True: 10, False: 18.1k]
  ------------------
  840|     10|                            strm->msg = (z_const char *)
  841|     10|                                "invalid bit length repeat";
  842|     10|                            state->mode = BAD;
  843|     10|                            break;
  844|     10|                        }
  845|  18.1k|                        len = state->lens[state->have - 1];
  846|  18.1k|                        copy = 3 + BITS(2);
  ------------------
  |  |  376|  18.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  847|  18.1k|                        DROPBITS(2);
  ------------------
  |  |  380|  18.1k|    do { \
  |  |  381|  18.1k|        hold >>= (n); \
  |  |  382|  18.1k|        bits -= (unsigned)(n); \
  |  |  383|  18.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 18.1k]
  |  |  ------------------
  ------------------
  848|  18.1k|                    }
  849|  44.6k|                    else if (here.val == 17) {
  ------------------
  |  Branch (849:30): [True: 17.8k, False: 26.8k]
  ------------------
  850|  17.8k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  369|  17.8k|    do { \
  |  |  370|  23.9k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 6.49k, False: 17.5k]
  |  |  ------------------
  |  |  371|  17.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  6.49k|    do { \
  |  |  |  |  360|  6.49k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 347, False: 6.14k]
  |  |  |  |  ------------------
  |  |  |  |  361|  6.49k|        have--; \
  |  |  |  |  362|  6.14k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  6.14k|        bits += 8; \
  |  |  |  |  364|  6.14k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 6.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  17.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 17.5k]
  |  |  ------------------
  ------------------
  851|  17.5k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  17.5k|    do { \
  |  |  381|  17.5k|        hold >>= (n); \
  |  |  382|  17.5k|        bits -= (unsigned)(n); \
  |  |  383|  17.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 17.5k]
  |  |  ------------------
  ------------------
  852|  17.5k|                        len = 0;
  853|  17.5k|                        copy = 3 + BITS(3);
  ------------------
  |  |  376|  17.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  854|  17.5k|                        DROPBITS(3);
  ------------------
  |  |  380|  17.5k|    do { \
  |  |  381|  17.5k|        hold >>= (n); \
  |  |  382|  17.5k|        bits -= (unsigned)(n); \
  |  |  383|  17.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 17.5k]
  |  |  ------------------
  ------------------
  855|  17.5k|                    }
  856|  26.8k|                    else {
  857|  26.8k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  369|  26.8k|    do { \
  |  |  370|  50.9k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 24.9k, False: 26.0k]
  |  |  ------------------
  |  |  371|  26.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  24.9k|    do { \
  |  |  |  |  360|  24.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 768, False: 24.1k]
  |  |  |  |  ------------------
  |  |  |  |  361|  24.9k|        have--; \
  |  |  |  |  362|  24.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  24.1k|        bits += 8; \
  |  |  |  |  364|  24.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 24.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  26.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 26.0k]
  |  |  ------------------
  ------------------
  858|  26.0k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  26.0k|    do { \
  |  |  381|  26.0k|        hold >>= (n); \
  |  |  382|  26.0k|        bits -= (unsigned)(n); \
  |  |  383|  26.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 26.0k]
  |  |  ------------------
  ------------------
  859|  26.0k|                        len = 0;
  860|  26.0k|                        copy = 11 + BITS(7);
  ------------------
  |  |  376|  26.0k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  861|  26.0k|                        DROPBITS(7);
  ------------------
  |  |  380|  26.0k|    do { \
  |  |  381|  26.0k|        hold >>= (n); \
  |  |  382|  26.0k|        bits -= (unsigned)(n); \
  |  |  383|  26.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 26.0k]
  |  |  ------------------
  ------------------
  862|  26.0k|                    }
  863|  61.7k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (863:25): [True: 69, False: 61.6k]
  ------------------
  864|     69|                        strm->msg = (z_const char *)
  865|     69|                            "invalid bit length repeat";
  866|     69|                        state->mode = BAD;
  867|     69|                        break;
  868|     69|                    }
  869|  1.46M|                    while (copy--)
  ------------------
  |  Branch (869:28): [True: 1.40M, False: 61.6k]
  ------------------
  870|  1.40M|                        state->lens[state->have++] = (unsigned short)len;
  871|  61.6k|                }
  872|   478k|            }
  873|       |
  874|       |            /* handle error breaks in while */
  875|  5.61k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (875:17): [True: 79, False: 5.53k]
  ------------------
  876|       |
  877|       |            /* check for end-of-block code (better have one) */
  878|  5.53k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (878:17): [True: 22, False: 5.51k]
  ------------------
  879|     22|                strm->msg = (z_const char *)
  880|     22|                    "invalid code -- missing end-of-block";
  881|     22|                state->mode = BAD;
  882|     22|                break;
  883|     22|            }
  884|       |
  885|       |            /* build code tables -- note: do not change the lenbits or distbits
  886|       |               values here (9 and 6) without reading the comments in inftrees.h
  887|       |               concerning the ENOUGH constants, which depend on those values */
  888|  5.51k|            state->next = state->codes;
  889|  5.51k|            state->lencode = (const code FAR *)(state->next);
  890|  5.51k|            state->lenbits = 9;
  891|  5.51k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  892|  5.51k|                                &(state->lenbits), state->work);
  893|  5.51k|            if (ret) {
  ------------------
  |  Branch (893:17): [True: 55, False: 5.45k]
  ------------------
  894|     55|                strm->msg = (z_const char *)"invalid literal/lengths set";
  895|     55|                state->mode = BAD;
  896|     55|                break;
  897|     55|            }
  898|  5.45k|            state->distcode = (const code FAR *)(state->next);
  899|  5.45k|            state->distbits = 6;
  900|  5.45k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  901|  5.45k|                            &(state->next), &(state->distbits), state->work);
  902|  5.45k|            if (ret) {
  ------------------
  |  Branch (902:17): [True: 56, False: 5.40k]
  ------------------
  903|     56|                strm->msg = (z_const char *)"invalid distances set";
  904|     56|                state->mode = BAD;
  905|     56|                break;
  906|     56|            }
  907|  5.40k|            Tracev((stderr, "inflate:       codes ok\n"));
  908|  5.40k|            state->mode = LEN_;
  909|  5.40k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  5.40k|#define Z_TREES         6
  ------------------
  |  Branch (909:17): [True: 0, False: 5.40k]
  ------------------
  910|       |                /* fallthrough */
  911|  12.5k|        case LEN_:
  ------------------
  |  Branch (911:9): [True: 7.11k, False: 491k]
  ------------------
  912|  12.5k|            state->mode = LEN;
  913|       |                /* fallthrough */
  914|   301k|        case LEN:
  ------------------
  |  Branch (914:9): [True: 288k, False: 209k]
  ------------------
  915|   301k|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (915:17): [True: 51.2k, False: 250k]
  |  Branch (915:30): [True: 45.1k, False: 6.12k]
  ------------------
  916|  45.1k|                RESTORE();
  ------------------
  |  |  340|  45.1k|    do { \
  |  |  341|  45.1k|        strm->next_out = put; \
  |  |  342|  45.1k|        strm->avail_out = left; \
  |  |  343|  45.1k|        strm->next_in = next; \
  |  |  344|  45.1k|        strm->avail_in = have; \
  |  |  345|  45.1k|        state->hold = hold; \
  |  |  346|  45.1k|        state->bits = bits; \
  |  |  347|  45.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 45.1k]
  |  |  ------------------
  ------------------
  917|  45.1k|                inflate_fast(strm, out);
  918|  45.1k|                LOAD();
  ------------------
  |  |  329|  45.1k|    do { \
  |  |  330|  45.1k|        put = strm->next_out; \
  |  |  331|  45.1k|        left = strm->avail_out; \
  |  |  332|  45.1k|        next = strm->next_in; \
  |  |  333|  45.1k|        have = strm->avail_in; \
  |  |  334|  45.1k|        hold = state->hold; \
  |  |  335|  45.1k|        bits = state->bits; \
  |  |  336|  45.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 45.1k]
  |  |  ------------------
  ------------------
  919|  45.1k|                if (state->mode == TYPE)
  ------------------
  |  Branch (919:21): [True: 4.23k, False: 40.8k]
  ------------------
  920|  4.23k|                    state->back = -1;
  921|  45.1k|                break;
  922|  45.1k|            }
  923|   256k|            state->back = 0;
  924|   398k|            for (;;) {
  925|   398k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|   398k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  926|   398k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (926:21): [True: 234k, False: 164k]
  ------------------
  927|   164k|                PULLBYTE();
  ------------------
  |  |  359|   164k|    do { \
  |  |  360|   164k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 22.2k, False: 142k]
  |  |  ------------------
  |  |  361|   164k|        have--; \
  |  |  362|   142k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   142k|        bits += 8; \
  |  |  364|   142k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 142k]
  |  |  ------------------
  ------------------
  928|   164k|            }
  929|   234k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (929:17): [True: 154k, False: 80.0k]
  |  Branch (929:28): [True: 16.6k, False: 137k]
  ------------------
  930|  16.6k|                last = here;
  931|  18.1k|                for (;;) {
  932|  18.1k|                    here = state->lencode[last.val +
  933|  18.1k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  18.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  934|  18.1k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (934:25): [True: 16.3k, False: 1.81k]
  ------------------
  935|  1.81k|                    PULLBYTE();
  ------------------
  |  |  359|  1.81k|    do { \
  |  |  360|  1.81k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 379, False: 1.43k]
  |  |  ------------------
  |  |  361|  1.81k|        have--; \
  |  |  362|  1.43k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  1.43k|        bits += 8; \
  |  |  364|  1.43k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 1.43k]
  |  |  ------------------
  ------------------
  936|  1.81k|                }
  937|  16.3k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  16.3k|    do { \
  |  |  381|  16.3k|        hold >>= (n); \
  |  |  382|  16.3k|        bits -= (unsigned)(n); \
  |  |  383|  16.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 16.3k]
  |  |  ------------------
  ------------------
  938|  16.3k|                state->back += last.bits;
  939|  16.3k|            }
  940|   233k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   233k|    do { \
  |  |  381|   233k|        hold >>= (n); \
  |  |  382|   233k|        bits -= (unsigned)(n); \
  |  |  383|   233k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 233k]
  |  |  ------------------
  ------------------
  941|   233k|            state->back += here.bits;
  942|   233k|            state->length = (unsigned)here.val;
  943|   233k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (943:17): [True: 96.0k, False: 137k]
  ------------------
  944|  96.0k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  945|  96.0k|                        "inflate:         literal '%c'\n" :
  946|  96.0k|                        "inflate:         literal 0x%02x\n", here.val));
  947|  96.0k|                state->mode = LIT;
  948|  96.0k|                break;
  949|  96.0k|            }
  950|   137k|            if (here.op & 32) {
  ------------------
  |  Branch (950:17): [True: 4.12k, False: 133k]
  ------------------
  951|  4.12k|                Tracevv((stderr, "inflate:         end of block\n"));
  952|  4.12k|                state->back = -1;
  953|  4.12k|                state->mode = TYPE;
  954|  4.12k|                break;
  955|  4.12k|            }
  956|   133k|            if (here.op & 64) {
  ------------------
  |  Branch (956:17): [True: 15, False: 133k]
  ------------------
  957|     15|                strm->msg = (z_const char *)"invalid literal/length code";
  958|     15|                state->mode = BAD;
  959|     15|                break;
  960|     15|            }
  961|   133k|            state->extra = (unsigned)(here.op) & 15;
  962|   133k|            state->mode = LENEXT;
  963|       |                /* fallthrough */
  964|   135k|        case LENEXT:
  ------------------
  |  Branch (964:9): [True: 2.34k, False: 496k]
  ------------------
  965|   135k|            if (state->extra) {
  ------------------
  |  Branch (965:17): [True: 41.2k, False: 94.5k]
  ------------------
  966|  41.2k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|  41.2k|    do { \
  |  |  370|  57.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 18.5k, False: 38.8k]
  |  |  ------------------
  |  |  371|  41.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  18.5k|    do { \
  |  |  |  |  360|  18.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 2.44k, False: 16.1k]
  |  |  |  |  ------------------
  |  |  |  |  361|  18.5k|        have--; \
  |  |  |  |  362|  16.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  16.1k|        bits += 8; \
  |  |  |  |  364|  16.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 16.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  41.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 38.8k]
  |  |  ------------------
  ------------------
  967|  38.8k|                state->length += BITS(state->extra);
  ------------------
  |  |  376|  38.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|  38.8k|                DROPBITS(state->extra);
  ------------------
  |  |  380|  38.8k|    do { \
  |  |  381|  38.8k|        hold >>= (n); \
  |  |  382|  38.8k|        bits -= (unsigned)(n); \
  |  |  383|  38.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 38.8k]
  |  |  ------------------
  ------------------
  969|  38.8k|                state->back += state->extra;
  970|  38.8k|            }
  971|   133k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  972|   133k|            state->was = state->length;
  973|   133k|            state->mode = DIST;
  974|       |                /* fallthrough */
  975|   155k|        case DIST:
  ------------------
  |  Branch (975:9): [True: 22.2k, False: 476k]
  ------------------
  976|   213k|            for (;;) {
  977|   213k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  376|   213k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  978|   213k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (978:21): [True: 132k, False: 80.9k]
  ------------------
  979|  80.9k|                PULLBYTE();
  ------------------
  |  |  359|  80.9k|    do { \
  |  |  360|  80.9k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 22.8k, False: 58.1k]
  |  |  ------------------
  |  |  361|  80.9k|        have--; \
  |  |  362|  58.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  58.1k|        bits += 8; \
  |  |  364|  58.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 58.1k]
  |  |  ------------------
  ------------------
  980|  80.9k|            }
  981|   132k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (981:17): [True: 1.22k, False: 131k]
  ------------------
  982|  1.22k|                last = here;
  983|  1.78k|                for (;;) {
  984|  1.78k|                    here = state->distcode[last.val +
  985|  1.78k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  1.78k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  986|  1.78k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (986:25): [True: 1.18k, False: 606]
  ------------------
  987|    606|                    PULLBYTE();
  ------------------
  |  |  359|    606|    do { \
  |  |  360|    606|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 44, False: 562]
  |  |  ------------------
  |  |  361|    606|        have--; \
  |  |  362|    562|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|    562|        bits += 8; \
  |  |  364|    562|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 562]
  |  |  ------------------
  ------------------
  988|    606|                }
  989|  1.18k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  1.18k|    do { \
  |  |  381|  1.18k|        hold >>= (n); \
  |  |  382|  1.18k|        bits -= (unsigned)(n); \
  |  |  383|  1.18k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.18k]
  |  |  ------------------
  ------------------
  990|  1.18k|                state->back += last.bits;
  991|  1.18k|            }
  992|   132k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   132k|    do { \
  |  |  381|   132k|        hold >>= (n); \
  |  |  382|   132k|        bits -= (unsigned)(n); \
  |  |  383|   132k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 132k]
  |  |  ------------------
  ------------------
  993|   132k|            state->back += here.bits;
  994|   132k|            if (here.op & 64) {
  ------------------
  |  Branch (994:17): [True: 27, False: 132k]
  ------------------
  995|     27|                strm->msg = (z_const char *)"invalid distance code";
  996|     27|                state->mode = BAD;
  997|     27|                break;
  998|     27|            }
  999|   132k|            state->offset = (unsigned)here.val;
 1000|   132k|            state->extra = (unsigned)(here.op) & 15;
 1001|   132k|            state->mode = DISTEXT;
 1002|       |                /* fallthrough */
 1003|   142k|        case DISTEXT:
  ------------------
  |  Branch (1003:9): [True: 9.59k, False: 489k]
  ------------------
 1004|   142k|            if (state->extra) {
  ------------------
  |  Branch (1004:17): [True: 104k, False: 38.2k]
  ------------------
 1005|   104k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   104k|    do { \
  |  |  370|   146k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 54.1k, False: 92.4k]
  |  |  ------------------
  |  |  371|   104k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  54.1k|    do { \
  |  |  |  |  360|  54.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 11.6k, False: 42.5k]
  |  |  |  |  ------------------
  |  |  |  |  361|  54.1k|        have--; \
  |  |  |  |  362|  42.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  42.5k|        bits += 8; \
  |  |  |  |  364|  42.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 42.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   104k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 92.4k]
  |  |  ------------------
  ------------------
 1006|  92.4k|                state->offset += BITS(state->extra);
  ------------------
  |  |  376|  92.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1007|  92.4k|                DROPBITS(state->extra);
  ------------------
  |  |  380|  92.4k|    do { \
  |  |  381|  92.4k|        hold >>= (n); \
  |  |  382|  92.4k|        bits -= (unsigned)(n); \
  |  |  383|  92.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 92.4k]
  |  |  ------------------
  ------------------
 1008|  92.4k|                state->back += state->extra;
 1009|  92.4k|            }
 1010|       |#ifdef INFLATE_STRICT
 1011|       |            if (state->offset > state->dmax) {
 1012|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1013|       |                state->mode = BAD;
 1014|       |                break;
 1015|       |            }
 1016|       |#endif
 1017|   130k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1018|   130k|            state->mode = MATCH;
 1019|       |                /* fallthrough */
 1020|   144k|        case MATCH:
  ------------------
  |  Branch (1020:9): [True: 14.2k, False: 484k]
  ------------------
 1021|   144k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1021:17): [True: 1.19k, False: 143k]
  ------------------
 1022|   143k|            copy = out - left;
 1023|   143k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1023:17): [True: 44.8k, False: 98.9k]
  ------------------
 1024|  44.8k|                copy = state->offset - copy;
 1025|  44.8k|                if (copy > state->whave) {
  ------------------
  |  Branch (1025:21): [True: 58, False: 44.8k]
  ------------------
 1026|     58|                    if (state->sane) {
  ------------------
  |  Branch (1026:25): [True: 58, False: 0]
  ------------------
 1027|     58|                        strm->msg = (z_const char *)
 1028|     58|                            "invalid distance too far back";
 1029|     58|                        state->mode = BAD;
 1030|     58|                        break;
 1031|     58|                    }
 1032|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1033|       |                    Trace((stderr, "inflate.c too far\n"));
 1034|       |                    copy -= state->whave;
 1035|       |                    if (copy > state->length) copy = state->length;
 1036|       |                    if (copy > left) copy = left;
 1037|       |                    left -= copy;
 1038|       |                    state->length -= copy;
 1039|       |                    do {
 1040|       |                        *put++ = 0;
 1041|       |                    } while (--copy);
 1042|       |                    if (state->length == 0) state->mode = LEN;
 1043|       |                    break;
 1044|       |#endif
 1045|     58|                }
 1046|  44.8k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1046:21): [True: 2.87k, False: 41.9k]
  ------------------
 1047|  2.87k|                    copy -= state->wnext;
 1048|  2.87k|                    from = state->window + (state->wsize - copy);
 1049|  2.87k|                }
 1050|  41.9k|                else
 1051|  41.9k|                    from = state->window + (state->wnext - copy);
 1052|  44.8k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1052:21): [True: 32.8k, False: 11.9k]
  ------------------
 1053|  44.8k|            }
 1054|  98.9k|            else {                              /* copy from output */
 1055|  98.9k|                from = put - state->offset;
 1056|  98.9k|                copy = state->length;
 1057|  98.9k|            }
 1058|   143k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1058:17): [True: 1.17k, False: 142k]
  ------------------
 1059|   143k|            left -= copy;
 1060|   143k|            state->length -= copy;
 1061|  16.5M|            do {
 1062|  16.5M|                *put++ = *from++;
 1063|  16.5M|            } while (--copy);
  ------------------
  |  Branch (1063:22): [True: 16.3M, False: 143k]
  ------------------
 1064|   143k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1064:17): [True: 130k, False: 13.1k]
  ------------------
 1065|   143k|            break;
 1066|  96.1k|        case LIT:
  ------------------
  |  Branch (1066:9): [True: 96.1k, False: 402k]
  ------------------
 1067|  96.1k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1067:17): [True: 83, False: 96.0k]
  ------------------
 1068|  96.0k|            *put++ = (unsigned char)(state->length);
 1069|  96.0k|            left--;
 1070|  96.0k|            state->mode = LEN;
 1071|  96.0k|            break;
 1072|  4.47k|        case CHECK:
  ------------------
  |  Branch (1072:9): [True: 4.47k, False: 494k]
  ------------------
 1073|  4.47k|            if (state->wrap) {
  ------------------
  |  Branch (1073:17): [True: 4.47k, False: 0]
  ------------------
 1074|  4.47k|                NEEDBITS(32);
  ------------------
  |  |  369|  4.47k|    do { \
  |  |  370|  19.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 15.8k, False: 3.61k]
  |  |  ------------------
  |  |  371|  15.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  15.8k|    do { \
  |  |  |  |  360|  15.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 865, False: 15.0k]
  |  |  |  |  ------------------
  |  |  |  |  361|  15.8k|        have--; \
  |  |  |  |  362|  15.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  15.0k|        bits += 8; \
  |  |  |  |  364|  15.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 15.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  4.47k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 3.61k]
  |  |  ------------------
  ------------------
 1075|  3.61k|                out -= left;
 1076|  3.61k|                strm->total_out += out;
 1077|  3.61k|                state->total += out;
 1078|  3.61k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1078:21): [True: 3.61k, False: 0]
  |  Branch (1078:42): [True: 1.74k, False: 1.86k]
  ------------------
 1079|  1.74k|                    strm->adler = state->check =
 1080|  1.74k|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  303|  1.74k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (303:6): [True: 0, False: 1.74k]
  |  |  ------------------
  ------------------
 1081|  3.61k|                out = left;
 1082|  3.61k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1082:21): [True: 3.61k, False: 0]
  |  Branch (1082:42): [True: 866, False: 2.74k]
  ------------------
 1083|  3.61k|#ifdef GUNZIP
 1084|  3.61k|                     state->flags ? hold :
  ------------------
  |  Branch (1084:22): [True: 0, False: 3.61k]
  ------------------
 1085|  3.61k|#endif
 1086|  3.61k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|  3.61k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|  3.61k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1087|    866|                    strm->msg = (z_const char *)"incorrect data check";
 1088|    866|                    state->mode = BAD;
 1089|    866|                    break;
 1090|    866|                }
 1091|  2.74k|                INITBITS();
  ------------------
  |  |  351|  2.74k|    do { \
  |  |  352|  2.74k|        hold = 0; \
  |  |  353|  2.74k|        bits = 0; \
  |  |  354|  2.74k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 2.74k]
  |  |  ------------------
  ------------------
 1092|  2.74k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1093|  2.74k|            }
 1094|  2.74k|#ifdef GUNZIP
 1095|  2.74k|            state->mode = LENGTH;
 1096|       |                /* fallthrough */
 1097|  2.74k|        case LENGTH:
  ------------------
  |  Branch (1097:9): [True: 0, False: 498k]
  ------------------
 1098|  2.74k|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1098:17): [True: 2.74k, False: 0]
  |  Branch (1098:32): [True: 0, False: 2.74k]
  ------------------
 1099|      0|                NEEDBITS(32);
  ------------------
  |  |  369|      0|    do { \
  |  |  370|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  371|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|      0|    do { \
  |  |  |  |  360|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  361|      0|        have--; \
  |  |  |  |  362|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|      0|        bits += 8; \
  |  |  |  |  364|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1100|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1100:21): [True: 0, False: 0]
  |  Branch (1100:42): [True: 0, False: 0]
  ------------------
 1101|      0|                    strm->msg = (z_const char *)"incorrect length check";
 1102|      0|                    state->mode = BAD;
 1103|      0|                    break;
 1104|      0|                }
 1105|      0|                INITBITS();
  ------------------
  |  |  351|      0|    do { \
  |  |  352|      0|        hold = 0; \
  |  |  353|      0|        bits = 0; \
  |  |  354|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1106|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1107|      0|            }
 1108|  2.74k|#endif
 1109|  2.74k|            state->mode = DONE;
 1110|       |                /* fallthrough */
 1111|  5.68k|        case DONE:
  ------------------
  |  Branch (1111:9): [True: 2.93k, False: 496k]
  ------------------
 1112|  5.68k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  5.68k|#define Z_STREAM_END    1
  ------------------
 1113|  5.68k|            goto inf_leave;
 1114|  4.07k|        case BAD:
  ------------------
  |  Branch (1114:9): [True: 4.07k, False: 494k]
  ------------------
 1115|  4.07k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  4.07k|#define Z_DATA_ERROR   (-3)
  ------------------
 1116|  4.07k|            goto inf_leave;
 1117|      0|        case MEM:
  ------------------
  |  Branch (1117:9): [True: 0, False: 498k]
  ------------------
 1118|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1119|      0|        case SYNC:
  ------------------
  |  Branch (1119:9): [True: 0, False: 498k]
  ------------------
 1120|       |                /* fallthrough */
 1121|      0|        default:
  ------------------
  |  Branch (1121:9): [True: 0, False: 498k]
  ------------------
 1122|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1123|   498k|        }
 1124|       |
 1125|       |    /*
 1126|       |       Return from inflate(), updating the total counts and the check value.
 1127|       |       If there was no progress during the inflate() call, return a buffer
 1128|       |       error.  Call updatewindow() to create and/or update the window state.
 1129|       |       Note: a memory error from inflate() is non-recoverable.
 1130|       |     */
 1131|  82.4k|  inf_leave:
 1132|  82.4k|    RESTORE();
  ------------------
  |  |  340|  82.4k|    do { \
  |  |  341|  82.4k|        strm->next_out = put; \
  |  |  342|  82.4k|        strm->avail_out = left; \
  |  |  343|  82.4k|        strm->next_in = next; \
  |  |  344|  82.4k|        strm->avail_in = have; \
  |  |  345|  82.4k|        state->hold = hold; \
  |  |  346|  82.4k|        state->bits = bits; \
  |  |  347|  82.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 82.4k]
  |  |  ------------------
  ------------------
 1133|  82.4k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1133:9): [True: 58.8k, False: 23.6k]
  |  Branch (1133:26): [True: 4.98k, False: 18.6k]
  |  Branch (1133:52): [True: 4.63k, False: 347]
  ------------------
 1134|  4.63k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|    409|#define Z_FINISH        4
  ------------------
  |  Branch (1134:14): [True: 4.23k, False: 409]
  |  Branch (1134:37): [True: 409, False: 0]
  ------------------
 1135|  63.4k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1135:13): [True: 0, False: 63.4k]
  ------------------
 1136|      0|            state->mode = MEM;
 1137|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1138|      0|        }
 1139|  82.4k|    in -= strm->avail_in;
 1140|  82.4k|    out -= strm->avail_out;
 1141|  82.4k|    strm->total_in += in;
 1142|  82.4k|    strm->total_out += out;
 1143|  82.4k|    state->total += out;
 1144|  82.4k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1144:9): [True: 82.4k, False: 0]
  |  Branch (1144:30): [True: 58.8k, False: 23.6k]
  ------------------
 1145|  58.8k|        strm->adler = state->check =
 1146|  58.8k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  303|  58.8k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (303:6): [True: 0, False: 58.8k]
  |  |  ------------------
  ------------------
 1147|  82.4k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1147:43): [True: 31.0k, False: 51.3k]
  ------------------
 1148|  82.4k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1148:24): [True: 241, False: 82.2k]
  ------------------
 1149|  82.4k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1149:24): [True: 0, False: 82.4k]
  |  Branch (1149:47): [True: 0, False: 82.4k]
  ------------------
 1150|  82.4k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|  71.7k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  10.6k|#define Z_OK            0
  ------------------
  |  Branch (1150:11): [True: 10.7k, False: 71.6k]
  |  Branch (1150:22): [True: 10.6k, False: 72]
  |  Branch (1150:35): [True: 0, False: 71.7k]
  |  Branch (1150:57): [True: 5.64k, False: 5.04k]
  ------------------
 1151|  5.64k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  5.64k|#define Z_BUF_ERROR    (-5)
  ------------------
 1152|  82.4k|    return ret;
 1153|  82.4k|}
inflateEnd:
 1155|  10.5k|int ZEXPORT inflateEnd(z_streamp strm) {
 1156|  10.5k|    struct inflate_state FAR *state;
 1157|  10.5k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1157:9): [True: 0, False: 10.5k]
  ------------------
 1158|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1159|  10.5k|    state = (struct inflate_state FAR *)strm->state;
 1160|  10.5k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|  4.63k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1160:9): [True: 4.63k, False: 5.95k]
  ------------------
 1161|  10.5k|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|  10.5k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1162|  10.5k|    strm->state = Z_NULL;
  ------------------
  |  |  216|  10.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1163|  10.5k|    Tracev((stderr, "inflate: end\n"));
 1164|  10.5k|    return Z_OK;
  ------------------
  |  |  181|  10.5k|#define Z_OK            0
  ------------------
 1165|  10.5k|}
inflate.c:inflateStateCheck:
   88|   124k|local int inflateStateCheck(z_streamp strm) {
   89|   124k|    struct inflate_state FAR *state;
   90|   124k|    if (strm == Z_NULL ||
  ------------------
  |  |  216|   249k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 124k]
  ------------------
   91|   124k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 0, False: 124k]
  |  Branch (91:42): [True: 0, False: 124k]
  ------------------
   92|      0|        return 1;
   93|   124k|    state = (struct inflate_state FAR *)strm->state;
   94|   124k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|   249k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 124k]
  |  Branch (94:28): [True: 0, False: 124k]
  ------------------
   95|   124k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 124k]
  |  Branch (95:31): [True: 0, False: 124k]
  ------------------
   96|      0|        return 1;
   97|   124k|    return 0;
   98|   124k|}
inflate.c:updatewindow:
  252|  63.4k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  253|  63.4k|    struct inflate_state FAR *state;
  254|  63.4k|    unsigned dist;
  255|       |
  256|  63.4k|    state = (struct inflate_state FAR *)strm->state;
  257|       |
  258|       |    /* if it hasn't been done already, allocate space for the window */
  259|  63.4k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|  63.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (259:9): [True: 4.63k, False: 58.8k]
  ------------------
  260|  4.63k|        state->window = (unsigned char FAR *)
  261|  4.63k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|  4.63k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  262|  4.63k|                               sizeof(unsigned char));
  263|  4.63k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  4.63k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (263:13): [True: 0, False: 4.63k]
  ------------------
  264|  4.63k|    }
  265|       |
  266|       |    /* if window not in use yet, initialize */
  267|  63.4k|    if (state->wsize == 0) {
  ------------------
  |  Branch (267:9): [True: 4.63k, False: 58.8k]
  ------------------
  268|  4.63k|        state->wsize = 1U << state->wbits;
  269|  4.63k|        state->wnext = 0;
  270|  4.63k|        state->whave = 0;
  271|  4.63k|    }
  272|       |
  273|       |    /* copy state->wsize or less output bytes into the circular window */
  274|  63.4k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (274:9): [True: 1.93k, False: 61.5k]
  ------------------
  275|  1.93k|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|  1.93k|#    define zmemcpy memcpy
  ------------------
  276|  1.93k|        state->wnext = 0;
  277|  1.93k|        state->whave = state->wsize;
  278|  1.93k|    }
  279|  61.5k|    else {
  280|  61.5k|        dist = state->wsize - state->wnext;
  281|  61.5k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (281:13): [True: 61.1k, False: 420]
  ------------------
  282|  61.5k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|  61.5k|#    define zmemcpy memcpy
  ------------------
  283|  61.5k|        copy -= dist;
  284|  61.5k|        if (copy) {
  ------------------
  |  Branch (284:13): [True: 400, False: 61.1k]
  ------------------
  285|    400|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|    400|#    define zmemcpy memcpy
  ------------------
  286|    400|            state->wnext = copy;
  287|    400|            state->whave = state->wsize;
  288|    400|        }
  289|  61.1k|        else {
  290|  61.1k|            state->wnext += dist;
  291|  61.1k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (291:17): [True: 20, False: 61.1k]
  ------------------
  292|  61.1k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (292:17): [True: 27.9k, False: 33.1k]
  ------------------
  293|  61.1k|        }
  294|  61.5k|    }
  295|  63.4k|    return 0;
  296|  63.4k|}

inflate_table:
   48|  17.2k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  17.2k|    unsigned len;               /* a code's length in bits */
   50|  17.2k|    unsigned sym;               /* index of code symbols */
   51|  17.2k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  17.2k|    unsigned root;              /* number of index bits for root table */
   53|  17.2k|    unsigned curr;              /* number of index bits for current table */
   54|  17.2k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  17.2k|    int left;                   /* number of prefix codes available */
   56|  17.2k|    unsigned used;              /* code entries in table used */
   57|  17.2k|    unsigned huff;              /* Huffman code */
   58|  17.2k|    unsigned incr;              /* for incrementing code, index */
   59|  17.2k|    unsigned fill;              /* index for replicating entries */
   60|  17.2k|    unsigned low;               /* low bits for current root entry */
   61|  17.2k|    unsigned mask;              /* mask for low root bits */
   62|  17.2k|    code here;                  /* table entry for duplication */
   63|  17.2k|    code FAR *next;             /* next available space in table */
   64|  17.2k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  17.2k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  17.2k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  17.2k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  17.2k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  17.2k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  17.2k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  17.2k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  17.2k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  17.2k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  17.2k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 68, 193};
   75|  17.2k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  17.2k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  17.2k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  17.2k|        8193, 12289, 16385, 24577, 0, 0};
   79|  17.2k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  17.2k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  17.2k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  17.2k|        28, 28, 29, 29, 64, 64};
   83|       |
   84|       |    /*
   85|       |       Process a set of code lengths to create a canonical Huffman code.  The
   86|       |       code lengths are lens[0..codes-1].  Each length corresponds to the
   87|       |       symbols 0..codes-1.  The Huffman code is generated by first sorting the
   88|       |       symbols by length from short to long, and retaining the symbol order
   89|       |       for codes with equal lengths.  Then the code starts with all zero bits
   90|       |       for the first code of the shortest length, and the codes are integer
   91|       |       increments for the same length, and zeros are appended as the length
   92|       |       increases.  For the deflate format, these bits are stored backwards
   93|       |       from their more natural integer increment ordering, and so when the
   94|       |       decoding tables are built in the large loop below, the integer codes
   95|       |       are incremented backwards.
   96|       |
   97|       |       This routine assumes, but does not check, that all of the entries in
   98|       |       lens[] are in the range 0..MAXBITS.  The caller must assure this.
   99|       |       1..MAXBITS is interpreted as that code length.  zero means that that
  100|       |       symbol does not occur in this code.
  101|       |
  102|       |       The codes are sorted by computing a count of codes for each length,
  103|       |       creating from that a table of starting indices for each length in the
  104|       |       sorted table, and then entering the symbols in order in the sorted
  105|       |       table.  The sorted table is work[], with that space being provided by
  106|       |       the caller.
  107|       |
  108|       |       The length counts are used for other purposes as well, i.e. finding
  109|       |       the minimum and maximum length codes, determining if there are any
  110|       |       codes at all, checking for a valid set of lengths, and looking ahead
  111|       |       at length counts to determine sub-table sizes when building the
  112|       |       decoding tables.
  113|       |     */
  114|       |
  115|       |    /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */
  116|   293k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   293k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 276k, False: 17.2k]
  ------------------
  117|   276k|        count[len] = 0;
  118|  1.81M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 1.79M, False: 17.2k]
  ------------------
  119|  1.79M|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  17.2k|    root = *bits;
  123|   187k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  17.2k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 187k, False: 216]
  ------------------
  124|   187k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 17.0k, False: 170k]
  ------------------
  125|  17.2k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 13.3k, False: 3.96k]
  ------------------
  126|  17.2k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 216, False: 17.0k]
  ------------------
  127|    216|        here.op = (unsigned char)64;    /* invalid code marker */
  128|    216|        here.bits = (unsigned char)1;
  129|    216|        here.val = (unsigned short)0;
  130|    216|        *(*table)++ = here;             /* make a table to force an error */
  131|    216|        *(*table)++ = here;
  132|    216|        *bits = 1;
  133|    216|        return 0;     /* no symbols, but wait for decoding to report error */
  134|    216|    }
  135|  30.2k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 30.0k, False: 194]
  ------------------
  136|  30.0k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 16.8k, False: 13.2k]
  ------------------
  137|  17.0k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 13, False: 17.0k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  17.0k|    left = 1;
  141|   271k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   271k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 254k, False: 16.9k]
  ------------------
  142|   254k|        left <<= 1;
  143|   254k|        left -= count[len];
  144|   254k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 128, False: 254k]
  ------------------
  145|   254k|    }
  146|  16.9k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 112, False: 16.8k]
  |  Branch (146:22): [True: 38, False: 74]
  |  Branch (146:39): [True: 63, False: 11]
  ------------------
  147|    101|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  16.8k|    offs[1] = 0;
  151|   252k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   252k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 235k, False: 16.8k]
  ------------------
  152|   235k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|  1.78M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 1.77M, False: 16.8k]
  ------------------
  156|  1.77M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 388k, False: 1.38M]
  ------------------
  157|       |
  158|       |    /*
  159|       |       Create and fill in decoding tables.  In this loop, the table being
  160|       |       filled is at next and has curr index bits.  The code being used is huff
  161|       |       with length len.  That code is converted to an index by dropping drop
  162|       |       bits off of the bottom.  For codes where len is less than drop + curr,
  163|       |       those top drop + curr - len bits are incremented through all values to
  164|       |       fill the table with replicated entries.
  165|       |
  166|       |       root is the number of index bits for the root table.  When len exceeds
  167|       |       root, sub-tables are created pointed to by the root entry with an index
  168|       |       of the low root bits of huff.  This is saved in low to check for when a
  169|       |       new sub-table should be started.  drop is zero when the root table is
  170|       |       being filled, and drop is root when sub-tables are being filled.
  171|       |
  172|       |       When a new sub-table is needed, it is necessary to look ahead in the
  173|       |       code lengths to determine what size sub-table is needed.  The length
  174|       |       counts are used for this, and so count[] is decremented as codes are
  175|       |       entered in the tables.
  176|       |
  177|       |       used keeps track of how many table entries have been allocated from the
  178|       |       provided *table space.  It is checked for LENS and DIST tables against
  179|       |       the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
  180|       |       the initial root table size constants.  See the comments in inftrees.h
  181|       |       for more information.
  182|       |
  183|       |       sym increments through all symbols, and the loop terminates when
  184|       |       all codes of length max, i.e. all codes, have been processed.  This
  185|       |       routine permits incomplete codes, so another loop after this one fills
  186|       |       in the rest of the decoding tables with invalid code markers.
  187|       |     */
  188|       |
  189|       |    /* set up for code type */
  190|  16.8k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 16.8k, False: 0]
  ------------------
  191|  5.97k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 5.97k, False: 10.8k]
  ------------------
  192|  5.97k|        match = 20;
  193|  5.97k|        break;
  194|  5.45k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 5.45k, False: 11.3k]
  ------------------
  195|  5.45k|        base = lbase;
  196|  5.45k|        extra = lext;
  197|  5.45k|        match = 257;
  198|  5.45k|        break;
  199|  5.39k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 5.39k, False: 11.4k]
  ------------------
  200|  5.39k|        base = dbase;
  201|  5.39k|        extra = dext;
  202|  16.8k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  16.8k|    huff = 0;                   /* starting code */
  206|  16.8k|    sym = 0;                    /* starting code symbol */
  207|  16.8k|    len = min;                  /* starting code length */
  208|  16.8k|    next = *table;              /* current table to fill in */
  209|  16.8k|    curr = root;                /* current table index bits */
  210|  16.8k|    drop = 0;                   /* current bits to drop from code for index */
  211|  16.8k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  16.8k|    used = 1U << root;          /* use root table entries */
  213|  16.8k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  16.8k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  5.45k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (216:10): [True: 5.45k, False: 11.3k]
  |  Branch (216:26): [True: 0, False: 5.45k]
  ------------------
  217|  16.8k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  5.39k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (217:10): [True: 5.39k, False: 11.4k]
  |  Branch (217:27): [True: 0, False: 5.39k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|   388k|    for (;;) {
  222|       |        /* create table entry */
  223|   388k|        here.bits = (unsigned char)(len - drop);
  224|   388k|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 297k, False: 91.5k]
  ------------------
  225|   297k|            here.op = (unsigned char)0;
  226|   297k|            here.val = work[sym];
  227|   297k|        }
  228|  91.5k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 86.0k, False: 5.45k]
  ------------------
  229|  86.0k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|  86.0k|            here.val = base[work[sym] - match];
  231|  86.0k|        }
  232|  5.45k|        else {
  233|  5.45k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  5.45k|            here.val = 0;
  235|  5.45k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|   388k|        incr = 1U << (len - drop);
  239|   388k|        fill = 1U << curr;
  240|   388k|        min = fill;                 /* save offset to next table */
  241|  1.42M|        do {
  242|  1.42M|            fill -= incr;
  243|  1.42M|            next[(huff >> drop) + fill] = here;
  244|  1.42M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 1.03M, False: 388k]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|   388k|        incr = 1U << (len - 1);
  248|   760k|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 371k, False: 388k]
  ------------------
  249|   371k|            incr >>= 1;
  250|   388k|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 371k, False: 16.8k]
  ------------------
  251|   371k|            huff &= incr - 1;
  252|   371k|            huff += incr;
  253|   371k|        }
  254|  16.8k|        else
  255|  16.8k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|   388k|        sym++;
  259|   388k|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 68.5k, False: 320k]
  ------------------
  260|  68.5k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 16.8k, False: 51.7k]
  ------------------
  261|  51.7k|            len = lens[work[sym]];
  262|  51.7k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   371k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 81.9k, False: 289k]
  |  Branch (265:27): [True: 32.0k, False: 49.8k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  32.0k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 2.69k, False: 29.3k]
  ------------------
  268|  2.69k|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  32.0k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  32.0k|            curr = len - drop;
  275|  32.0k|            left = (int)(1 << curr);
  276|  35.0k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 18.2k, False: 16.8k]
  ------------------
  277|  18.2k|                left -= count[curr + drop];
  278|  18.2k|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 15.2k, False: 2.98k]
  ------------------
  279|  2.98k|                curr++;
  280|  2.98k|                left <<= 1;
  281|  2.98k|            }
  282|       |
  283|       |            /* check for enough space */
  284|  32.0k|            used += 1U << curr;
  285|  32.0k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  29.6k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (285:18): [True: 29.6k, False: 2.41k]
  |  Branch (285:34): [True: 0, False: 29.6k]
  ------------------
  286|  32.0k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  2.41k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (286:18): [True: 2.41k, False: 29.6k]
  |  Branch (286:35): [True: 0, False: 2.41k]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  32.0k|            low = huff & mask;
  291|  32.0k|            (*table)[low].op = (unsigned char)curr;
  292|  32.0k|            (*table)[low].bits = (unsigned char)root;
  293|  32.0k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  32.0k|        }
  295|   371k|    }
  296|       |
  297|       |    /* fill in remaining table entry if code is incomplete (guaranteed to have
  298|       |       at most one remaining entry, since if the code is incomplete, the
  299|       |       maximum code length that was allowed to get this far is one bit) */
  300|  16.8k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 11, False: 16.8k]
  ------------------
  301|     11|        here.op = (unsigned char)64;            /* invalid code marker */
  302|     11|        here.bits = (unsigned char)(len - drop);
  303|     11|        here.val = (unsigned short)0;
  304|     11|        next[huff] = here;
  305|     11|    }
  306|       |
  307|       |    /* set return parameters */
  308|  16.8k|    *table += used;
  309|  16.8k|    *bits = root;
  310|  16.8k|    return 0;
  311|  16.8k|}
inflate_fixed:
  364|  7.11k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|  7.11k|    state->lencode = lenfix;
  369|  7.11k|    state->lenbits = 9;
  370|  7.11k|    state->distcode = distfix;
  371|  7.11k|    state->distbits = 5;
  372|  7.11k|}

zcalloc:
  299|  15.2k|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  300|  15.2k|    (void)opaque;
  301|  15.2k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (301:12): [True: 15.2k, Folded]
  ------------------
  302|  15.2k|                              (voidpf)calloc(items, size);
  303|  15.2k|}
zcfree:
  305|  15.2k|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  306|  15.2k|    (void)opaque;
  307|  15.2k|    free(ptr);
  308|  15.2k|}

