jsimd_set_ycc_rgb:
  236|     11|{
  237|     11|  init_simd((j_common_ptr)cinfo);
  238|       |
  239|     11|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|     11|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (239:7): [Folded, False: 11]
  ------------------
  240|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  241|     11|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (241:7): [Folded, False: 11]
  ------------------
  242|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  243|     11|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|     11|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
                if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|      0|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
  |  Branch (243:7): [Folded, False: 11]
  |  Branch (243:31): [True: 0, Folded]
  ------------------
  244|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  245|     11|  if (!cinfo->cconvert)
  ------------------
  |  Branch (245:7): [True: 0, False: 11]
  ------------------
  246|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  247|       |
  248|     11|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  249|     11|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|     11|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (249:7): [True: 0, False: 11]
  ------------------
  250|      0|      IS_ALIGNED_AVX(jconst_ycc_rgb_convert_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]
  |  |  ------------------
  ------------------
  251|      0|    SET_SIMD_EXTRGB_COLOR_DECONVERTER(avx2);
  ------------------
  |  |  128|      0|#define SET_SIMD_EXTRGB_COLOR_DECONVERTER(instrset) { \
  |  |  129|      0|  switch (cinfo->out_color_space) { \
  |  |  130|      0|    case JCS_EXT_RGB: \
  |  |  ------------------
  |  |  |  Branch (130:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  131|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  132|      0|        jsimd_ycc_extrgb_convert_##instrset; \
  |  |  133|      0|      break; \
  |  |  134|      0|    case JCS_EXT_RGBX: \
  |  |  ------------------
  |  |  |  Branch (134:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  135|      0|    case JCS_EXT_RGBA: \
  |  |  ------------------
  |  |  |  Branch (135:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  136|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  137|      0|        jsimd_ycc_extrgbx_convert_##instrset; \
  |  |  138|      0|      break; \
  |  |  139|      0|    case JCS_EXT_BGR: \
  |  |  ------------------
  |  |  |  Branch (139:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  140|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  141|      0|        jsimd_ycc_extbgr_convert_##instrset; \
  |  |  142|      0|      break; \
  |  |  143|      0|    case JCS_EXT_BGRX: \
  |  |  ------------------
  |  |  |  Branch (143:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  144|      0|    case JCS_EXT_BGRA: \
  |  |  ------------------
  |  |  |  Branch (144:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  145|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  146|      0|        jsimd_ycc_extbgrx_convert_##instrset; \
  |  |  147|      0|      break; \
  |  |  148|      0|    case JCS_EXT_XBGR: \
  |  |  ------------------
  |  |  |  Branch (148:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|    case JCS_EXT_ABGR: \
  |  |  ------------------
  |  |  |  Branch (149:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  150|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  151|      0|        jsimd_ycc_extxbgr_convert_##instrset; \
  |  |  152|      0|      break; \
  |  |  153|      0|    case JCS_EXT_XRGB: \
  |  |  ------------------
  |  |  |  Branch (153:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  154|      0|    case JCS_EXT_ARGB: \
  |  |  ------------------
  |  |  |  Branch (154:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  155|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  156|      0|        jsimd_ycc_extxrgb_convert_##instrset; \
  |  |  157|      0|      break; \
  |  |  158|      0|    default: \
  |  |  ------------------
  |  |  |  Branch (158:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  159|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  160|      0|        jsimd_ycc_rgb_convert_##instrset; \
  |  |  161|      0|  } \
  |  |  162|      0|}
  ------------------
  252|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  253|      0|  }
  254|     11|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|     11|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (254:7): [True: 0, False: 11]
  ------------------
  255|      0|      IS_ALIGNED_SSE(jconst_ycc_rgb_convert_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]
  |  |  ------------------
  ------------------
  256|      0|    SET_SIMD_EXTRGB_COLOR_DECONVERTER(sse2);
  ------------------
  |  |  128|      0|#define SET_SIMD_EXTRGB_COLOR_DECONVERTER(instrset) { \
  |  |  129|      0|  switch (cinfo->out_color_space) { \
  |  |  130|      0|    case JCS_EXT_RGB: \
  |  |  ------------------
  |  |  |  Branch (130:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  131|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  132|      0|        jsimd_ycc_extrgb_convert_##instrset; \
  |  |  133|      0|      break; \
  |  |  134|      0|    case JCS_EXT_RGBX: \
  |  |  ------------------
  |  |  |  Branch (134:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  135|      0|    case JCS_EXT_RGBA: \
  |  |  ------------------
  |  |  |  Branch (135:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  136|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  137|      0|        jsimd_ycc_extrgbx_convert_##instrset; \
  |  |  138|      0|      break; \
  |  |  139|      0|    case JCS_EXT_BGR: \
  |  |  ------------------
  |  |  |  Branch (139:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  140|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  141|      0|        jsimd_ycc_extbgr_convert_##instrset; \
  |  |  142|      0|      break; \
  |  |  143|      0|    case JCS_EXT_BGRX: \
  |  |  ------------------
  |  |  |  Branch (143:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  144|      0|    case JCS_EXT_BGRA: \
  |  |  ------------------
  |  |  |  Branch (144:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  145|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  146|      0|        jsimd_ycc_extbgrx_convert_##instrset; \
  |  |  147|      0|      break; \
  |  |  148|      0|    case JCS_EXT_XBGR: \
  |  |  ------------------
  |  |  |  Branch (148:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  149|      0|    case JCS_EXT_ABGR: \
  |  |  ------------------
  |  |  |  Branch (149:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  150|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  151|      0|        jsimd_ycc_extxbgr_convert_##instrset; \
  |  |  152|      0|      break; \
  |  |  153|      0|    case JCS_EXT_XRGB: \
  |  |  ------------------
  |  |  |  Branch (153:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  154|      0|    case JCS_EXT_ARGB: \
  |  |  ------------------
  |  |  |  Branch (154:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  155|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  156|      0|        jsimd_ycc_extxrgb_convert_##instrset; \
  |  |  157|      0|      break; \
  |  |  158|      0|    default: \
  |  |  ------------------
  |  |  |  Branch (158:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  159|      0|      cinfo->cconvert->color_convert_simd = \
  |  |  160|      0|        jsimd_ycc_rgb_convert_##instrset; \
  |  |  161|      0|  } \
  |  |  162|      0|}
  ------------------
  257|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  258|      0|  }
  259|       |#if SIMD_ARCHITECTURE == I386
  260|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  261|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(mmx);
  262|       |    return JSIMD_MMX;
  263|       |  }
  264|       |#endif
  265|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  266|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  267|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(neon);
  268|       |    return JSIMD_NEON;
  269|       |  }
  270|       |#elif SIMD_ARCHITECTURE == POWERPC
  271|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  272|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(altivec);
  273|       |    return JSIMD_ALTIVEC;
  274|       |  }
  275|       |#elif SIMD_ARCHITECTURE == RISCV64
  276|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  277|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(rvv);
  278|       |    return JSIMD_RVV;
  279|       |  }
  280|       |#elif SIMD_ARCHITECTURE == MIPS64
  281|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  282|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(mmi);
  283|       |    return JSIMD_MMI;
  284|       |  }
  285|       |#endif
  286|       |
  287|     11|  return JSIMD_NONE;
  ------------------
  |  |   38|     11|#define JSIMD_NONE       0x00
  ------------------
  288|     11|}
jsimd_set_h2v1_upsample:
  451|      9|{
  452|      9|  init_simd((j_common_ptr)cinfo);
  453|       |
  454|      9|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      9|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (454:7): [Folded, False: 9]
  ------------------
  455|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  456|      9|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (456:7): [Folded, False: 9]
  ------------------
  457|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  458|      9|  if (!cinfo->upsample)
  ------------------
  |  Branch (458:7): [True: 0, False: 9]
  ------------------
  459|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  460|       |
  461|      9|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  462|      9|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|      9|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (462:7): [True: 0, False: 9]
  ------------------
  463|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_avx2;
  464|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  465|      0|  }
  466|      9|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|      9|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (466:7): [True: 0, False: 9]
  ------------------
  467|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_sse2;
  468|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  469|      0|  }
  470|       |#if SIMD_ARCHITECTURE == I386
  471|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  472|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_mmx;
  473|       |    return JSIMD_MMX;
  474|       |  }
  475|       |#endif
  476|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  477|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  478|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_neon;
  479|       |    return JSIMD_NEON;
  480|       |  }
  481|       |#elif SIMD_ARCHITECTURE == POWERPC
  482|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  483|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_altivec;
  484|       |    return JSIMD_ALTIVEC;
  485|       |  }
  486|       |#elif SIMD_ARCHITECTURE == RISCV64
  487|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  488|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_rvv;
  489|       |    return JSIMD_RVV;
  490|       |  }
  491|       |#endif
  492|       |
  493|      9|  return JSIMD_NONE;
  ------------------
  |  |   38|      9|#define JSIMD_NONE       0x00
  ------------------
  494|      9|}
jsimd_set_h2v2_upsample:
  509|      7|{
  510|      7|  init_simd((j_common_ptr)cinfo);
  511|       |
  512|      7|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      7|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (512:7): [Folded, False: 7]
  ------------------
  513|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  514|      7|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (514:7): [Folded, False: 7]
  ------------------
  515|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  516|      7|  if (!cinfo->upsample)
  ------------------
  |  Branch (516:7): [True: 0, False: 7]
  ------------------
  517|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  518|       |
  519|      7|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  520|      7|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|      7|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (520:7): [True: 0, False: 7]
  ------------------
  521|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_avx2;
  522|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  523|      0|  }
  524|      7|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|      7|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (524:7): [True: 0, False: 7]
  ------------------
  525|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_sse2;
  526|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  527|      0|  }
  528|       |#if SIMD_ARCHITECTURE == I386
  529|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  530|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_mmx;
  531|       |    return JSIMD_MMX;
  532|       |  }
  533|       |#endif
  534|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  535|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  536|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_neon;
  537|       |    return JSIMD_NEON;
  538|       |  }
  539|       |#elif SIMD_ARCHITECTURE == POWERPC
  540|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  541|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_altivec;
  542|       |    return JSIMD_ALTIVEC;
  543|       |  }
  544|       |#elif SIMD_ARCHITECTURE == RISCV64
  545|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  546|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_rvv;
  547|       |    return JSIMD_RVV;
  548|       |  }
  549|       |#endif
  550|       |
  551|      7|  return JSIMD_NONE;
  ------------------
  |  |   38|      7|#define JSIMD_NONE       0x00
  ------------------
  552|      7|}
jsimd_set_h2v1_fancy_upsample:
  567|      3|{
  568|      3|  init_simd((j_common_ptr)cinfo);
  569|       |
  570|      3|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      3|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (570:7): [Folded, False: 3]
  ------------------
  571|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  572|      3|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (572:7): [Folded, False: 3]
  ------------------
  573|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  574|      3|  if (!cinfo->upsample)
  ------------------
  |  Branch (574:7): [True: 0, False: 3]
  ------------------
  575|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  576|       |
  577|      3|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  578|      3|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|      3|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (578:7): [True: 0, False: 3]
  ------------------
  579|      0|      IS_ALIGNED_AVX(jconst_fancy_upsample_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]
  |  |  ------------------
  ------------------
  580|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_avx2;
  581|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  582|      0|  }
  583|      3|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      3|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (583:7): [True: 0, False: 3]
  ------------------
  584|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_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]
  |  |  ------------------
  ------------------
  585|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_sse2;
  586|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  587|      0|  }
  588|       |#if SIMD_ARCHITECTURE == I386
  589|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  590|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_mmx;
  591|       |    return JSIMD_MMX;
  592|       |  }
  593|       |#endif
  594|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  595|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  596|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_neon;
  597|       |    return JSIMD_NEON;
  598|       |  }
  599|       |#elif SIMD_ARCHITECTURE == POWERPC
  600|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  601|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_altivec;
  602|       |    return JSIMD_ALTIVEC;
  603|       |  }
  604|       |#elif SIMD_ARCHITECTURE == RISCV64
  605|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  606|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_rvv;
  607|       |    return JSIMD_RVV;
  608|       |  }
  609|       |#elif SIMD_ARCHITECTURE == MIPS64
  610|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  611|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_mmi;
  612|       |    return JSIMD_MMI;
  613|       |  }
  614|       |#endif
  615|       |
  616|      3|  return JSIMD_NONE;
  ------------------
  |  |   38|      3|#define JSIMD_NONE       0x00
  ------------------
  617|      3|}
jsimd_set_h2v2_fancy_upsample:
  632|      3|{
  633|      3|  init_simd((j_common_ptr)cinfo);
  634|       |
  635|      3|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|      3|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (635:7): [Folded, False: 3]
  ------------------
  636|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  637|      3|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (637:7): [Folded, False: 3]
  ------------------
  638|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  639|      3|  if (!cinfo->upsample)
  ------------------
  |  Branch (639:7): [True: 0, False: 3]
  ------------------
  640|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  641|       |
  642|      3|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  643|      3|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|      3|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (643:7): [True: 0, False: 3]
  ------------------
  644|      0|      IS_ALIGNED_AVX(jconst_fancy_upsample_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]
  |  |  ------------------
  ------------------
  645|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_avx2;
  646|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  647|      0|  }
  648|      3|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|      3|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (648:7): [True: 0, False: 3]
  ------------------
  649|      0|      IS_ALIGNED_SSE(jconst_fancy_upsample_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]
  |  |  ------------------
  ------------------
  650|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_sse2;
  651|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  652|      0|  }
  653|       |#if SIMD_ARCHITECTURE == I386
  654|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  655|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_mmx;
  656|       |    return JSIMD_MMX;
  657|       |  }
  658|       |#endif
  659|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  660|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  661|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_neon;
  662|       |    return JSIMD_NEON;
  663|       |  }
  664|       |#elif SIMD_ARCHITECTURE == POWERPC
  665|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  666|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_altivec;
  667|       |    return JSIMD_ALTIVEC;
  668|       |  }
  669|       |#elif SIMD_ARCHITECTURE == RISCV64
  670|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  671|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_rvv;
  672|       |    return JSIMD_RVV;
  673|       |  }
  674|       |#elif SIMD_ARCHITECTURE == MIPS64
  675|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  676|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_mmi;
  677|       |    return JSIMD_MMI;
  678|       |  }
  679|       |#endif
  680|       |
  681|      3|  return JSIMD_NONE;
  ------------------
  |  |   38|      3|#define JSIMD_NONE       0x00
  ------------------
  682|      3|}
jsimd_set_idct_islow:
 1148|  1.28k|{
 1149|  1.28k|  init_simd((j_common_ptr)cinfo);
 1150|       |
 1151|  1.28k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1151:7): [Folded, False: 1.28k]
  ------------------
 1152|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1153|  1.28k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.28k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1153:7): [Folded, False: 1.28k]
  ------------------
 1154|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1155|  1.28k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (1155:7): [Folded, False: 1.28k]
  ------------------
 1156|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1157|  1.28k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (1157:7): [Folded, False: 1.28k]
  ------------------
 1158|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1159|  1.28k|  if (!cinfo->idct)
  ------------------
  |  Branch (1159:7): [True: 0, False: 1.28k]
  ------------------
 1160|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1161|       |
 1162|  1.28k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1163|  1.28k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  1.28k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (1163:7): [True: 0, False: 1.28k]
  ------------------
 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|  1.28k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  1.28k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1168:7): [True: 0, False: 1.28k]
  ------------------
 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|  1.28k|  return JSIMD_NONE;
  ------------------
  |  |   38|  1.28k|#define JSIMD_NONE       0x00
  ------------------
 1202|  1.28k|}
jsimd.c:init_simd:
   56|  1.31k|{
   57|  1.31k|#ifndef NO_GETENV
   58|  1.31k|  char env[2] = { 0 };
   59|  1.31k|#endif
   60|  1.31k|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 1.31k, False: 0]
  ------------------
   61|  1.31k|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|  1.31k|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|  1.31k|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 1.31k, False: 0]
  ------------------
   64|  1.31k|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|  1.31k|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|  1.31k|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|  1.31k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  1.31k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 17, False: 1.30k]
  ------------------
   68|     17|    return;
   69|       |
   70|  1.30k|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|  1.30k|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|  1.30k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|  1.30k|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 1.30k, False: 0]
  |  Branch (75:47): [True: 0, False: 1.30k]
  ------------------
   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|  1.30k|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 1.30k, False: 0]
  |  Branch (95:47): [True: 1.30k, False: 0]
  ------------------
   96|  1.30k|    simd_support = 0;
   97|  1.30k|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (97:7): [True: 1.30k, False: 0]
  |  Branch (97:47): [True: 0, False: 1.30k]
  ------------------
   98|      0|    simd_huffman = 0;
   99|  1.30k|#endif
  100|       |
  101|  1.30k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (101:7): [True: 1.30k, False: 0]
  ------------------
  102|  1.30k|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  103|  1.30k|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  104|  1.30k|  } 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|  1.30k|}

jpeg_abort:
   37|    679|{
   38|    679|  int pool;
   39|       |
   40|       |  /* Do nothing if called on a not-initialized or destroyed JPEG object. */
   41|    679|  if (cinfo->mem == NULL)
  ------------------
  |  Branch (41:7): [True: 0, False: 679]
  ------------------
   42|      0|    return;
   43|       |
   44|       |  /* Releasing pools in reverse order might help avoid fragmentation
   45|       |   * with some (brain-damaged) malloc libraries.
   46|       |   */
   47|  1.35k|  for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|    679|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool > JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  1.35k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (47:35): [True: 679, False: 679]
  ------------------
   48|    679|    (*cinfo->mem->free_pool) (cinfo, pool);
   49|    679|  }
   50|       |
   51|       |  /* Reset overall state for possible reuse of object */
   52|    679|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (52:7): [True: 679, False: 0]
  ------------------
   53|    679|    cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|    679|#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|    679|    ((j_decompress_ptr)cinfo)->marker_list = NULL;
   58|    679|    ((j_decompress_ptr)cinfo)->master->marker_list_end = NULL;
   59|    679|  } 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|    679|}
jpeg_destroy:
   90|  2.61k|{
   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|  2.61k|  if (cinfo->mem != NULL)
  ------------------
  |  Branch (210:7): [True: 2.61k, False: 0]
  ------------------
  211|  2.61k|    (*cinfo->mem->self_destruct) (cinfo);
  212|       |  cinfo->mem = NULL;            /* be safe if jpeg_destroy is called twice */
  213|  2.61k|  cinfo->global_state = 0;      /* mark it destroyed */
  214|  2.61k|}
jpeg_alloc_quant_table:
  224|  2.11k|{
  225|  2.11k|  JQUANT_TBL *tbl;
  226|       |
  227|  2.11k|  tbl = (JQUANT_TBL *)
  228|  2.11k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JQUANT_TBL));
  ------------------
  |  |  888|  2.11k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  229|  2.11k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  2.11k|#define FALSE   0               /* values of boolean */
  ------------------
  230|  2.11k|  return tbl;
  231|  2.11k|}
jpeg_alloc_huff_table:
  236|  5.20k|{
  237|  5.20k|  JHUFF_TBL *tbl;
  238|       |
  239|  5.20k|  tbl = (JHUFF_TBL *)
  240|  5.20k|    (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, sizeof(JHUFF_TBL));
  ------------------
  |  |  888|  5.20k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  241|  5.20k|  tbl->sent_table = FALSE;      /* make sure this is false in any new table */
  ------------------
  |  |  207|  5.20k|#define FALSE   0               /* values of boolean */
  ------------------
  242|  5.20k|  return tbl;
  243|  5.20k|}

jpeg_CreateDecompress:
   40|  2.61k|{
   41|  2.61k|  int i;
   42|       |
   43|       |  /* Guard against version mismatches between library and caller. */
   44|  2.61k|  cinfo->mem = NULL;            /* so jpeg_destroy knows mem mgr not called */
   45|  2.61k|  if (version != JPEG_LIB_VERSION)
  ------------------
  |  |    4|  2.61k|#define JPEG_LIB_VERSION  62
  ------------------
  |  Branch (45:7): [True: 0, False: 2.61k]
  ------------------
   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|  2.61k|  if (structsize != sizeof(struct jpeg_decompress_struct))
  ------------------
  |  Branch (47:7): [True: 0, False: 2.61k]
  ------------------
   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|  2.61k|             (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|  2.61k|  {
   58|  2.61k|    struct jpeg_error_mgr *err = cinfo->err;
   59|  2.61k|    void *client_data = cinfo->client_data; /* ignore Purify complaint here */
   60|  2.61k|    memset(cinfo, 0, sizeof(struct jpeg_decompress_struct));
   61|  2.61k|    cinfo->err = err;
   62|  2.61k|    cinfo->client_data = client_data;
   63|  2.61k|  }
   64|  2.61k|  cinfo->is_decompressor = TRUE;
  ------------------
  |  |  210|  2.61k|#define TRUE    1
  ------------------
   65|       |
   66|       |  /* Initialize a memory manager instance for this object */
   67|  2.61k|  jinit_memory_mgr((j_common_ptr)cinfo);
   68|       |
   69|       |  /* Zero out pointers to permanent structures. */
   70|  2.61k|  cinfo->progress = NULL;
   71|  2.61k|  cinfo->src = NULL;
   72|       |
   73|  13.0k|  for (i = 0; i < NUM_QUANT_TBLS; i++)
  ------------------
  |  |   68|  13.0k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (73:15): [True: 10.4k, False: 2.61k]
  ------------------
   74|  10.4k|    cinfo->quant_tbl_ptrs[i] = NULL;
   75|       |
   76|  13.0k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  13.0k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (76:15): [True: 10.4k, False: 2.61k]
  ------------------
   77|  10.4k|    cinfo->dc_huff_tbl_ptrs[i] = NULL;
   78|  10.4k|    cinfo->ac_huff_tbl_ptrs[i] = NULL;
   79|  10.4k|  }
   80|       |
   81|       |  /* Initialize marker processor so application can override methods
   82|       |   * for COM, APPn markers before calling jpeg_read_header.
   83|       |   */
   84|  2.61k|  cinfo->marker_list = NULL;
   85|  2.61k|  jinit_marker_reader(cinfo);
   86|       |
   87|       |  /* And initialize the overall input controller. */
   88|  2.61k|  jinit_input_controller(cinfo);
   89|       |
   90|  2.61k|  cinfo->data_precision = BITS_IN_JSAMPLE;
  ------------------
  |  |   34|  2.61k|#define BITS_IN_JSAMPLE  8
  ------------------
   91|       |
   92|       |  /* OK, I'm ready */
   93|  2.61k|  cinfo->global_state = DSTATE_START;
  ------------------
  |  |   48|  2.61k|#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|  2.61k|  cinfo->master = (struct jpeg_decomp_master *)
   99|  2.61k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  2.61k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  100|  2.61k|                                sizeof(my_decomp_master));
  101|  2.61k|  memset(cinfo->master, 0, sizeof(my_decomp_master));
  102|  2.61k|#ifdef WITH_SIMD
  103|  2.61k|  cinfo->master->simd_support = JSIMD_UNDEFINED;
  ------------------
  |  |   49|  2.61k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  2.61k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  104|  2.61k|  cinfo->master->simd_huffman = 1;
  105|  2.61k|#endif
  106|  2.61k|}
jpeg_destroy_decompress:
  115|  2.61k|{
  116|  2.61k|  jpeg_destroy((j_common_ptr)cinfo); /* use common routine */
  117|  2.61k|}
jpeg_read_header:
  275|  2.61k|{
  276|  2.61k|  int retcode;
  277|       |
  278|  2.61k|  if (cinfo->global_state != DSTATE_START &&
  ------------------
  |  |   48|  5.23k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (278:7): [True: 0, False: 2.61k]
  ------------------
  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|  2.61k|  retcode = jpeg_consume_input(cinfo);
  283|       |
  284|  2.61k|  switch (retcode) {
  ------------------
  |  Branch (284:11): [True: 2.04k, False: 577]
  ------------------
  285|  2.04k|  case JPEG_REACHED_SOS:
  ------------------
  |  | 1111|  2.04k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (285:3): [True: 2.04k, False: 578]
  ------------------
  286|  2.04k|    retcode = JPEG_HEADER_OK;
  ------------------
  |  | 1066|  2.04k|#define JPEG_HEADER_OK           1 /* Found valid image datastream */
  ------------------
  287|  2.04k|    break;
  288|      1|  case JPEG_REACHED_EOI:
  ------------------
  |  | 1112|      1|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (288:3): [True: 1, False: 2.61k]
  ------------------
  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: 2.61k]
  ------------------
  299|       |    /* no work */
  300|      0|    break;
  301|  2.61k|  }
  302|       |
  303|  2.04k|  return retcode;
  304|  2.61k|}
jpeg_consume_input:
  321|  2.61k|{
  322|  2.61k|  int retcode = JPEG_SUSPENDED;
  ------------------
  |  | 1065|  2.61k|#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|  2.61k|  switch (cinfo->global_state) {
  326|  2.61k|  case DSTATE_START:
  ------------------
  |  |   48|  2.61k|#define DSTATE_START     200    /* after create_decompress */
  ------------------
  |  Branch (326:3): [True: 2.61k, False: 0]
  ------------------
  327|       |    /* Start-of-datastream actions: reset appropriate modules */
  328|  2.61k|    (*cinfo->inputctl->reset_input_controller) (cinfo);
  329|       |    /* Initialize application's data source module */
  330|  2.61k|    (*cinfo->src->init_source) (cinfo);
  331|  2.61k|    cinfo->global_state = DSTATE_INHEADER;
  ------------------
  |  |   49|  2.61k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  332|  2.61k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  2.61k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  333|  2.61k|  case DSTATE_INHEADER:
  ------------------
  |  |   49|  2.61k|#define DSTATE_INHEADER  201    /* reading header markers, no SOS yet */
  ------------------
  |  Branch (333:3): [True: 0, False: 2.61k]
  ------------------
  334|  2.61k|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  335|  2.61k|    if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
  ------------------
  |  | 1111|  2.61k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (335:9): [True: 2.04k, False: 578]
  ------------------
  336|       |      /* Set up default parameters based on header data */
  337|  2.04k|      default_decompress_parms(cinfo);
  338|       |      /* Set global state: ready for start_decompress */
  339|  2.04k|      cinfo->global_state = DSTATE_READY;
  ------------------
  |  |   50|  2.04k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  340|  2.04k|    }
  341|  2.61k|    break;
  342|      0|  case DSTATE_READY:
  ------------------
  |  |   50|      0|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (342:3): [True: 0, False: 2.61k]
  ------------------
  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: 2.61k]
  ------------------
  347|      0|  case DSTATE_PRESCAN:
  ------------------
  |  |   52|      0|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (347:3): [True: 0, False: 2.61k]
  ------------------
  348|      0|  case DSTATE_SCANNING:
  ------------------
  |  |   53|      0|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (348:3): [True: 0, False: 2.61k]
  ------------------
  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: 2.61k]
  ------------------
  350|      0|  case DSTATE_BUFIMAGE:
  ------------------
  |  |   55|      0|#define DSTATE_BUFIMAGE  207    /* expecting jpeg_start_output */
  ------------------
  |  Branch (350:3): [True: 0, False: 2.61k]
  ------------------
  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: 2.61k]
  ------------------
  352|      0|  case DSTATE_STOPPING:
  ------------------
  |  |   58|      0|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  |  Branch (352:3): [True: 0, False: 2.61k]
  ------------------
  353|      0|    retcode = (*cinfo->inputctl->consume_input) (cinfo);
  354|      0|    break;
  355|      0|  default:
  ------------------
  |  Branch (355:3): [True: 0, False: 2.61k]
  ------------------
  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|  2.61k|  }
  358|  2.04k|  return retcode;
  359|  2.61k|}
jpeg_finish_decompress:
  403|    776|{
  404|    776|  if ((cinfo->global_state == DSTATE_SCANNING ||
  ------------------
  |  |   53|  1.55k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (404:8): [True: 776, False: 0]
  ------------------
  405|    776|       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: 776, False: 0]
  ------------------
  406|       |    /* Terminate final pass of non-buffered mode */
  407|    776|    if (cinfo->output_scanline < cinfo->output_height)
  ------------------
  |  Branch (407:9): [True: 0, False: 776]
  ------------------
  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|    776|    (*cinfo->master->finish_output_pass) (cinfo);
  410|    776|    cinfo->global_state = DSTATE_STOPPING;
  ------------------
  |  |   58|    776|#define DSTATE_STOPPING  210    /* looking for EOI in jpeg_finish_decompress */
  ------------------
  411|    776|  } 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|  1.00k|  while (!cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (419:10): [True: 229, False: 776]
  ------------------
  420|    229|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|    229|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (420:9): [True: 0, False: 229]
  ------------------
  421|      0|      return FALSE;             /* Suspend, come back later */
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  422|    229|  }
  423|       |  /* Do final cleanup */
  424|    776|  (*cinfo->src->term_source) (cinfo);
  425|       |  /* We can use jpeg_abort to release memory and reset global_state */
  426|    776|  jpeg_abort((j_common_ptr)cinfo);
  427|    776|  return TRUE;
  ------------------
  |  |  210|    776|#define TRUE    1
  ------------------
  428|    776|}
jdapimin.c:default_decompress_parms:
  138|  2.04k|{
  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|  2.04k|  switch (cinfo->num_components) {
  143|  1.95k|  case 1:
  ------------------
  |  Branch (143:3): [True: 1.95k, False: 88]
  ------------------
  144|  1.95k|    cinfo->jpeg_color_space = JCS_GRAYSCALE;
  145|  1.95k|    cinfo->out_color_space = JCS_GRAYSCALE;
  146|  1.95k|    break;
  147|       |
  148|     88|  case 3:
  ------------------
  |  Branch (148:3): [True: 88, False: 1.95k]
  ------------------
  149|     88|    if (cinfo->saw_JFIF_marker) {
  ------------------
  |  Branch (149:9): [True: 2, False: 86]
  ------------------
  150|      2|      cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
  151|     86|    } else if (cinfo->saw_Adobe_marker) {
  ------------------
  |  Branch (151:16): [True: 0, False: 86]
  ------------------
  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|     86|    } else {
  165|       |      /* Saw no special markers, try to guess from the component IDs */
  166|     86|      int cid0 = cinfo->comp_info[0].component_id;
  167|     86|      int cid1 = cinfo->comp_info[1].component_id;
  168|     86|      int cid2 = cinfo->comp_info[2].component_id;
  169|       |
  170|     86|      if (cid0 == 1 && cid1 == 2 && cid2 == 3) {
  ------------------
  |  Branch (170:11): [True: 59, False: 27]
  |  Branch (170:24): [True: 51, False: 8]
  |  Branch (170:37): [True: 51, False: 0]
  ------------------
  171|     51|#ifdef D_LOSSLESS_SUPPORTED
  172|     51|        if (cinfo->master->lossless)
  ------------------
  |  Branch (172:13): [True: 32, False: 19]
  ------------------
  173|     32|          cinfo->jpeg_color_space = JCS_RGB; /* assume RGB w/out marker */
  174|     19|        else
  175|     19|#endif
  176|     19|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
  177|     51|      } else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
  ------------------
  |  Branch (177:18): [True: 2, False: 33]
  |  Branch (177:32): [True: 0, False: 2]
  |  Branch (177:46): [True: 0, False: 0]
  ------------------
  178|      0|        cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
  179|     35|      else {
  180|     35|        TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
  ------------------
  |  |  309|     35|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|     35|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 35]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|     35|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|     35|           (cinfo)->err->msg_code = (code); \
  |  |  312|     35|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  181|     35|#ifdef D_LOSSLESS_SUPPORTED
  182|     35|        if (cinfo->master->lossless)
  ------------------
  |  Branch (182:13): [True: 27, False: 8]
  ------------------
  183|     27|          cinfo->jpeg_color_space = JCS_RGB; /* assume it's RGB */
  184|      8|        else
  185|      8|#endif
  186|      8|          cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
  187|     35|      }
  188|     86|    }
  189|       |    /* Always guess RGB is proper output colorspace. */
  190|     88|    cinfo->out_color_space = JCS_RGB;
  191|     88|    break;
  192|       |
  193|      0|  case 4:
  ------------------
  |  Branch (193:3): [True: 0, False: 2.04k]
  ------------------
  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: 2.04k]
  ------------------
  215|      0|    cinfo->jpeg_color_space = JCS_UNKNOWN;
  216|      0|    cinfo->out_color_space = JCS_UNKNOWN;
  217|      0|    break;
  218|  2.04k|  }
  219|       |
  220|       |  /* Set defaults for other decompression parameters. */
  221|  2.04k|  cinfo->scale_num = 1;         /* 1:1 scaling */
  222|  2.04k|  cinfo->scale_denom = 1;
  223|  2.04k|  cinfo->output_gamma = 1.0;
  224|  2.04k|  cinfo->buffered_image = FALSE;
  ------------------
  |  |  207|  2.04k|#define FALSE   0               /* values of boolean */
  ------------------
  225|  2.04k|  cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|  2.04k|#define FALSE   0               /* values of boolean */
  ------------------
  226|  2.04k|  cinfo->dct_method = JDCT_DEFAULT;
  ------------------
  |  |  301|  2.04k|#define JDCT_DEFAULT  JDCT_ISLOW
  ------------------
  227|  2.04k|  cinfo->do_fancy_upsampling = TRUE;
  ------------------
  |  |  210|  2.04k|#define TRUE    1
  ------------------
  228|  2.04k|  cinfo->do_block_smoothing = TRUE;
  ------------------
  |  |  210|  2.04k|#define TRUE    1
  ------------------
  229|  2.04k|  cinfo->quantize_colors = FALSE;
  ------------------
  |  |  207|  2.04k|#define FALSE   0               /* values of boolean */
  ------------------
  230|       |  /* We set these in case application only sets quantize_colors. */
  231|  2.04k|  cinfo->dither_mode = JDITHER_FS;
  232|  2.04k|#ifdef QUANT_2PASS_SUPPORTED
  233|  2.04k|  cinfo->two_pass_quantize = TRUE;
  ------------------
  |  |  210|  2.04k|#define TRUE    1
  ------------------
  234|       |#else
  235|       |  cinfo->two_pass_quantize = FALSE;
  236|       |#endif
  237|  2.04k|  cinfo->desired_number_of_colors = 256;
  238|  2.04k|  cinfo->colormap = NULL;
  239|       |  /* Initialize for no mode change in buffered-image mode. */
  240|  2.04k|  cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  2.04k|#define FALSE   0               /* values of boolean */
  ------------------
  241|  2.04k|  cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  2.04k|#define FALSE   0               /* values of boolean */
  ------------------
  242|  2.04k|  cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  2.04k|#define FALSE   0               /* values of boolean */
  ------------------
  243|  2.04k|}

jpeg_start_decompress:
   56|  2.00k|{
   57|  2.00k|  if (cinfo->global_state == DSTATE_READY) {
  ------------------
  |  |   50|  2.00k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (57:7): [True: 2.00k, False: 0]
  ------------------
   58|       |    /* First call: initialize master control, select active modules */
   59|  2.00k|    jinit_master_decompress(cinfo);
   60|  2.00k|    if (cinfo->buffered_image) {
  ------------------
  |  Branch (60:9): [True: 0, False: 2.00k]
  ------------------
   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|  2.00k|    cinfo->global_state = DSTATE_PRELOAD;
  ------------------
  |  |   51|  2.00k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
   66|  2.00k|  }
   67|  2.00k|  if (cinfo->global_state == DSTATE_PRELOAD) {
  ------------------
  |  |   51|  2.00k|#define DSTATE_PRELOAD   203    /* reading multiscan file in start_decompress*/
  ------------------
  |  Branch (67:7): [True: 1.88k, False: 127]
  ------------------
   68|       |    /* If file has multiple scans, absorb them all into the coef buffer */
   69|  1.88k|    if (cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (69:9): [True: 816, False: 1.06k]
  ------------------
   70|    816|#ifdef D_MULTISCAN_FILES_SUPPORTED
   71|  46.8k|      for (;;) {
   72|  46.8k|        int retcode;
   73|       |        /* Call progress monitor hook if present */
   74|  46.8k|        if (cinfo->progress != NULL)
  ------------------
  |  Branch (74:13): [True: 46.8k, False: 0]
  ------------------
   75|  46.8k|          (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
   76|       |        /* Absorb some more input */
   77|  46.8k|        retcode = (*cinfo->inputctl->consume_input) (cinfo);
   78|  46.8k|        if (retcode == JPEG_SUSPENDED)
  ------------------
  |  | 1065|  46.8k|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (78:13): [True: 0, False: 46.8k]
  ------------------
   79|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
   80|  46.8k|        if (retcode == JPEG_REACHED_EOI)
  ------------------
  |  | 1112|  46.8k|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (80:13): [True: 561, False: 46.3k]
  ------------------
   81|    561|          break;
   82|       |        /* Advance progress counter if appropriate */
   83|  46.3k|        if (cinfo->progress != NULL &&
  ------------------
  |  Branch (83:13): [True: 46.0k, False: 255]
  ------------------
   84|  46.0k|            (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1113|  92.1k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
                          (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
  ------------------
  |  | 1111|  3.04k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (84:14): [True: 43.0k, False: 3.04k]
  |  Branch (84:47): [True: 1.20k, False: 1.84k]
  ------------------
   85|  44.2k|          if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
  ------------------
  |  Branch (85:15): [True: 535, False: 43.6k]
  ------------------
   86|       |            /* jdmaster underestimated number of scans; ratchet up one scan */
   87|    535|            cinfo->progress->pass_limit += (long)cinfo->total_iMCU_rows;
   88|    535|          }
   89|  44.2k|        }
   90|  46.3k|      }
   91|       |#else
   92|       |      ERREXIT(cinfo, JERR_NOT_COMPILED);
   93|       |#endif /* D_MULTISCAN_FILES_SUPPORTED */
   94|    816|    }
   95|  1.88k|    cinfo->output_scan_number = cinfo->input_scan_number;
   96|  1.88k|  } else if (cinfo->global_state != DSTATE_PRESCAN)
  ------------------
  |  |   52|    127|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (96:14): [True: 0, False: 127]
  ------------------
   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|  2.00k|  return output_pass_setup(cinfo);
  100|  2.00k|}
jpeg_read_scanlines:
  324|   398k|{
  325|   398k|#if BITS_IN_JSAMPLE != 16 || defined(D_LOSSLESS_SUPPORTED)
  326|   398k|  JDIMENSION row_ctr;
  327|       |
  328|   398k|#ifdef D_LOSSLESS_SUPPORTED
  329|   398k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (329:7): [True: 30.7k, False: 367k]
  ------------------
  330|  30.7k|#if BITS_IN_JSAMPLE == 8
  331|  30.7k|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  61.5k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (331:9): [True: 6, False: 30.7k]
  |  Branch (331:52): [True: 0, False: 30.7k]
  ------------------
  332|       |#else
  333|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  334|       |        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  335|       |#endif
  336|      6|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      6|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  337|  30.7k|  } else
  338|   367k|#endif
  339|   367k|  {
  340|   367k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|   367k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (340:9): [True: 15, False: 367k]
  ------------------
  341|     15|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     15|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     15|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     15|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  342|   367k|  }
  343|       |
  344|   398k|  if (cinfo->global_state != DSTATE_SCANNING)
  ------------------
  |  |   53|   398k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (344:7): [True: 0, False: 398k]
  ------------------
  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|   398k|  if (cinfo->output_scanline >= cinfo->output_height) {
  ------------------
  |  Branch (346:7): [True: 0, False: 398k]
  ------------------
  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|   398k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (352:7): [True: 398k, False: 21]
  ------------------
  353|   398k|    cinfo->progress->pass_counter = (long)cinfo->output_scanline;
  354|   398k|    cinfo->progress->pass_limit = (long)cinfo->output_height;
  355|   398k|    (*cinfo->progress->progress_monitor) ((j_common_ptr)cinfo);
  356|   398k|  }
  357|       |
  358|       |  /* Process some data */
  359|   398k|  row_ctr = 0;
  360|   398k|  if (cinfo->main->_process_data == NULL)
  ------------------
  |  |  256|   398k|#define _process_data  process_data
  ------------------
  |  Branch (360:7): [True: 0, False: 398k]
  ------------------
  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|   398k|  (*cinfo->main->_process_data) (cinfo, scanlines, &row_ctr, max_lines);
  ------------------
  |  |  256|   398k|#define _process_data  process_data
  ------------------
  363|   398k|  cinfo->output_scanline += row_ctr;
  364|   398k|  return row_ctr;
  365|       |#else
  366|       |  ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  367|       |  return 0;
  368|       |#endif
  369|   398k|}
jdapistd-8.c:output_pass_setup:
  113|  1.62k|{
  114|  1.62k|  if (cinfo->global_state != DSTATE_PRESCAN) {
  ------------------
  |  |   52|  1.62k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  |  Branch (114:7): [True: 1.62k, False: 0]
  ------------------
  115|       |    /* First call: do pass setup */
  116|  1.62k|    (*cinfo->master->prepare_for_output_pass) (cinfo);
  117|  1.62k|    cinfo->output_scanline = 0;
  118|  1.62k|    cinfo->global_state = DSTATE_PRESCAN;
  ------------------
  |  |   52|  1.62k|#define DSTATE_PRESCAN   204    /* performing dummy pass for 2-pass quant */
  ------------------
  119|  1.62k|  }
  120|       |  /* Loop over any required dummy passes */
  121|  1.62k|  while (cinfo->master->is_dummy_pass) {
  ------------------
  |  Branch (121:10): [True: 0, False: 1.62k]
  ------------------
  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|  1.62k|  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|  3.25k|#define DSTATE_SCANNING  205    /* start_decompress done, read_scanlines OK */
  ------------------
  |  Branch (170:25): [True: 0, False: 1.62k]
  ------------------
  171|  1.62k|  return TRUE;
  ------------------
  |  |  210|  1.62k|#define TRUE    1
  ------------------
  172|  1.62k|}

jinit_arith_decoder:
  751|    980|{
  752|    980|  arith_entropy_ptr entropy;
  753|    980|  int i;
  754|       |
  755|    980|  entropy = (arith_entropy_ptr)
  756|    980|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    980|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|    980|                                sizeof(arith_entropy_decoder));
  758|    980|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|    980|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|  16.6k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  16.6k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 15.6k, False: 980]
  ------------------
  763|  15.6k|    entropy->dc_stats[i] = NULL;
  764|  15.6k|    entropy->ac_stats[i] = NULL;
  765|  15.6k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|    980|  entropy->fixed_bin[0] = 113;
  769|       |
  770|    980|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 767, False: 213]
  ------------------
  771|       |    /* Create progression status table */
  772|    767|    int *coef_bit_ptr, ci;
  773|    767|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|    767|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    767|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|    767|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|    767|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|    767|                                  sizeof(int));
  777|    767|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  1.57k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 803, False: 767]
  ------------------
  779|  52.1k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  52.1k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 51.3k, False: 803]
  ------------------
  780|  51.3k|        *coef_bit_ptr++ = -1;
  781|    767|  }
  782|    980|}
jdarith.c:start_pass:
  633|  2.17k|{
  634|  2.17k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  2.17k|  int ci, tbl;
  636|  2.17k|  jpeg_component_info *compptr;
  637|       |
  638|  2.17k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 1.96k, False: 213]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  1.96k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 1.33k, False: 633]
  ------------------
  641|  1.33k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 1, False: 1.32k]
  ------------------
  642|      1|        goto bad;
  643|  1.33k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|    633|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|    631|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 2, False: 631]
  |  Branch (645:36): [True: 2, False: 629]
  ------------------
  646|      4|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|    629|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 0, False: 629]
  ------------------
  649|      0|        goto bad;
  650|    629|    }
  651|  1.95k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 46, False: 1.91k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|     46|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 4, False: 42]
  ------------------
  654|      4|        goto bad;
  655|     46|    }
  656|  1.95k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 2, False: 1.95k]
  ------------------
  657|     11|bad:
  658|     11|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     11|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     11|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     11|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     11|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     11|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|     11|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|     11|    }
  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|  3.91k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 1.95k, False: 1.96k]
  ------------------
  666|  1.95k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  1.95k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  1.95k|      int *prev_coef_bit_ptr =
  669|  1.95k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  1.95k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 627, False: 1.32k]
  |  Branch (670:24): [True: 1, False: 626]
  ------------------
  671|      1|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  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))
  ------------------
  672|  30.6k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  1.95k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 1.32k, False: 627]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|  30.6k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 15.9k, False: 14.6k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 28.7k, False: 1.95k]
  ------------------
  673|  28.7k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 21.2k, False: 7.43k]
  ------------------
  674|  21.2k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|  7.43k|        else
  676|  7.43k|          prev_coef_bit_ptr[coefi] = 0;
  677|  28.7k|      }
  678|  17.8k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 15.9k, False: 1.95k]
  ------------------
  679|  15.9k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 8.81k, False: 7.12k]
  ------------------
  680|  15.9k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 4, False: 15.9k]
  ------------------
  681|      4|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      4|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|  15.9k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|  15.9k|      }
  684|  1.95k|    }
  685|       |    /* Select MCU decoding routine */
  686|  1.96k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 1.90k, False: 55]
  ------------------
  687|  1.90k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 1.32k, False: 584]
  ------------------
  688|  1.32k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|    584|      else
  690|    584|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  1.90k|    } else {
  692|     55|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 0, False: 55]
  ------------------
  693|      0|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|     55|      else
  695|     55|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|     55|    }
  697|  1.96k|  } 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|    213|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    212|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 1, False: 212]
  |  Branch (701:27): [True: 1, False: 211]
  ------------------
  702|    211|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 1, False: 210]
  |  Branch (702:27): [True: 1, False: 209]
  ------------------
  703|      4|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|    213|    entropy->pub.decode_mcu = decode_mcu;
  706|    213|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  4.33k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 2.15k, False: 2.17k]
  ------------------
  710|  2.15k|    compptr = cinfo->cur_comp_info[ci];
  711|  2.15k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 209, False: 1.94k]
  |  Branch (711:38): [True: 1.32k, False: 623]
  |  Branch (711:56): [True: 1.32k, False: 0]
  ------------------
  712|  1.53k|      tbl = compptr->dc_tbl_no;
  713|  1.53k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  1.53k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 1.53k]
  |  Branch (713:22): [True: 0, False: 1.53k]
  ------------------
  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|  1.53k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 1.01k, False: 523]
  ------------------
  716|  1.01k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  1.01k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  1.01k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  1.01k|#define DC_STAT_BINS  64
  ------------------
  718|  1.53k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  1.53k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  1.53k|      entropy->last_dc_val[ci] = 0;
  721|  1.53k|      entropy->dc_context[ci] = 0;
  722|  1.53k|    }
  723|  2.15k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 209, False: 1.94k]
  |  Branch (723:37): [True: 623, False: 1.32k]
  ------------------
  724|    832|      tbl = compptr->ac_tbl_no;
  725|    832|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|    832|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 832]
  |  Branch (725:22): [True: 0, False: 832]
  ------------------
  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|    832|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 617, False: 215]
  ------------------
  728|    617|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|    617|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|    617|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|    617|#define AC_STAT_BINS  256
  ------------------
  730|    832|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|    832|#define AC_STAT_BINS  256
  ------------------
  731|    832|    }
  732|  2.15k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  2.17k|  entropy->c = 0;
  736|  2.17k|  entropy->a = 0;
  737|  2.17k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  2.17k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.17k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  2.17k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  2.17k|}
jdarith.c:decode_mcu_DC_first:
  251|  2.91M|{
  252|  2.91M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  2.91M|  JBLOCKROW block;
  254|  2.91M|  unsigned char *st;
  255|  2.91M|  int blkn, ci, tbl, sign;
  256|  2.91M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  2.91M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 0, False: 2.91M]
  ------------------
  260|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 0, False: 0]
  ------------------
  261|      0|      process_restart(cinfo);
  262|      0|    entropy->restarts_to_go--;
  263|      0|  }
  264|       |
  265|  2.91M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 0, False: 2.91M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  5.82M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 2.91M, False: 2.91M]
  ------------------
  270|  2.91M|    block = MCU_data[blkn];
  271|  2.91M|    ci = cinfo->MCU_membership[blkn];
  272|  2.91M|    tbl = cinfo->cur_comp_info[ci]->dc_tbl_no;
  273|       |
  274|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  275|       |
  276|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  277|  2.91M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  2.91M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 1.45M, False: 1.45M]
  ------------------
  281|  1.45M|      entropy->dc_context[ci] = 0;
  282|  1.45M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  1.45M|      sign = arith_decode(cinfo, st + 1);
  286|  1.45M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  1.45M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 839k, False: 615k]
  ------------------
  289|   839k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  2.70M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 1.86M, False: 839k]
  ------------------
  291|  1.86M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 11, False: 1.86M]
  ------------------
  292|     11|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     11|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  293|     11|            entropy->ct = -1;                   /* magnitude overflow */
  294|     11|            return TRUE;
  ------------------
  |  |  210|     11|#define TRUE    1
  ------------------
  295|     11|          }
  296|  1.86M|          st += 1;
  297|  1.86M|        }
  298|   839k|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  1.45M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 0, False: 1.45M]
  ------------------
  301|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  1.45M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 718k, False: 736k]
  ------------------
  303|   718k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|   736k|      else
  305|   736k|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  1.45M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  1.45M|      st += 14;
  309|  3.31M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 1.86M, False: 1.45M]
  ------------------
  310|  1.86M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 917k, False: 944k]
  ------------------
  311|  1.45M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 949k, False: 505k]
  ------------------
  312|  1.45M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  1.45M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  2.91M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  2.91M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  2.91M|  }
  318|       |
  319|  2.91M|  return TRUE;
  ------------------
  |  |  210|  2.91M|#define TRUE    1
  ------------------
  320|  2.91M|}
jdarith.c:arith_decode:
  116|  28.6M|{
  117|  28.6M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  28.6M|  register unsigned char nl, nm;
  119|  28.6M|  register JLONG qe, temp;
  120|  28.6M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|  42.9M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 14.2M, False: 28.6M]
  ------------------
  124|  14.2M|    if (--e->ct < 0) {
  ------------------
  |  Branch (124:9): [True: 1.78M, False: 12.4M]
  ------------------
  125|       |      /* Need to fetch next data byte */
  126|  1.78M|      if (cinfo->unread_marker)
  ------------------
  |  Branch (126:11): [True: 1.39M, False: 383k]
  ------------------
  127|  1.39M|        data = 0;               /* stuff zero data */
  128|   383k|      else {
  129|   383k|        data = get_byte(cinfo); /* read next input byte */
  130|   383k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 4.71k, False: 378k]
  ------------------
  131|  13.2k|          do data = get_byte(cinfo);
  132|  13.2k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 8.54k, False: 4.71k]
  ------------------
  133|  4.71k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 2.65k, False: 2.06k]
  ------------------
  134|  2.65k|            data = 0xFF;        /* discard stuffed zero byte */
  135|  2.06k|          else {
  136|       |            /* Note: Different from the Huffman decoder, hitting
  137|       |             * a marker while processing the compressed data
  138|       |             * segment is legal in arithmetic coding.
  139|       |             * The convention is to supply zero data
  140|       |             * then until decoding is complete.
  141|       |             */
  142|  2.06k|            cinfo->unread_marker = data;
  143|  2.06k|            data = 0;
  144|  2.06k|          }
  145|  4.71k|        }
  146|   383k|      }
  147|  1.78M|      e->c = (e->c << 8) | data; /* insert data into C register */
  148|  1.78M|      if ((e->ct += 8) < 0)      /* update bit shift counter */
  ------------------
  |  Branch (148:11): [True: 4.30k, False: 1.77M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|  4.30k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 2.15k, False: 2.15k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|  2.15k|          e->a = 0x8000L; /* => e->a = 0x10000L after loop exit */
  153|  1.78M|    }
  154|  14.2M|    e->a <<= 1;
  155|  14.2M|  }
  156|       |
  157|       |  /* Fetch values from our compact representation of Table D.2:
  158|       |   * Qe values and probability estimation state machine
  159|       |   */
  160|  28.6M|  sv = *st;
  161|  28.6M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  28.6M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  28.6M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  28.6M|  temp = e->a - qe;
  167|  28.6M|  e->a = temp;
  168|  28.6M|  temp <<= e->ct;
  169|  28.6M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 5.06M, False: 23.6M]
  ------------------
  170|  5.06M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  5.06M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 1.41M, False: 3.64M]
  ------------------
  173|  1.41M|      e->a = qe;
  174|  1.41M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  3.64M|    } else {
  176|  3.64M|      e->a = qe;
  177|  3.64M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  3.64M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  3.64M|    }
  180|  23.6M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 5.45M, False: 18.1M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  5.45M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 1.31M, False: 4.14M]
  ------------------
  183|  1.31M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  1.31M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  4.14M|    } else {
  186|  4.14M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  4.14M|    }
  188|  5.45M|  }
  189|       |
  190|  28.6M|  return sv >> 7;
  191|  28.6M|}
jdarith.c:get_byte:
   76|   396k|{
   77|   396k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|   396k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 62, False: 396k]
  ------------------
   80|     62|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 62]
  ------------------
   81|      0|      ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   82|   396k|  src->bytes_in_buffer--;
   83|   396k|  return *src->next_input_byte++;
   84|   396k|}
jdarith.c:decode_mcu_AC_first:
  330|  1.45M|{
  331|  1.45M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|  1.45M|  JBLOCKROW block;
  333|  1.45M|  unsigned char *st;
  334|  1.45M|  int tbl, sign, k;
  335|  1.45M|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|  1.45M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 0, False: 1.45M]
  ------------------
  339|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 0, False: 0]
  ------------------
  340|      0|      process_restart(cinfo);
  341|      0|    entropy->restarts_to_go--;
  342|      0|  }
  343|       |
  344|  1.45M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 0, False: 1.45M]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|  1.45M|  block = MCU_data[0];
  348|  1.45M|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  349|       |
  350|       |  /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  351|       |
  352|       |  /* Figure F.20: Decode_AC_coefficients */
  353|  2.96M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 2.96M, False: 885]
  ------------------
  354|  2.96M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  2.96M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 1.45M, False: 1.50M]
  ------------------
  356|  2.87M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 1.36M, False: 1.50M]
  ------------------
  357|  1.36M|      st += 3;  k++;
  358|  1.36M|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 24, False: 1.36M]
  ------------------
  359|     24|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     24|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|     24|        entropy->ct = -1;                       /* spectral overflow */
  361|     24|        return TRUE;
  ------------------
  |  |  210|     24|#define TRUE    1
  ------------------
  362|     24|      }
  363|  1.36M|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  1.50M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  1.50M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  1.50M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 728k, False: 778k]
  ------------------
  370|   728k|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 527k, False: 200k]
  ------------------
  371|   527k|        m <<= 1;
  372|   527k|        st = entropy->ac_stats[tbl] +
  373|   527k|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 322k, False: 205k]
  ------------------
  374|  1.23M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 708k, False: 527k]
  ------------------
  375|   708k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 4, False: 708k]
  ------------------
  376|      4|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|      4|            entropy->ct = -1;                   /* magnitude overflow */
  378|      4|            return TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
  379|      4|          }
  380|   708k|          st += 1;
  381|   708k|        }
  382|   527k|      }
  383|   728k|    }
  384|  1.50M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  1.50M|    st += 14;
  387|  2.74M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 1.23M, False: 1.50M]
  ------------------
  388|  1.23M|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 776k, False: 459k]
  ------------------
  389|  1.50M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 670k, False: 835k]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  1.50M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  1.50M|  }
  393|       |
  394|  1.45M|  return TRUE;
  ------------------
  |  |  210|  1.45M|#define TRUE    1
  ------------------
  395|  1.45M|}
jdarith.c:decode_mcu_AC_refine:
  437|  38.3k|{
  438|  38.3k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  38.3k|  JBLOCKROW block;
  440|  38.3k|  JCOEFPTR thiscoef;
  441|  38.3k|  unsigned char *st;
  442|  38.3k|  int tbl, k, kex;
  443|  38.3k|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  38.3k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 0, False: 38.3k]
  ------------------
  447|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 0]
  ------------------
  448|      0|      process_restart(cinfo);
  449|      0|    entropy->restarts_to_go--;
  450|      0|  }
  451|       |
  452|  38.3k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 0, False: 38.3k]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  38.3k|  block = MCU_data[0];
  456|  38.3k|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  38.3k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  38.3k|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  38.3k|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|   634k|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 623k, False: 11.1k]
  ------------------
  463|   623k|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 27.1k, False: 596k]
  ------------------
  464|       |
  465|   130k|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 129k, False: 493]
  ------------------
  466|   129k|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|   129k|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 60.7k, False: 69.0k]
  ------------------
  468|  60.7k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 37.8k, False: 22.8k]
  ------------------
  469|   144k|    for (;;) {
  470|   144k|      thiscoef = *block + jpeg_natural_order[k];
  471|   144k|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 49.8k, False: 94.3k]
  ------------------
  472|  49.8k|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 25.3k, False: 24.4k]
  ------------------
  473|  25.3k|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 11.4k, False: 13.8k]
  ------------------
  474|  11.4k|            *thiscoef += (JCOEF)m1;
  475|  13.8k|          else
  476|  13.8k|            *thiscoef += (JCOEF)p1;
  477|  25.3k|        }
  478|  49.8k|        break;
  479|  49.8k|      }
  480|  94.3k|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 42.1k, False: 52.2k]
  ------------------
  481|  42.1k|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 17.6k, False: 24.4k]
  ------------------
  482|  17.6k|          *thiscoef = (JCOEF)m1;
  483|  24.4k|        else
  484|  24.4k|          *thiscoef = (JCOEF)p1;
  485|  42.1k|        break;
  486|  42.1k|      }
  487|  52.2k|      st += 3;  k++;
  488|  52.2k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 25, False: 52.2k]
  ------------------
  489|     25|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     25|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     25|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|     25|        entropy->ct = -1;                       /* spectral overflow */
  491|     25|        return TRUE;
  ------------------
  |  |  210|     25|#define TRUE    1
  ------------------
  492|     25|      }
  493|  52.2k|    }
  494|  91.9k|  }
  495|       |
  496|  38.3k|  return TRUE;
  ------------------
  |  |  210|  38.3k|#define TRUE    1
  ------------------
  497|  38.3k|}
jdarith.c:decode_mcu:
  506|   408k|{
  507|   408k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|   408k|  jpeg_component_info *compptr;
  509|   408k|  JBLOCKROW block;
  510|   408k|  unsigned char *st;
  511|   408k|  int blkn, ci, tbl, sign, k;
  512|   408k|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|   408k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 0, False: 408k]
  ------------------
  516|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 0, False: 0]
  ------------------
  517|      0|      process_restart(cinfo);
  518|      0|    entropy->restarts_to_go--;
  519|      0|  }
  520|       |
  521|   408k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 0, False: 408k]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|   816k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 408k, False: 408k]
  ------------------
  526|   408k|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 408k, False: 0]
  ------------------
  527|   408k|    ci = cinfo->MCU_membership[blkn];
  528|   408k|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|   408k|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|   408k|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|   408k|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 177k, False: 230k]
  ------------------
  539|   177k|      entropy->dc_context[ci] = 0;
  540|   230k|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|   230k|      sign = arith_decode(cinfo, st + 1);
  544|   230k|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|   230k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 137k, False: 93.5k]
  ------------------
  547|   137k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|   383k|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 245k, False: 137k]
  ------------------
  549|   245k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 9, False: 245k]
  ------------------
  550|      9|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      9|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|      9|            entropy->ct = -1;                   /* magnitude overflow */
  552|      9|            return TRUE;
  ------------------
  |  |  210|      9|#define TRUE    1
  ------------------
  553|      9|          }
  554|   245k|          st += 1;
  555|   245k|        }
  556|   137k|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|   230k|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 0, False: 230k]
  ------------------
  559|      0|        entropy->dc_context[ci] = 0;               /* zero diff category */
  560|   230k|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (560:16): [True: 103k, False: 127k]
  ------------------
  561|   103k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|   127k|      else
  563|   127k|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|   230k|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|   230k|      st += 14;
  567|   476k|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 245k, False: 230k]
  ------------------
  568|   245k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 106k, False: 139k]
  ------------------
  569|   230k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 167k, False: 62.9k]
  ------------------
  570|   230k|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|   230k|    }
  572|       |
  573|   408k|    if (block)
  ------------------
  |  Branch (573:9): [True: 408k, False: 5]
  ------------------
  574|   408k|      (*block)[0] = (JCOEF)entropy->last_dc_val[ci];
  575|       |
  576|       |    /* Sections F.2.4.2 & F.1.4.4.2: Decoding of AC coefficients */
  577|       |
  578|   408k|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|   937k|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|   937k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 937k, False: 44]
  ------------------
  582|   937k|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|   937k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 408k, False: 529k]
  ------------------
  584|  1.32M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 800k, False: 529k]
  ------------------
  585|   800k|        st += 3;  k++;
  586|   800k|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|   800k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 1, False: 800k]
  ------------------
  587|      1|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|      1|          entropy->ct = -1;                     /* spectral overflow */
  589|      1|          return TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  590|      1|        }
  591|   800k|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|   529k|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|   529k|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|   529k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 254k, False: 274k]
  ------------------
  598|   254k|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 180k, False: 74.1k]
  ------------------
  599|   180k|          m <<= 1;
  600|   180k|          st = entropy->ac_stats[tbl] +
  601|   180k|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 124k, False: 56.4k]
  ------------------
  602|   463k|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 282k, False: 180k]
  ------------------
  603|   282k|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 1, False: 282k]
  ------------------
  604|      1|              WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  605|      1|              entropy->ct = -1;                 /* magnitude overflow */
  606|      1|              return TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
  607|      1|            }
  608|   282k|            st += 1;
  609|   282k|          }
  610|   180k|        }
  611|   254k|      }
  612|   529k|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|   529k|      st += 14;
  615|   992k|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 463k, False: 529k]
  ------------------
  616|   463k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 228k, False: 234k]
  ------------------
  617|   529k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 228k, False: 301k]
  ------------------
  618|   529k|      if (block)
  ------------------
  |  Branch (618:11): [True: 529k, False: 16]
  ------------------
  619|   529k|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|   529k|    }
  621|   408k|  }
  622|       |
  623|   408k|  return TRUE;
  ------------------
  |  |  210|   408k|#define TRUE    1
  ------------------
  624|   408k|}

jinit_d_coef_controller:
  869|  1.56k|{
  870|  1.56k|  my_coef_ptr coef;
  871|       |
  872|  1.56k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 1.56k]
  ------------------
  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|  1.56k|  coef = (my_coef_ptr)
  876|  1.56k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  1.56k|                                sizeof(my_coef_controller));
  878|  1.56k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  1.56k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  1.56k|  coef->pub.start_input_pass = start_input_pass;
  881|  1.56k|  coef->pub.start_output_pass = start_output_pass;
  882|  1.56k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  1.56k|  coef->coef_bits_latch = NULL;
  884|  1.56k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  1.56k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 803, False: 762]
  ------------------
  888|    803|#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|    803|    int ci, access_rows;
  893|    803|    jpeg_component_info *compptr;
  894|       |
  895|  1.62k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 825, False: 803]
  ------------------
  896|    825|         ci++, compptr++) {
  897|    825|      access_rows = compptr->v_samp_factor;
  898|    825|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|    825|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 816, False: 9]
  ------------------
  901|    816|        access_rows *= 5;
  902|    825|#endif
  903|    825|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|    825|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|    825|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|    825|#define TRUE    1
  ------------------
  905|    825|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|    825|                               (long)compptr->h_samp_factor),
  907|    825|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|    825|                               (long)compptr->v_samp_factor),
  909|    825|         (JDIMENSION)access_rows);
  910|    825|    }
  911|    803|    coef->pub.consume_data = consume_data;
  912|    803|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    803|#define _decompress_data  decompress_data
  ------------------
  913|    803|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    803|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|    762|    JBLOCKROW buffer;
  920|    762|    int i;
  921|       |
  922|    762|    buffer = (JBLOCKROW)
  923|    762|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    762|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|    762|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|    762|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|  8.38k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  8.38k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 7.62k, False: 762]
  ------------------
  926|  7.62k|      coef->MCU_buffer[i] = buffer + i;
  927|  7.62k|    }
  928|    762|    coef->pub.consume_data = dummy_consume_data;
  929|    762|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|    762|#define _decompress_data  decompress_data
  ------------------
  930|    762|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|    762|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  1.56k|  coef->workspace = (JCOEF *)
  935|  1.56k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  1.56k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  1.56k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  1.56k|}
jdcoefct-8.c:start_input_pass:
   50|  2.56k|{
   51|  2.56k|  cinfo->input_iMCU_row = 0;
   52|  2.56k|  start_iMCU_row(cinfo);
   53|  2.56k|}
jdcoefct-8.c:start_output_pass:
   62|  1.28k|{
   63|  1.28k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  1.28k|  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.28k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 547, False: 738]
  ------------------
   68|    547|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 547, False: 0]
  |  Branch (68:38): [True: 431, False: 116]
  ------------------
   69|    431|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|    431|#define _decompress_data  decompress_data
  ------------------
   70|    116|    else
   71|    116|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    116|#define _decompress_data  decompress_data
  ------------------
   72|    547|  }
   73|  1.28k|#endif
   74|  1.28k|  cinfo->output_iMCU_row = 0;
   75|  1.28k|}
jdcoefct-8.c:smoothing_ok:
  405|    547|{
  406|    547|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    547|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    547|#define FALSE   0               /* values of boolean */
  ------------------
  408|    547|  int ci, coefi;
  409|    547|  jpeg_component_info *compptr;
  410|    547|  JQUANT_TBL *qtable;
  411|    547|  int *coef_bits, *prev_coef_bits;
  412|    547|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    547|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 547]
  |  Branch (414:35): [True: 0, False: 547]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    547|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 547, False: 0]
  ------------------
  419|    547|    coef->coef_bits_latch = (int *)
  420|    547|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    547|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    547|                                  cinfo->num_components * 2 *
  422|    547|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    547|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    547|  coef_bits_latch = coef->coef_bits_latch;
  424|    547|  prev_coef_bits_latch =
  425|    547|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    547|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  1.00k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 547, False: 462]
  ------------------
  428|    547|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    547|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 547]
  ------------------
  431|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|    547|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 10, False: 537]
  ------------------
  434|    537|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    537|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 7, False: 530]
  ------------------
  435|    530|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    530|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 14, False: 516]
  ------------------
  436|    516|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    516|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 10, False: 506]
  ------------------
  437|    506|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    506|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 5, False: 501]
  ------------------
  438|    501|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    501|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 8, False: 493]
  ------------------
  439|    493|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    493|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 6, False: 487]
  ------------------
  440|    487|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    487|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 10, False: 477]
  ------------------
  441|    477|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    477|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 7, False: 470]
  ------------------
  442|    470|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    470|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 8, False: 462]
  ------------------
  443|     85|      return FALSE;
  ------------------
  |  |  207|     85|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    462|    coef_bits = cinfo->coef_bits[ci];
  446|    462|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    462|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 462]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|    462|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  4.62k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  4.62k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 4.15k, False: 462]
  ------------------
  452|  4.15k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 2.52k, False: 1.63k]
  ------------------
  453|  2.52k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  1.63k|      else
  455|  1.63k|        prev_coef_bits_latch[coefi] = -1;
  456|  4.15k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  4.15k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 3.62k, False: 535]
  ------------------
  458|  3.62k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  3.62k|#define TRUE    1
  ------------------
  459|  4.15k|    }
  460|    462|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    462|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    462|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    462|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    462|  }
  463|       |
  464|    462|  return smoothing_useful;
  465|    547|}
jdcoefct-8.c:decompress_smooth_data:
  474|  13.3k|{
  475|  13.3k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  13.3k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  13.3k|  JDIMENSION block_num, last_block_column;
  478|  13.3k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  13.3k|    image_block_rows;
  480|  13.3k|  JBLOCKARRAY buffer;
  481|  13.3k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  13.3k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  13.3k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  13.3k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|  13.3k|  JDIMENSION output_col;
  485|  13.3k|  jpeg_component_info *compptr;
  486|  13.3k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  13.3k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|  13.3k|  boolean change_dc;
  488|  13.3k|  JCOEF *workspace;
  489|  13.3k|  int *coef_bits;
  490|  13.3k|  JQUANT_TBL *quanttbl;
  491|  13.3k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  13.3k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  13.3k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  13.3k|      DC25;
  495|  13.3k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  13.3k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  13.3k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 13.3k, False: 0]
  ------------------
  502|  13.3k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 13.3k]
  ------------------
  503|      0|    if (cinfo->input_scan_number == cinfo->output_scan_number) {
  ------------------
  |  Branch (503:9): [True: 0, False: 0]
  ------------------
  504|       |      /* If input is working on current scan, we ordinarily want it to
  505|       |       * have completed the current row.  But if input scan is DC,
  506|       |       * we want it to keep two rows ahead so that next two block rows' DC
  507|       |       * values are up to date.
  508|       |       */
  509|      0|      JDIMENSION delta = (cinfo->Ss == 0) ? 2 : 0;
  ------------------
  |  Branch (509:26): [True: 0, False: 0]
  ------------------
  510|      0|      if (cinfo->input_iMCU_row > cinfo->output_iMCU_row + delta)
  ------------------
  |  Branch (510:11): [True: 0, False: 0]
  ------------------
  511|      0|        break;
  512|      0|    }
  513|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (513:9): [True: 0, False: 0]
  ------------------
  514|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  515|      0|  }
  516|       |
  517|       |  /* OK, output from the virtual arrays. */
  518|  26.6k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 13.3k, False: 13.3k]
  ------------------
  519|  13.3k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  13.3k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 13.3k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  13.3k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 12.4k, False: 844]
  ------------------
  525|  12.4k|      block_rows = compptr->v_samp_factor;
  526|  12.4k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  12.4k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 413, False: 431]
  ------------------
  528|    413|      block_rows = compptr->v_samp_factor;
  529|    413|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|    431|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|    431|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|    431|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 329, False: 102]
  ------------------
  534|    431|      access_rows = block_rows; /* this iMCU row only */
  535|    431|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  13.3k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 12.4k, False: 844]
  ------------------
  538|  12.4k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  12.4k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  12.4k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  12.4k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  12.4k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  12.4k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  12.4k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  12.4k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 413, False: 431]
  ------------------
  545|    413|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    413|      buffer = (*cinfo->mem->access_virt_barray)
  547|    413|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    413|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    413|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    413|#define FALSE   0               /* values of boolean */
  ------------------
  550|    413|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    431|    } else {
  552|    431|      buffer = (*cinfo->mem->access_virt_barray)
  553|    431|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    431|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    431|#define FALSE   0               /* values of boolean */
  ------------------
  555|    431|    }
  556|       |    /* Fetch component-dependent info.
  557|       |     * If the current scan is incomplete, then we use the component-dependent
  558|       |     * info from the previous scan.
  559|       |     */
  560|  13.3k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 0, False: 13.3k]
  ------------------
  561|      0|      coef_bits =
  562|      0|        coef->coef_bits_latch + ((ci + cinfo->num_components) * SAVED_COEFS);
  ------------------
  |  |   58|      0|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  563|  13.3k|    else
  564|  13.3k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  13.3k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  565|       |
  566|       |    /* We only do DC interpolation if no AC coefficient data is available. */
  567|  13.3k|    change_dc =
  568|  13.3k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 9.32k, False: 3.99k]
  |  Branch (568:29): [True: 9.21k, False: 115]
  |  Branch (568:51): [True: 9.14k, False: 72]
  ------------------
  569|  9.14k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 8.98k, False: 154]
  |  Branch (569:29): [True: 8.89k, False: 92]
  |  Branch (569:51): [True: 8.82k, False: 74]
  ------------------
  570|  8.82k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 8.75k, False: 67]
  |  Branch (570:29): [True: 8.65k, False: 99]
  |  Branch (570:51): [True: 8.53k, False: 115]
  ------------------
  571|       |
  572|  13.3k|    quanttbl = compptr->quant_table;
  573|  13.3k|    Q00 = quanttbl->quantval[0];
  574|  13.3k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  13.3k|#define Q01_POS  1
  ------------------
  575|  13.3k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  13.3k|#define Q10_POS  8
  ------------------
  576|  13.3k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  13.3k|#define Q20_POS  16
  ------------------
  577|  13.3k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  13.3k|#define Q11_POS  9
  ------------------
  578|  13.3k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  13.3k|#define Q02_POS  2
  ------------------
  579|  13.3k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 8.53k, False: 4.78k]
  ------------------
  580|  8.53k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  8.53k|#define Q03_POS  3
  ------------------
  581|  8.53k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  8.53k|#define Q12_POS  10
  ------------------
  582|  8.53k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  8.53k|#define Q21_POS  17
  ------------------
  583|  8.53k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  8.53k|#define Q30_POS  24
  ------------------
  584|  8.53k|    }
  585|  13.3k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  13.3k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|  13.3k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  13.3k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|  40.1k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 26.8k, False: 13.3k]
  ------------------
  590|  26.8k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  26.8k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  26.8k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 26.4k, False: 431]
  ------------------
  594|  26.4k|        prev_block_row =
  595|  26.4k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    431|      else
  597|    431|        prev_block_row = buffer_ptr;
  598|       |
  599|  26.8k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 26.0k, False: 845]
  ------------------
  600|  26.0k|        prev_prev_block_row =
  601|  26.0k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|    845|      else
  603|    845|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  26.8k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 26.4k, False: 431]
  ------------------
  606|  26.4k|        next_block_row =
  607|  26.4k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|    431|      else
  609|    431|        next_block_row = buffer_ptr;
  610|       |
  611|  26.8k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 26.0k, False: 771]
  ------------------
  612|  26.0k|        next_next_block_row =
  613|  26.0k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    771|      else
  615|    771|        next_next_block_row = next_block_row;
  616|       |
  617|       |      /* We fetch the surrounding DC values using a sliding-register approach.
  618|       |       * Initialize all 25 here so as to do the right thing on narrow pics.
  619|       |       */
  620|  26.8k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  26.8k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  26.8k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  26.8k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  26.8k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  26.8k|      output_col = 0;
  626|  26.8k|      last_block_column = compptr->width_in_blocks - 1;
  627|  26.8k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  1.04M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 1.01M, False: 26.8k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  1.01M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  1.01M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 26.8k, False: 987k]
  ------------------
  633|  26.8k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 18.7k, False: 8.07k]
  ------------------
  634|  18.7k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  18.7k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  18.7k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  18.7k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  18.7k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  18.7k|        }
  640|  1.01M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 968k, False: 45.6k]
  ------------------
  641|   968k|          DC05 = (int)prev_prev_block_row[2][0];
  642|   968k|          DC10 = (int)prev_block_row[2][0];
  643|   968k|          DC15 = (int)buffer_ptr[2][0];
  644|   968k|          DC20 = (int)next_block_row[2][0];
  645|   968k|          DC25 = (int)next_next_block_row[2][0];
  646|   968k|        }
  647|       |        /* If DC interpolation is enabled, compute coefficient estimates using
  648|       |         * a Gaussian-like kernel, keeping the averages of the DC values.
  649|       |         *
  650|       |         * If DC interpolation is disabled, compute coefficient estimates using
  651|       |         * an algorithm similar to the one described in Section K.8 of the JPEG
  652|       |         * standard, except applied to a 5x5 window rather than a 3x3 window.
  653|       |         *
  654|       |         * An estimate is applied only if the coefficient is still zero and is
  655|       |         * not known to be fully accurate.
  656|       |         */
  657|       |        /* AC01 */
  658|  1.01M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 1.00M, False: 10.0k]
  |  Branch (658:41): [True: 867k, False: 136k]
  ------------------
  659|   867k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 448k, False: 418k]
  ------------------
  660|   448k|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|   448k|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|   448k|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|   448k|                 DC21 - DC22 + DC24 + DC25) :
  664|   867k|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|   867k|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 577k, False: 290k]
  ------------------
  666|   577k|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|   577k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 154k, False: 422k]
  |  Branch (667:27): [True: 46.1k, False: 108k]
  ------------------
  668|  46.1k|              pred = (1 << Al) - 1;
  669|   577k|          } else {
  670|   290k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   290k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 76.0k, False: 213k]
  |  Branch (671:27): [True: 21.8k, False: 54.2k]
  ------------------
  672|  21.8k|              pred = (1 << Al) - 1;
  673|   290k|            pred = -pred;
  674|   290k|          }
  675|   867k|          workspace[1] = (JCOEF)pred;
  676|   867k|        }
  677|       |        /* AC10 */
  678|  1.01M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 914k, False: 99.0k]
  |  Branch (678:41): [True: 870k, False: 44.7k]
  ------------------
  679|   870k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 448k, False: 421k]
  ------------------
  680|   448k|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|   448k|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|   448k|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|   448k|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|   870k|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|   870k|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 656k, False: 213k]
  ------------------
  686|   656k|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|   656k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 234k, False: 422k]
  |  Branch (687:27): [True: 211k, False: 22.1k]
  ------------------
  688|   211k|              pred = (1 << Al) - 1;
  689|   656k|          } else {
  690|   213k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   213k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 90.3k, False: 123k]
  |  Branch (691:27): [True: 80.7k, False: 9.61k]
  ------------------
  692|  80.7k|              pred = (1 << Al) - 1;
  693|   213k|            pred = -pred;
  694|   213k|          }
  695|   870k|          workspace[8] = (JCOEF)pred;
  696|   870k|        }
  697|       |        /* AC20 */
  698|  1.01M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 896k, False: 117k]
  |  Branch (698:41): [True: 848k, False: 47.9k]
  ------------------
  699|   848k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 448k, False: 400k]
  ------------------
  700|   448k|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|   448k|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|   848k|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|   848k|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 448k, False: 399k]
  ------------------
  704|   448k|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|   448k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 169k, False: 279k]
  |  Branch (705:27): [True: 101k, False: 67.4k]
  ------------------
  706|   101k|              pred = (1 << Al) - 1;
  707|   448k|          } else {
  708|   399k|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|   399k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 154k, False: 245k]
  |  Branch (709:27): [True: 101k, False: 52.6k]
  ------------------
  710|   101k|              pred = (1 << Al) - 1;
  711|   399k|            pred = -pred;
  712|   399k|          }
  713|   848k|          workspace[16] = (JCOEF)pred;
  714|   848k|        }
  715|       |        /* AC11 */
  716|  1.01M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 873k, False: 140k]
  |  Branch (716:41): [True: 852k, False: 21.4k]
  ------------------
  717|   852k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 448k, False: 403k]
  ------------------
  718|   448k|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|   448k|                 9 * DC19 + DC21 - DC25) :
  720|   852k|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   403k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|   852k|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 482k, False: 370k]
  ------------------
  723|   482k|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|   482k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 190k, False: 291k]
  |  Branch (724:27): [True: 8.05k, False: 182k]
  ------------------
  725|  8.05k|              pred = (1 << Al) - 1;
  726|   482k|          } else {
  727|   370k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   370k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 159k, False: 210k]
  |  Branch (728:27): [True: 7.96k, False: 151k]
  ------------------
  729|  7.96k|              pred = (1 << Al) - 1;
  730|   370k|            pred = -pred;
  731|   370k|          }
  732|   852k|          workspace[9] = (JCOEF)pred;
  733|   852k|        }
  734|       |        /* AC02 */
  735|  1.01M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 873k, False: 140k]
  |  Branch (735:41): [True: 850k, False: 23.5k]
  ------------------
  736|   850k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 448k, False: 401k]
  ------------------
  737|   448k|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|   448k|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|   850k|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|   850k|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 458k, False: 392k]
  ------------------
  741|   458k|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|   458k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 200k, False: 258k]
  |  Branch (742:27): [True: 4.59k, False: 195k]
  ------------------
  743|  4.59k|              pred = (1 << Al) - 1;
  744|   458k|          } else {
  745|   392k|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|   392k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 155k, False: 236k]
  |  Branch (746:27): [True: 4.79k, False: 151k]
  ------------------
  747|  4.79k|              pred = (1 << Al) - 1;
  748|   392k|            pred = -pred;
  749|   392k|          }
  750|   850k|          workspace[2] = (JCOEF)pred;
  751|   850k|        }
  752|  1.01M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 448k, False: 565k]
  ------------------
  753|       |          /* AC03 */
  754|   448k|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 448k, False: 0]
  |  Branch (754:43): [True: 448k, False: 0]
  ------------------
  755|   448k|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|   448k|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 346k, False: 101k]
  ------------------
  757|   346k|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|   346k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 346k]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|   346k|            } else {
  761|   101k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   101k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 101k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   101k|              pred = -pred;
  765|   101k|            }
  766|   448k|            workspace[3] = (JCOEF)pred;
  767|   448k|          }
  768|       |          /* AC12 */
  769|   448k|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 448k, False: 0]
  |  Branch (769:43): [True: 448k, False: 0]
  ------------------
  770|   448k|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|   448k|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 134k, False: 314k]
  ------------------
  772|   134k|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|   134k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 134k]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|   314k|            } else {
  776|   314k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   314k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 314k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   314k|              pred = -pred;
  780|   314k|            }
  781|   448k|            workspace[10] = (JCOEF)pred;
  782|   448k|          }
  783|       |          /* AC21 */
  784|   448k|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 448k, False: 0]
  |  Branch (784:43): [True: 448k, False: 0]
  ------------------
  785|   448k|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|   448k|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 233k, False: 214k]
  ------------------
  787|   233k|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|   233k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 233k]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|   233k|            } else {
  791|   214k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   214k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 214k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   214k|              pred = -pred;
  795|   214k|            }
  796|   448k|            workspace[17] = (JCOEF)pred;
  797|   448k|          }
  798|       |          /* AC30 */
  799|   448k|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 448k, False: 0]
  |  Branch (799:43): [True: 448k, False: 0]
  ------------------
  800|   448k|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|   448k|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 352k, False: 95.8k]
  ------------------
  802|   352k|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|   352k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 352k]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|   352k|            } else {
  806|  95.8k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|  95.8k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 95.8k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|  95.8k|              pred = -pred;
  810|  95.8k|            }
  811|   448k|            workspace[24] = (JCOEF)pred;
  812|   448k|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|   448k|          num = Q00 *
  817|   448k|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|   448k|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|   448k|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|   448k|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|   448k|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|   448k|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 130k, False: 317k]
  ------------------
  823|   130k|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|   317k|          } else {
  825|   317k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   317k|            pred = -pred;
  827|   317k|          }
  828|   448k|          workspace[0] = (JCOEF)pred;
  829|   448k|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  1.01M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  1.01M|                        output_col);
  837|       |#ifdef WITH_PROFILE
  838|       |        cinfo->master->idct_elapsed += getTime() - cinfo->master->start;
  839|       |        cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  840|       |#endif
  841|       |        /* Advance for next column */
  842|  1.01M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  1.01M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  1.01M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  1.01M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  1.01M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  1.01M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  1.01M|          prev_prev_block_row++, next_next_block_row++;
  849|  1.01M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.01M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  1.01M|      }
  851|  26.8k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  26.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  26.8k|    }
  853|  13.3k|  }
  854|       |
  855|  13.3k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 12.8k, False: 431]
  ------------------
  856|  12.8k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  12.8k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|    431|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    431|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  13.3k|}
jdcoefct-8.c:consume_data:
  218|  40.7k|{
  219|  40.7k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  40.7k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  40.7k|  int blkn, ci, xindex, yindex, yoffset;
  222|  40.7k|  JDIMENSION start_col;
  223|  40.7k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  40.7k|  JBLOCKROW buffer_ptr;
  225|  40.7k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  81.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 40.7k, False: 40.7k]
  ------------------
  229|  40.7k|    compptr = cinfo->cur_comp_info[ci];
  230|  40.7k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  40.7k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  40.7k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  40.7k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  40.7k|#define TRUE    1
  ------------------
  234|       |    /* Note: entropy decoder expects buffer to be zeroed,
  235|       |     * but this is handled automatically by the memory manager
  236|       |     * because we requested a pre-zeroed array.
  237|       |     */
  238|  40.7k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|   122k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 81.9k, False: 40.7k]
  ------------------
  242|  81.9k|       yoffset++) {
  243|  4.13M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 4.05M, False: 81.9k]
  ------------------
  244|  4.05M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  4.05M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  8.10M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 4.05M, False: 4.05M]
  ------------------
  248|  4.05M|        compptr = cinfo->cur_comp_info[ci];
  249|  4.05M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  8.10M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 4.05M, False: 4.05M]
  ------------------
  251|  4.05M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  8.10M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 4.05M, False: 4.05M]
  ------------------
  253|  4.05M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  4.05M|          }
  255|  4.05M|        }
  256|  4.05M|      }
  257|  4.05M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 4.05M, False: 0]
  ------------------
  258|  4.05M|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  259|       |      /* Try to fetch the MCU. */
  260|       |#ifdef WITH_PROFILE
  261|       |      cinfo->master->start = getTime();
  262|       |#endif
  263|  4.05M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 4.05M]
  ------------------
  264|       |        /* Suspension forced; update state counters and exit */
  265|      0|        coef->MCU_vert_offset = yoffset;
  266|      0|        coef->MCU_ctr = MCU_col_num;
  267|       |#ifdef WITH_PROFILE
  268|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  269|       |        cinfo->master->entropy_mcoeffs +=
  270|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  271|       |#endif
  272|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  273|      0|      }
  274|       |#ifdef WITH_PROFILE
  275|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  276|       |      cinfo->master->entropy_mcoeffs +=
  277|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  278|       |#endif
  279|  4.05M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  81.9k|    coef->MCU_ctr = 0;
  282|  81.9k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  40.7k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 38.9k, False: 1.82k]
  ------------------
  285|  38.9k|    start_iMCU_row(cinfo);
  286|  38.9k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  38.9k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  38.9k|  }
  288|       |  /* Completed the scan */
  289|  1.82k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  1.82k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.82k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  40.7k|}
jdcoefct-8.c:decompress_data:
  304|  2.64k|{
  305|  2.64k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  2.64k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  2.64k|  JDIMENSION block_num;
  308|  2.64k|  int ci, block_row, block_rows;
  309|  2.64k|  JBLOCKARRAY buffer;
  310|  2.64k|  JBLOCKROW buffer_ptr;
  311|  2.64k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  2.64k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|  2.64k|  JDIMENSION output_col;
  313|  2.64k|  jpeg_component_info *compptr;
  314|  2.64k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  2.64k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  315|       |
  316|       |  /* Force some input to be done if we are getting ahead of the input. */
  317|  2.64k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 2.64k]
  ------------------
  318|  2.64k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 2.64k, False: 0]
  ------------------
  319|  2.64k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 2.64k]
  ------------------
  320|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (320:9): [True: 0, False: 0]
  ------------------
  321|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  322|      0|  }
  323|       |
  324|       |  /* OK, output from the virtual arrays. */
  325|  5.29k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 2.64k, False: 2.64k]
  ------------------
  326|  2.64k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  2.64k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 2.64k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  2.64k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  2.64k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  2.64k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  2.64k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  2.64k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  2.64k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 2.53k, False: 116]
  ------------------
  337|  2.53k|      block_rows = compptr->v_samp_factor;
  338|    116|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|    116|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|    116|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 102, False: 14]
  ------------------
  342|    116|    }
  343|  2.64k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  2.64k|#define _inverse_DCT  inverse_DCT
  ------------------
  344|  2.64k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  7.92k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 5.28k, False: 2.64k]
  ------------------
  347|  5.28k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  5.28k|      output_col = 0;
  349|  5.28k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|   282k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 276k, False: 5.28k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|   276k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|   276k|                        output_col);
  356|       |#ifdef WITH_PROFILE
  357|       |        cinfo->master->idct_elapsed += getTime() - cinfo->master->start;
  358|       |        cinfo->master->idct_mcoeffs += (double)DCTSIZE2 / 1000000.;
  359|       |#endif
  360|   276k|        buffer_ptr++;
  361|   276k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   276k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|   276k|      }
  363|  5.28k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  5.28k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  5.28k|    }
  365|  2.64k|  }
  366|       |
  367|  2.64k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 2.53k, False: 116]
  ------------------
  368|  2.53k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  2.53k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|    116|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    116|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  2.64k|}
jdcoefct-8.c:decompress_onepass:
   90|  7.61k|{
   91|  7.61k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  7.61k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  7.61k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  7.61k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  7.61k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  7.61k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  7.61k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  7.61k|  JDIMENSION start_col, output_col;
   98|  7.61k|  jpeg_component_info *compptr;
   99|  7.61k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  7.61k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  22.5k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 14.9k, False: 7.61k]
  ------------------
  103|  14.9k|       yoffset++) {
  104|   690k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 675k, False: 14.9k]
  ------------------
  105|   675k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   675k|      jzero_far((void *)coef->MCU_buffer[0],
  108|   675k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   675k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 675k, False: 0]
  ------------------
  110|   675k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   675k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 675k]
  ------------------
  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|   675k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 674k, False: 515]
  ------------------
  135|   674k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 674k, 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|   674k|        blkn = 0;               /* index of current DCT block within MCU */
  142|  1.34M|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 674k, False: 674k]
  ------------------
  143|   674k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   674k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 674k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   674k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   674k|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   674k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 660k, False: 14.3k]
  ------------------
  151|   660k|                         compptr->MCU_width : compptr->last_col_width;
  152|   674k|          output_ptr = output_buf[compptr->component_index] +
  153|   674k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   674k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   674k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   674k|                      compptr->MCU_sample_width;
  156|  1.34M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 674k, False: 674k]
  ------------------
  157|   674k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 654k, False: 20.6k]
  ------------------
  158|   674k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 20.6k, False: 0]
  ------------------
  159|   674k|              output_col = start_col;
  160|  1.34M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 674k, False: 674k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   674k|                (*inverse_DCT) (cinfo, compptr,
  165|   674k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   674k|                                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|   674k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   674k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   674k|              }
  174|   674k|            }
  175|   674k|            blkn += compptr->MCU_width;
  176|   674k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   674k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   674k|          }
  178|   674k|        }
  179|   674k|      }
  180|   675k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  14.9k|    coef->MCU_ctr = 0;
  183|  14.9k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  7.61k|  cinfo->output_iMCU_row++;
  186|  7.61k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 6.87k, False: 738]
  ------------------
  187|  6.87k|    start_iMCU_row(cinfo);
  188|  6.87k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  6.87k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  6.87k|  }
  190|       |  /* Completed the scan */
  191|    738|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|    738|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    738|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  7.61k|}
j12init_d_coef_controller:
  869|     62|{
  870|     62|  my_coef_ptr coef;
  871|       |
  872|     62|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     62|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 62]
  ------------------
  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|     62|  coef = (my_coef_ptr)
  876|     62|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     62|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|     62|                                sizeof(my_coef_controller));
  878|     62|  memset(coef, 0, sizeof(my_coef_controller));
  879|     62|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|     62|  coef->pub.start_input_pass = start_input_pass;
  881|     62|  coef->pub.start_output_pass = start_output_pass;
  882|     62|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|     62|  coef->coef_bits_latch = NULL;
  884|     62|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|     62|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 60, False: 2]
  ------------------
  888|     60|#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|     60|    int ci, access_rows;
  893|     60|    jpeg_component_info *compptr;
  894|       |
  895|    144|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 84, False: 60]
  ------------------
  896|     84|         ci++, compptr++) {
  897|     84|      access_rows = compptr->v_samp_factor;
  898|     84|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|     84|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 81, False: 3]
  ------------------
  901|     81|        access_rows *= 5;
  902|     84|#endif
  903|     84|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|     84|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|     84|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|     84|#define TRUE    1
  ------------------
  905|     84|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|     84|                               (long)compptr->h_samp_factor),
  907|     84|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|     84|                               (long)compptr->v_samp_factor),
  909|     84|         (JDIMENSION)access_rows);
  910|     84|    }
  911|     60|    coef->pub.consume_data = consume_data;
  912|     60|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     60|#define _decompress_data  decompress_data_12
  ------------------
  913|     60|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|     60|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|      2|    JBLOCKROW buffer;
  920|      2|    int i;
  921|       |
  922|      2|    buffer = (JBLOCKROW)
  923|      2|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      2|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|      2|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|      2|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|     22|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|     22|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 20, False: 2]
  ------------------
  926|     20|      coef->MCU_buffer[i] = buffer + i;
  927|     20|    }
  928|      2|    coef->pub.consume_data = dummy_consume_data;
  929|      2|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|      2|#define _decompress_data  decompress_data_12
  ------------------
  930|      2|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|      2|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|     62|  coef->workspace = (JCOEF *)
  935|     62|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     62|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|     62|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|     62|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|     62|}
jdcoefct-12.c:start_input_pass:
   50|    195|{
   51|    195|  cinfo->input_iMCU_row = 0;
   52|    195|  start_iMCU_row(cinfo);
   53|    195|}
jdcoefct-12.c:start_output_pass:
   62|     15|{
   63|     15|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|     15|  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|     15|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 14, False: 1]
  ------------------
   68|     14|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 14, False: 0]
  |  Branch (68:38): [True: 2, False: 12]
  ------------------
   69|      2|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|      2|#define _decompress_data  decompress_data_12
  ------------------
   70|     12|    else
   71|     12|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     12|#define _decompress_data  decompress_data_12
  ------------------
   72|     14|  }
   73|     15|#endif
   74|     15|  cinfo->output_iMCU_row = 0;
   75|     15|}
jdcoefct-12.c:smoothing_ok:
  405|     14|{
  406|     14|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|     14|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|     14|#define FALSE   0               /* values of boolean */
  ------------------
  408|     14|  int ci, coefi;
  409|     14|  jpeg_component_info *compptr;
  410|     14|  JQUANT_TBL *qtable;
  411|     14|  int *coef_bits, *prev_coef_bits;
  412|     14|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|     14|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 0, False: 14]
  |  Branch (414:35): [True: 0, False: 14]
  ------------------
  415|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|     14|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 14, False: 0]
  ------------------
  419|     14|    coef->coef_bits_latch = (int *)
  420|     14|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|     14|                                  cinfo->num_components * 2 *
  422|     14|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|     14|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|     14|  coef_bits_latch = coef->coef_bits_latch;
  424|     14|  prev_coef_bits_latch =
  425|     14|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|     14|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|     17|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 14, False: 3]
  ------------------
  428|     14|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|     14|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 14]
  ------------------
  431|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|     14|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 1, False: 13]
  ------------------
  434|     13|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|     13|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 1, False: 12]
  ------------------
  435|     12|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|     12|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 1, False: 11]
  ------------------
  436|     11|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|     11|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 2, False: 9]
  ------------------
  437|      9|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|      9|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 1, False: 8]
  ------------------
  438|      8|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|      8|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 1, False: 7]
  ------------------
  439|      7|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|      7|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 1, False: 6]
  ------------------
  440|      6|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|      6|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 1, False: 5]
  ------------------
  441|      5|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|      5|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 1, False: 4]
  ------------------
  442|      4|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|      4|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 1, False: 3]
  ------------------
  443|     11|      return FALSE;
  ------------------
  |  |  207|     11|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|      3|    coef_bits = cinfo->coef_bits[ci];
  446|      3|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|      3|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 3]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|      3|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|     30|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|     30|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 27, False: 3]
  ------------------
  452|     27|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 18, False: 9]
  ------------------
  453|     18|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|      9|      else
  455|      9|        prev_coef_bits_latch[coefi] = -1;
  456|     27|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|     27|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 18, False: 9]
  ------------------
  458|     18|        smoothing_useful = TRUE;
  ------------------
  |  |  210|     18|#define TRUE    1
  ------------------
  459|     27|    }
  460|      3|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|      3|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|      3|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|      3|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|      3|  }
  463|       |
  464|      3|  return smoothing_useful;
  465|     14|}
jdcoefct-12.c:consume_data:
  218|  4.23k|{
  219|  4.23k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  4.23k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  4.23k|  int blkn, ci, xindex, yindex, yoffset;
  222|  4.23k|  JDIMENSION start_col;
  223|  4.23k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  4.23k|  JBLOCKROW buffer_ptr;
  225|  4.23k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  8.46k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 4.23k, False: 4.23k]
  ------------------
  229|  4.23k|    compptr = cinfo->cur_comp_info[ci];
  230|  4.23k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  4.23k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  4.23k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  4.23k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  4.23k|#define TRUE    1
  ------------------
  234|       |    /* Note: entropy decoder expects buffer to be zeroed,
  235|       |     * but this is handled automatically by the memory manager
  236|       |     * because we requested a pre-zeroed array.
  237|       |     */
  238|  4.23k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  12.5k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 8.29k, False: 4.23k]
  ------------------
  242|  8.29k|       yoffset++) {
  243|   390k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 382k, False: 8.29k]
  ------------------
  244|   382k|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|   382k|      blkn = 0;                 /* index of current DCT block within MCU */
  247|   764k|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 382k, False: 382k]
  ------------------
  248|   382k|        compptr = cinfo->cur_comp_info[ci];
  249|   382k|        start_col = MCU_col_num * compptr->MCU_width;
  250|   764k|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 382k, False: 382k]
  ------------------
  251|   382k|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|   764k|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 382k, False: 382k]
  ------------------
  253|   382k|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|   382k|          }
  255|   382k|        }
  256|   382k|      }
  257|   382k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 382k, False: 0]
  ------------------
  258|   382k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  259|       |      /* Try to fetch the MCU. */
  260|       |#ifdef WITH_PROFILE
  261|       |      cinfo->master->start = getTime();
  262|       |#endif
  263|   382k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 382k]
  ------------------
  264|       |        /* Suspension forced; update state counters and exit */
  265|      0|        coef->MCU_vert_offset = yoffset;
  266|      0|        coef->MCU_ctr = MCU_col_num;
  267|       |#ifdef WITH_PROFILE
  268|       |        cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  269|       |        cinfo->master->entropy_mcoeffs +=
  270|       |          (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  271|       |#endif
  272|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  273|      0|      }
  274|       |#ifdef WITH_PROFILE
  275|       |      cinfo->master->entropy_elapsed += getTime() - cinfo->master->start;
  276|       |      cinfo->master->entropy_mcoeffs +=
  277|       |        (double)cinfo->blocks_in_MCU * DCTSIZE2 / 1000000.;
  278|       |#endif
  279|   382k|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  8.29k|    coef->MCU_ctr = 0;
  282|  8.29k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  4.23k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 4.03k, False: 194]
  ------------------
  285|  4.03k|    start_iMCU_row(cinfo);
  286|  4.03k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  4.03k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  4.03k|  }
  288|       |  /* Completed the scan */
  289|    194|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|    194|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    194|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  4.23k|}

jdcoefct-8.c:start_iMCU_row:
   68|  48.4k|{
   69|  48.4k|  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|  48.4k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 0, False: 48.4k]
  ------------------
   76|      0|    coef->MCU_rows_per_iMCU_row = 1;
   77|  48.4k|  } else {
   78|  48.4k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 46.5k, False: 1.90k]
  ------------------
   79|  46.5k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  1.90k|    else
   81|  1.90k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  48.4k|  }
   83|       |
   84|  48.4k|  coef->MCU_ctr = 0;
   85|  48.4k|  coef->MCU_vert_offset = 0;
   86|  48.4k|}
jdcoefct-12.c:start_iMCU_row:
   68|  4.23k|{
   69|  4.23k|  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|  4.23k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 0, False: 4.23k]
  ------------------
   76|      0|    coef->MCU_rows_per_iMCU_row = 1;
   77|  4.23k|  } else {
   78|  4.23k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 4.06k, False: 171]
  ------------------
   79|  4.06k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|    171|    else
   81|    171|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  4.23k|  }
   83|       |
   84|  4.23k|  coef->MCU_ctr = 0;
   85|  4.23k|  coef->MCU_vert_offset = 0;
   86|  4.23k|}

jinit_color_deconverter:
  625|  1.90k|{
  626|  1.90k|  my_cconvert_ptr cconvert;
  627|  1.90k|  int ci;
  628|       |
  629|  1.90k|#ifdef D_LOSSLESS_SUPPORTED
  630|  1.90k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 339, False: 1.56k]
  ------------------
  631|    339|#if BITS_IN_JSAMPLE == 8
  632|    339|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    678|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 339]
  |  Branch (632:52): [True: 0, False: 339]
  ------------------
  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|    339|  } else
  639|  1.56k|#endif
  640|  1.56k|  {
  641|  1.56k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 1.56k]
  ------------------
  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|  1.56k|  }
  644|       |
  645|  1.90k|  cconvert = (my_cconvert_ptr)
  646|  1.90k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.90k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  1.90k|                                sizeof(my_color_deconverter));
  648|  1.90k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  1.90k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  1.90k|  switch (cinfo->jpeg_color_space) {
  653|  1.88k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 1.88k, False: 24]
  ------------------
  654|  1.88k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 1.88k]
  ------------------
  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.88k|    break;
  657|       |
  658|     12|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 12, False: 1.89k]
  ------------------
  659|     24|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 12, False: 1.89k]
  ------------------
  660|     24|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 24]
  ------------------
  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|     24|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 1.90k]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 1.90k]
  ------------------
  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.90k]
  ------------------
  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.90k|  }
  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.90k|  switch (cinfo->out_color_space) {
  684|  1.88k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 1.88k, False: 24]
  ------------------
  685|  1.88k|#ifdef D_LOSSLESS_SUPPORTED
  686|  1.88k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 326, False: 1.55k]
  ------------------
  687|    326|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 326]
  ------------------
  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.88k|#endif
  690|  1.88k|    cinfo->out_color_components = 1;
  691|  1.88k|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 1.88k, False: 0]
  ------------------
  692|  1.88k|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|  1.88k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|  1.88k|#define _color_convert  color_convert
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|  1.88k|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 1.88k]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|  1.88k|    } 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|  1.88k|    break;
  703|       |
  704|     24|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 24, False: 1.88k]
  ------------------
  705|     24|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 1.90k]
  ------------------
  706|     24|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 1.90k]
  ------------------
  707|     24|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 1.90k]
  ------------------
  708|     24|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 1.90k]
  ------------------
  709|     24|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 1.90k]
  ------------------
  710|     24|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 1.90k]
  ------------------
  711|     24|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 1.90k]
  ------------------
  712|     24|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 1.90k]
  ------------------
  713|     24|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 1.90k]
  ------------------
  714|     24|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 1.90k]
  ------------------
  715|     24|#ifdef D_LOSSLESS_SUPPORTED
  716|     24|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 13, False: 11]
  |  Branch (716:36): [True: 1, False: 12]
  ------------------
  717|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|     24|#endif
  719|     24|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     24|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 11, False: 13]
  ------------------
  721|     11|#ifdef WITH_SIMD
  722|     11|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 0, False: 11]
  ------------------
  723|      0|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  724|     11|      else
  725|     11|#endif
  726|     11|      {
  727|     11|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 11]
  ------------------
  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: 11]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 11]
  ------------------
  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: 11]
  ------------------
  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: 11]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 11]
  ------------------
  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: 11]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 11]
  ------------------
  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: 11]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 11]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  749|      0|          break;
  750|     11|        default:
  ------------------
  |  Branch (750:9): [True: 11, False: 0]
  ------------------
  751|     11|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  267|     11|#define _color_convert  color_convert
  ------------------
  752|     11|        }
  753|     11|        build_ycc_rgb_table(cinfo);
  754|     11|      }
  755|     13|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 13]
  ------------------
  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|     13|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 12, False: 1]
  ------------------
  783|     12|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 12, False: 0]
  ------------------
  784|     12|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 12, False: 0]
  ------------------
  785|     12|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 12, False: 0]
  ------------------
  786|     12|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 12, False: 0]
  ------------------
  787|     12|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|     12|#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|     12|    } else
  817|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|     24|    break;
  819|       |
  820|     24|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 1.90k]
  ------------------
  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: 1.90k]
  ------------------
  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: 1.90k]
  ------------------
  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|  1.90k|  }
  882|       |
  883|  1.90k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 1.90k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  1.90k|  else
  886|  1.90k|    cinfo->output_components = cinfo->out_color_components;
  887|  1.90k|}
jdcolor-8.c:start_pass_dcolor:
  614|  1.60k|{
  615|       |  /* no work needed */
  616|  1.60k|}
jdcolor-8.c:grayscale_convert:
  397|   397k|{
  398|   397k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  297|   397k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  399|   397k|                     cinfo->output_width);
  400|   397k|}
jdcolor-8.c:build_ycc_rgb_table:
  218|     11|{
  219|     11|#if BITS_IN_JSAMPLE != 16
  220|     11|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|     11|  int i;
  222|     11|  JLONG x;
  223|     11|  SHIFT_TEMPS
  224|       |
  225|     11|  cconvert->Cr_r_tab = (int *)
  226|     11|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     11|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|     11|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|     11|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     11|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  228|     11|  cconvert->Cb_b_tab = (int *)
  229|     11|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     11|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|     11|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|     11|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     11|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  231|     11|  cconvert->Cr_g_tab = (JLONG *)
  232|     11|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     11|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|     11|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|     11|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     11|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  234|     11|  cconvert->Cb_g_tab = (JLONG *)
  235|     11|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     11|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|     11|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|     11|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|     11|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  237|       |
  238|  2.82k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  227|     11|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  ------------------
  |  |  |  |   53|     11|#define CENTERJSAMPLE    128
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  226|  2.82k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  2.82k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 2.81k, False: 11]
  ------------------
  239|       |    /* i is the actual input pixel value, in the range 0.._MAXJSAMPLE */
  240|       |    /* The Cb or Cr value we are thinking of is x = i - _CENTERJSAMPLE */
  241|       |    /* Cr=>R value is nearest int to 1.40200 * x */
  242|  2.81k|    cconvert->Cr_r_tab[i] = (int)
  243|  2.81k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  2.81k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|  2.81k|    cconvert->Cb_b_tab[i] = (int)
  246|  2.81k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  2.81k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|  2.81k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|  2.81k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  2.81k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  249|       |    /* Cb=>G value is scaled-up -0.34414 * x */
  250|       |    /* We also add in ONE_HALF so that need not do it in inner loop */
  251|  2.81k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|  2.81k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  2.81k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|  2.81k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|  2.81k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|  2.81k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|     11|}
j12init_color_deconverter:
  625|     82|{
  626|     82|  my_cconvert_ptr cconvert;
  627|     82|  int ci;
  628|       |
  629|     82|#ifdef D_LOSSLESS_SUPPORTED
  630|     82|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 18, False: 64]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|     18|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     36|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 18]
  ------------------
  635|     18|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     18|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 18]
  ------------------
  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|     18|  } else
  639|     64|#endif
  640|     64|  {
  641|     64|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     64|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 64]
  ------------------
  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|     64|  }
  644|       |
  645|     82|  cconvert = (my_cconvert_ptr)
  646|     82|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     82|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|     82|                                sizeof(my_color_deconverter));
  648|     82|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|     82|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|     82|  switch (cinfo->jpeg_color_space) {
  653|     59|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 59, False: 23]
  ------------------
  654|     59|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 59]
  ------------------
  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|     59|    break;
  657|       |
  658|      8|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 8, False: 74]
  ------------------
  659|     23|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 15, False: 67]
  ------------------
  660|     23|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 23]
  ------------------
  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|     23|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 82]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 82]
  ------------------
  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: 82]
  ------------------
  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|     82|  }
  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|     82|  switch (cinfo->out_color_space) {
  684|     59|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 59, False: 23]
  ------------------
  685|     59|#ifdef D_LOSSLESS_SUPPORTED
  686|     59|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 9, False: 50]
  ------------------
  687|      9|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 9]
  ------------------
  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|     59|#endif
  690|     59|    cinfo->out_color_components = 1;
  691|     59|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 59, False: 0]
  ------------------
  692|     59|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|     59|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  151|     59|#define _color_convert  color_convert_12
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|     59|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 59]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|     59|    } 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|     59|    break;
  703|       |
  704|     23|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 23, False: 59]
  ------------------
  705|     23|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 82]
  ------------------
  706|     23|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 82]
  ------------------
  707|     23|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 82]
  ------------------
  708|     23|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 82]
  ------------------
  709|     23|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 82]
  ------------------
  710|     23|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 82]
  ------------------
  711|     23|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 82]
  ------------------
  712|     23|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 82]
  ------------------
  713|     23|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 82]
  ------------------
  714|     23|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 82]
  ------------------
  715|     23|#ifdef D_LOSSLESS_SUPPORTED
  716|     23|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 9, False: 14]
  |  Branch (716:36): [True: 1, False: 8]
  ------------------
  717|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  718|     23|#endif
  719|     23|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     23|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 14, False: 9]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|     14|      {
  727|     14|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 14]
  ------------------
  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: 14]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 14]
  ------------------
  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: 14]
  ------------------
  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: 14]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 14]
  ------------------
  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: 14]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 14]
  ------------------
  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: 14]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 14]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  749|      0|          break;
  750|     14|        default:
  ------------------
  |  Branch (750:9): [True: 14, False: 0]
  ------------------
  751|     14|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  151|     14|#define _color_convert  color_convert_12
  ------------------
  752|     14|        }
  753|     14|        build_ycc_rgb_table(cinfo);
  754|     14|      }
  755|     14|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 9]
  ------------------
  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|      9|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 8, False: 1]
  ------------------
  783|      8|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 8, False: 0]
  ------------------
  784|      8|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 8, False: 0]
  ------------------
  785|      8|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 8, False: 0]
  ------------------
  786|      8|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 8, False: 0]
  ------------------
  787|      8|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|      8|#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|      8|    } else
  817|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  818|     23|    break;
  819|       |
  820|     23|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 82]
  ------------------
  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: 82]
  ------------------
  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: 82]
  ------------------
  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|     82|  }
  882|       |
  883|     81|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 81]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|     81|  else
  886|     81|    cinfo->output_components = cinfo->out_color_components;
  887|     81|}
jdcolor-12.c:start_pass_dcolor:
  614|     18|{
  615|       |  /* no work needed */
  616|     18|}
jdcolor-12.c:build_ycc_rgb_table:
  218|     14|{
  219|     14|#if BITS_IN_JSAMPLE != 16
  220|     14|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|     14|  int i;
  222|     14|  JLONG x;
  223|     14|  SHIFT_TEMPS
  224|       |
  225|     14|  cconvert->Cr_r_tab = (int *)
  226|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|     14|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|     14|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     14|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  228|     14|  cconvert->Cb_b_tab = (int *)
  229|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|     14|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|     14|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     14|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  231|     14|  cconvert->Cr_g_tab = (JLONG *)
  232|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|     14|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|     14|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     14|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  234|     14|  cconvert->Cb_g_tab = (JLONG *)
  235|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|     14|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|     14|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     14|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  237|       |
  238|  57.3k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  111|     14|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|     14|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  110|  57.3k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|  57.3k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 57.3k, False: 14]
  ------------------
  239|       |    /* i is the actual input pixel value, in the range 0.._MAXJSAMPLE */
  240|       |    /* The Cb or Cr value we are thinking of is x = i - _CENTERJSAMPLE */
  241|       |    /* Cr=>R value is nearest int to 1.40200 * x */
  242|  57.3k|    cconvert->Cr_r_tab[i] = (int)
  243|  57.3k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  57.3k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|  57.3k|    cconvert->Cb_b_tab[i] = (int)
  246|  57.3k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|  57.3k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|  57.3k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|  57.3k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  57.3k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  249|       |    /* Cb=>G value is scaled-up -0.34414 * x */
  250|       |    /* We also add in ONE_HALF so that need not do it in inner loop */
  251|  57.3k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|  57.3k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|  57.3k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|  57.3k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|  57.3k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|  57.3k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|     14|}
j16init_color_deconverter:
  625|     21|{
  626|     21|  my_cconvert_ptr cconvert;
  627|     21|  int ci;
  628|       |
  629|     21|#ifdef D_LOSSLESS_SUPPORTED
  630|     21|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 21, False: 0]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|     21|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     42|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (634:9): [True: 0, False: 21]
  ------------------
  635|     21|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     21|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (635:9): [True: 0, False: 21]
  ------------------
  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|     21|  } 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|     21|  cconvert = (my_cconvert_ptr)
  646|     21|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     21|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|     21|                                sizeof(my_color_deconverter));
  648|     21|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|     21|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|     21|  switch (cinfo->jpeg_color_space) {
  653|      8|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 8, False: 13]
  ------------------
  654|      8|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 8]
  ------------------
  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|      8|    break;
  657|       |
  658|     13|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 13, False: 8]
  ------------------
  659|     13|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 0, False: 21]
  ------------------
  660|     13|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 13]
  ------------------
  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|     13|    break;
  663|       |
  664|      0|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 0, False: 21]
  ------------------
  665|      0|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 0, False: 21]
  ------------------
  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: 21]
  ------------------
  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|     21|  }
  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|     21|  switch (cinfo->out_color_space) {
  684|      8|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 8, False: 13]
  ------------------
  685|      8|#ifdef D_LOSSLESS_SUPPORTED
  686|      8|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 8, False: 0]
  ------------------
  687|      8|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 8]
  ------------------
  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|      8|#endif
  690|      8|    cinfo->out_color_components = 1;
  691|      8|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 8, False: 0]
  ------------------
  692|      8|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      8|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |   59|      8|#define _color_convert  color_convert_16
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      8|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 8]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      8|    } 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|      8|    break;
  703|       |
  704|     13|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 13, False: 8]
  ------------------
  705|     13|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 21]
  ------------------
  706|     13|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 21]
  ------------------
  707|     13|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 21]
  ------------------
  708|     13|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 21]
  ------------------
  709|     13|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 21]
  ------------------
  710|     13|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 21]
  ------------------
  711|     13|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 21]
  ------------------
  712|     13|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 21]
  ------------------
  713|     13|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 21]
  ------------------
  714|     13|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 21]
  ------------------
  715|     13|#ifdef D_LOSSLESS_SUPPORTED
  716|     13|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 13, False: 0]
  |  Branch (716:36): [True: 0, False: 13]
  ------------------
  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|     13|#endif
  719|     13|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|     13|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 13]
  ------------------
  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|     13|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 13]
  ------------------
  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|     13|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 13, False: 0]
  ------------------
  783|     13|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 13, False: 0]
  ------------------
  784|     13|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 13, False: 0]
  ------------------
  785|     13|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 13, False: 0]
  ------------------
  786|     13|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 13, False: 0]
  ------------------
  787|     13|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|     13|#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|     13|    } 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|     13|    break;
  819|       |
  820|     13|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 21]
  ------------------
  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: 21]
  ------------------
  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: 21]
  ------------------
  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|     21|  }
  882|       |
  883|     21|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 21]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|     21|  else
  886|     21|    cinfo->output_components = cinfo->out_color_components;
  887|     21|}
jdcolor-16.c:start_pass_dcolor:
  614|      3|{
  615|       |  /* no work needed */
  616|      3|}

jinit_inverse_dct:
  335|  1.56k|{
  336|  1.56k|  my_idct_ptr idct;
  337|  1.56k|  int ci;
  338|  1.56k|  jpeg_component_info *compptr;
  339|       |
  340|  1.56k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (340:7): [True: 0, False: 1.56k]
  ------------------
  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|  1.56k|  idct = (my_idct_ptr)
  344|  1.56k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.56k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  345|  1.56k|                                sizeof(my_idct_controller));
  346|  1.56k|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  347|  1.56k|  idct->pub.start_pass = start_pass;
  348|       |
  349|  3.15k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (349:44): [True: 1.58k, False: 1.56k]
  ------------------
  350|  1.58k|       ci++, compptr++) {
  351|       |    /* Allocate and pre-zero a multiplier table for each component */
  352|  1.58k|    compptr->dct_table =
  353|  1.58k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.58k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|  1.58k|                                  sizeof(multiplier_table));
  355|  1.58k|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  356|       |    /* Mark multiplier table not yet set up for any method */
  357|  1.58k|    idct->cur_method[ci] = -1;
  358|  1.58k|  }
  359|  1.56k|}
jddctmgr-8.c:start_pass:
  102|  1.28k|{
  103|  1.28k|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  104|  1.28k|  int ci, i;
  105|  1.28k|  jpeg_component_info *compptr;
  106|  1.28k|  int method = 0;
  107|  1.28k|  _inverse_DCT_method_ptr method_ptr = NULL;
  ------------------
  |  |  262|  1.28k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  108|  1.28k|  JQUANT_TBL *qtbl;
  109|       |
  110|  2.57k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (110:44): [True: 1.28k, False: 1.28k]
  ------------------
  111|  1.28k|       ci++, compptr++) {
  112|       |    /* Select the proper IDCT routine for this component's scaling */
  113|  1.28k|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|  1.28k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  114|      0|#ifdef IDCT_SCALING_SUPPORTED
  115|      0|    case 1:
  ------------------
  |  Branch (115:5): [True: 0, False: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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|  1.28k|    case DCTSIZE:
  ------------------
  |  |   66|  1.28k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (154:5): [True: 1.28k, False: 0]
  ------------------
  155|  1.28k|      switch (cinfo->dct_method) {
  156|      0|#ifdef DCT_ISLOW_SUPPORTED
  157|  1.28k|      case JDCT_ISLOW:
  ------------------
  |  Branch (157:7): [True: 1.28k, False: 0]
  ------------------
  158|  1.28k|#ifdef WITH_SIMD
  159|  1.28k|        if (jsimd_set_idct_islow(cinfo))
  ------------------
  |  Branch (159:13): [True: 0, False: 1.28k]
  ------------------
  160|      0|          method_ptr = jsimd_idct_islow;
  161|  1.28k|        else
  162|  1.28k|#endif
  163|  1.28k|          method_ptr = _jpeg_idct_islow;
  ------------------
  |  |  303|  1.28k|#define _jpeg_idct_islow  jpeg_idct_islow
  ------------------
  164|  1.28k|        method = JDCT_ISLOW;
  165|  1.28k|        break;
  166|      0|#endif
  167|      0|#ifdef DCT_IFAST_SUPPORTED
  168|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (168:7): [True: 0, False: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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.28k|      }
  193|  1.28k|      break;
  194|  1.28k|#ifdef IDCT_SCALING_SUPPORTED
  195|  1.28k|    case 9:
  ------------------
  |  Branch (195:5): [True: 0, False: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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: 1.28k]
  ------------------
  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.28k|    }
  232|  1.28k|    idct->pub._inverse_DCT[ci] = method_ptr;
  ------------------
  |  |  263|  1.28k|#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|  1.28k|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (240:9): [True: 0, False: 1.28k]
  |  Branch (240:39): [True: 0, False: 1.28k]
  ------------------
  241|      0|      continue;
  242|  1.28k|    qtbl = compptr->quant_table;
  243|  1.28k|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (243:9): [True: 0, False: 1.28k]
  ------------------
  244|      0|      continue;
  245|  1.28k|    idct->cur_method[ci] = method;
  246|  1.28k|    switch (method) {
  247|      0|#ifdef PROVIDE_ISLOW_TABLES
  248|  1.28k|    case JDCT_ISLOW:
  ------------------
  |  Branch (248:5): [True: 1.28k, False: 0]
  ------------------
  249|  1.28k|      {
  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.28k|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  254|  83.5k|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|  83.5k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (254:21): [True: 82.2k, False: 1.28k]
  ------------------
  255|  82.2k|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  256|  82.2k|        }
  257|  1.28k|      }
  258|  1.28k|      break;
  259|      0|#endif
  260|      0|#ifdef DCT_IFAST_SUPPORTED
  261|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (261:5): [True: 0, False: 1.28k]
  ------------------
  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.28k]
  ------------------
  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.28k]
  ------------------
  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.28k|    }
  325|  1.28k|  }
  326|  1.28k|}
j12init_inverse_dct:
  335|     62|{
  336|     62|  my_idct_ptr idct;
  337|     62|  int ci;
  338|     62|  jpeg_component_info *compptr;
  339|       |
  340|     62|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     62|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (340:7): [True: 0, False: 62]
  ------------------
  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|     62|  idct = (my_idct_ptr)
  344|     62|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     62|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  345|     62|                                sizeof(my_idct_controller));
  346|     62|  cinfo->idct = (struct jpeg_inverse_dct *)idct;
  347|     62|  idct->pub.start_pass = start_pass;
  348|       |
  349|    148|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (349:44): [True: 86, False: 62]
  ------------------
  350|     86|       ci++, compptr++) {
  351|       |    /* Allocate and pre-zero a multiplier table for each component */
  352|     86|    compptr->dct_table =
  353|     86|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     86|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  354|     86|                                  sizeof(multiplier_table));
  355|     86|    memset(compptr->dct_table, 0, sizeof(multiplier_table));
  356|       |    /* Mark multiplier table not yet set up for any method */
  357|     86|    idct->cur_method[ci] = -1;
  358|     86|  }
  359|     62|}
jddctmgr-12.c:start_pass:
  102|     15|{
  103|     15|  my_idct_ptr idct = (my_idct_ptr)cinfo->idct;
  104|     15|  int ci, i;
  105|     15|  jpeg_component_info *compptr;
  106|     15|  int method = 0;
  107|     15|  _inverse_DCT_method_ptr method_ptr = NULL;
  ------------------
  |  |  146|     15|#define _inverse_DCT_method_ptr  inverse_DCT_12_method_ptr
  ------------------
  108|     15|  JQUANT_TBL *qtbl;
  109|       |
  110|     30|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (110:44): [True: 15, False: 15]
  ------------------
  111|     15|       ci++, compptr++) {
  112|       |    /* Select the proper IDCT routine for this component's scaling */
  113|     15|    switch (compptr->_DCT_scaled_size) {
  ------------------
  |  |   24|     15|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  114|      0|#ifdef IDCT_SCALING_SUPPORTED
  115|      0|    case 1:
  ------------------
  |  Branch (115:5): [True: 0, False: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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|     15|    case DCTSIZE:
  ------------------
  |  |   66|     15|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (154:5): [True: 15, False: 0]
  ------------------
  155|     15|      switch (cinfo->dct_method) {
  156|      0|#ifdef DCT_ISLOW_SUPPORTED
  157|     15|      case JDCT_ISLOW:
  ------------------
  |  Branch (157:7): [True: 15, False: 0]
  ------------------
  158|       |#ifdef WITH_SIMD
  159|       |        if (jsimd_set_idct_islow(cinfo))
  160|       |          method_ptr = jsimd_idct_islow;
  161|       |        else
  162|       |#endif
  163|     15|          method_ptr = _jpeg_idct_islow;
  ------------------
  |  |  187|     15|#define _jpeg_idct_islow  jpeg12_idct_islow
  ------------------
  164|     15|        method = JDCT_ISLOW;
  165|     15|        break;
  166|      0|#endif
  167|      0|#ifdef DCT_IFAST_SUPPORTED
  168|      0|      case JDCT_IFAST:
  ------------------
  |  Branch (168:7): [True: 0, False: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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|     15|      }
  193|     15|      break;
  194|     15|#ifdef IDCT_SCALING_SUPPORTED
  195|     15|    case 9:
  ------------------
  |  Branch (195:5): [True: 0, False: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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|     15|    }
  232|     15|    idct->pub._inverse_DCT[ci] = method_ptr;
  ------------------
  |  |  147|     15|#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|     15|    if (!compptr->component_needed || idct->cur_method[ci] == method)
  ------------------
  |  Branch (240:9): [True: 0, False: 15]
  |  Branch (240:39): [True: 0, False: 15]
  ------------------
  241|      0|      continue;
  242|     15|    qtbl = compptr->quant_table;
  243|     15|    if (qtbl == NULL)           /* happens if no data yet for component */
  ------------------
  |  Branch (243:9): [True: 0, False: 15]
  ------------------
  244|      0|      continue;
  245|     15|    idct->cur_method[ci] = method;
  246|     15|    switch (method) {
  247|      0|#ifdef PROVIDE_ISLOW_TABLES
  248|     15|    case JDCT_ISLOW:
  ------------------
  |  Branch (248:5): [True: 15, False: 0]
  ------------------
  249|     15|      {
  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|     15|        ISLOW_MULT_TYPE *ismtbl = (ISLOW_MULT_TYPE *)compptr->dct_table;
  254|    975|        for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|    975|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (254:21): [True: 960, False: 15]
  ------------------
  255|    960|          ismtbl[i] = (ISLOW_MULT_TYPE)qtbl->quantval[i];
  256|    960|        }
  257|     15|      }
  258|     15|      break;
  259|      0|#endif
  260|      0|#ifdef DCT_IFAST_SUPPORTED
  261|      0|    case JDCT_IFAST:
  ------------------
  |  Branch (261:5): [True: 0, False: 15]
  ------------------
  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: 15]
  ------------------
  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: 15]
  ------------------
  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|     15|    }
  325|     15|  }
  326|     15|}

jinit_d_diff_controller:
  348|    330|{
  349|    330|  my_diff_ptr diff;
  350|    330|  int ci;
  351|    330|  jpeg_component_info *compptr;
  352|       |
  353|    330|#if BITS_IN_JSAMPLE == 8
  354|    330|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    660|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 330]
  |  Branch (354:50): [True: 0, False: 330]
  ------------------
  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|    330|  diff = (my_diff_ptr)
  362|    330|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    330|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    330|                                sizeof(my_diff_controller));
  364|    330|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    330|  diff->pub.start_input_pass = start_input_pass;
  366|    330|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|    670|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 340, False: 330]
  ------------------
  370|    340|       ci++, compptr++) {
  371|    340|    diff->diff_buf[ci] =
  372|    340|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    340|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    340|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    340|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|    340|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|    340|                                         (long)compptr->h_samp_factor),
  375|    340|                   (JDIMENSION)compptr->v_samp_factor);
  376|    340|    diff->undiff_buf[ci] =
  377|    340|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|    340|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|    340|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|    340|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|    340|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|    340|                                         (long)compptr->h_samp_factor),
  380|    340|                   (JDIMENSION)compptr->v_samp_factor);
  381|    340|  }
  382|       |
  383|    330|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 5, False: 325]
  ------------------
  384|      5|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      5|    int access_rows;
  387|       |
  388|     20|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 15, False: 5]
  ------------------
  389|     15|         ci++, compptr++) {
  390|     15|      access_rows = compptr->v_samp_factor;
  391|     15|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|     15|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|     15|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|     15|#define FALSE   0               /* values of boolean */
  ------------------
  393|     15|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|     15|                               (long)compptr->h_samp_factor),
  395|     15|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|     15|                               (long)compptr->v_samp_factor),
  397|     15|         (JDIMENSION)access_rows);
  398|     15|    }
  399|      5|    diff->pub.consume_data = consume_data;
  400|      5|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  258|      5|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    325|  } else {
  405|    325|    diff->pub.consume_data = dummy_consume_data;
  406|    325|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    325|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|    325|  }
  409|    330|}
jddiffct-8.c:start_input_pass:
   94|    324|{
   95|    324|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   96|       |
   97|       |  /* Because it is hitching a ride on the jpeg_inverse_dct struct,
   98|       |   * start_pass_lossless() will be called at the start of the output pass.
   99|       |   * This ensures that it will be called at the start of the input pass as
  100|       |   * well.
  101|       |   */
  102|    324|  (*cinfo->idct->start_pass) (cinfo);
  103|       |
  104|       |  /* Check that the restart interval is an integer multiple of the number
  105|       |   * of MCUs in an MCU row.
  106|       |   */
  107|    324|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 0, False: 324]
  ------------------
  108|      0|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  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)))
  ------------------
  109|    324|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|    324|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|    324|  cinfo->input_iMCU_row = 0;
  115|    324|  start_iMCU_row(cinfo);
  116|    324|}
jddiffct-8.c:start_iMCU_row:
   67|  24.9k|{
   68|  24.9k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   69|       |
   70|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   71|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   72|       |   * But at the bottom of the image, process only what's left.
   73|       |   */
   74|  24.9k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 24.9k]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|  24.9k|  } else {
   77|  24.9k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 24.9k, False: 7]
  ------------------
   78|  24.9k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|      7|    else
   80|      7|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  24.9k|  }
   82|       |
   83|  24.9k|  diff->MCU_ctr = 0;
   84|  24.9k|  diff->MCU_vert_offset = 0;
   85|  24.9k|}
jddiffct-8.c:start_output_pass:
  147|    319|{
  148|    319|  cinfo->output_iMCU_row = 0;
  149|    319|}
jddiffct-8.c:decompress_data:
  164|  24.9k|{
  165|  24.9k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  24.9k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  24.9k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  24.9k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  24.9k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  24.9k|  int ci, compi, row, prev_row;
  171|  24.9k|  unsigned int yoffset;
  172|  24.9k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  55.7k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 30.8k, False: 24.9k]
  ------------------
  176|  30.8k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  30.8k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 0, False: 30.8k]
  ------------------
  180|      0|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 0, False: 0]
  ------------------
  181|      0|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 0]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|      0|    }
  184|       |
  185|  30.8k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  30.8k|    MCU_count =
  188|  30.8k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  30.8k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  30.8k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  30.8k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 30.8k]
  ------------------
  192|       |      /* Suspension forced; update state counters and exit */
  193|      0|      diff->MCU_vert_offset = yoffset;
  194|      0|      diff->MCU_ctr += MCU_count;
  195|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  196|      0|    }
  197|       |
  198|       |    /* Account for restart interval (no-op if not using restarts) */
  199|  30.8k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 0, False: 30.8k]
  ------------------
  200|      0|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  30.8k|    diff->MCU_ctr = 0;
  204|  30.8k|  }
  205|       |
  206|       |  /*
  207|       |   * Undifference and scale each scanline of the disassembled MCU row
  208|       |   * separately.  We do not process dummy samples at the end of a scanline
  209|       |   * or dummy rows at the end of the image.
  210|       |   */
  211|  49.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 24.6k, False: 24.9k]
  ------------------
  212|  24.6k|    compptr = cinfo->cur_comp_info[ci];
  213|  24.6k|    compi = compptr->component_index;
  214|  24.6k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  55.0k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 30.4k, False: 24.6k]
  |  Branch (215:17): [True: 15, False: 55.0k]
  ------------------
  216|  55.0k|                compptr->last_row_height : compptr->v_samp_factor);
  217|  30.4k|         prev_row = row, row++) {
  218|  30.4k|      (*losslessd->predict_undifference[compi])
  219|  30.4k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  30.4k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  30.4k|          compptr->width_in_blocks);
  222|  30.4k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  30.4k|                                  output_buf[compi][row],
  224|  30.4k|                                  compptr->width_in_blocks);
  225|  30.4k|    }
  226|  24.6k|  }
  227|       |
  228|       |  /* Completed the iMCU row, advance counters for next one.
  229|       |   *
  230|       |   * NB: output_data will increment output_iMCU_row.
  231|       |   * This counter is not needed for the single-pass case
  232|       |   * or the input side of the multi-pass case.
  233|       |   */
  234|  24.9k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 24.6k, False: 319]
  ------------------
  235|  24.6k|    start_iMCU_row(cinfo);
  236|  24.6k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  24.6k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  24.6k|  }
  238|       |  /* Completed the scan */
  239|    319|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|    319|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    319|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  24.9k|}
j12init_d_diff_controller:
  348|     14|{
  349|     14|  my_diff_ptr diff;
  350|     14|  int ci;
  351|     14|  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|     14|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     28|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 14]
  ------------------
  357|     14|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 14]
  ------------------
  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|     14|  diff = (my_diff_ptr)
  362|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|     14|                                sizeof(my_diff_controller));
  364|     14|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|     14|  diff->pub.start_input_pass = start_input_pass;
  366|     14|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|     38|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 24, False: 14]
  ------------------
  370|     24|       ci++, compptr++) {
  371|     24|    diff->diff_buf[ci] =
  372|     24|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     24|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     24|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     24|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|     24|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|     24|                                         (long)compptr->h_samp_factor),
  375|     24|                   (JDIMENSION)compptr->v_samp_factor);
  376|     24|    diff->undiff_buf[ci] =
  377|     24|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     24|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     24|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     24|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|     24|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|     24|                                         (long)compptr->h_samp_factor),
  380|     24|                   (JDIMENSION)compptr->v_samp_factor);
  381|     24|  }
  382|       |
  383|     14|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 5, False: 9]
  ------------------
  384|      5|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      5|    int access_rows;
  387|       |
  388|     20|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 15, False: 5]
  ------------------
  389|     15|         ci++, compptr++) {
  390|     15|      access_rows = compptr->v_samp_factor;
  391|     15|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|     15|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|     15|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|     15|#define FALSE   0               /* values of boolean */
  ------------------
  393|     15|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|     15|                               (long)compptr->h_samp_factor),
  395|     15|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|     15|                               (long)compptr->v_samp_factor),
  397|     15|         (JDIMENSION)access_rows);
  398|     15|    }
  399|      5|    diff->pub.consume_data = consume_data;
  400|      5|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  142|      5|#define _decompress_data  decompress_data_12
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      9|  } else {
  405|      9|    diff->pub.consume_data = dummy_consume_data;
  406|      9|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|      9|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      9|  }
  409|     14|}
jddiffct-12.c:start_input_pass:
   94|      8|{
   95|      8|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   96|       |
   97|       |  /* Because it is hitching a ride on the jpeg_inverse_dct struct,
   98|       |   * start_pass_lossless() will be called at the start of the output pass.
   99|       |   * This ensures that it will be called at the start of the input pass as
  100|       |   * well.
  101|       |   */
  102|      8|  (*cinfo->idct->start_pass) (cinfo);
  103|       |
  104|       |  /* Check that the restart interval is an integer multiple of the number
  105|       |   * of MCUs in an MCU row.
  106|       |   */
  107|      8|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 0, False: 8]
  ------------------
  108|      0|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  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)))
  ------------------
  109|      8|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|      8|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|      8|  cinfo->input_iMCU_row = 0;
  115|      8|  start_iMCU_row(cinfo);
  116|      8|}
jddiffct-12.c:start_iMCU_row:
   67|      3|{
   68|      3|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   69|       |
   70|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   71|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   72|       |   * But at the bottom of the image, process only what's left.
   73|       |   */
   74|      3|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 3]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|      3|  } else {
   77|      3|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 2, False: 1]
  ------------------
   78|      2|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|      1|    else
   80|      1|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|      3|  }
   82|       |
   83|      3|  diff->MCU_ctr = 0;
   84|      3|  diff->MCU_vert_offset = 0;
   85|      3|}
jddiffct-12.c:start_output_pass:
  147|      3|{
  148|      3|  cinfo->output_iMCU_row = 0;
  149|      3|}
j16init_d_diff_controller:
  348|     14|{
  349|     14|  my_diff_ptr diff;
  350|     14|  int ci;
  351|     14|  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|     14|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     28|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (356:7): [True: 0, False: 14]
  ------------------
  357|     14|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (357:7): [True: 0, False: 14]
  ------------------
  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|     14|  diff = (my_diff_ptr)
  362|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|     14|                                sizeof(my_diff_controller));
  364|     14|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|     14|  diff->pub.start_input_pass = start_input_pass;
  366|     14|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|     40|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 26, False: 14]
  ------------------
  370|     26|       ci++, compptr++) {
  371|     26|    diff->diff_buf[ci] =
  372|     26|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     26|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     26|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     26|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|     26|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|     26|                                         (long)compptr->h_samp_factor),
  375|     26|                   (JDIMENSION)compptr->v_samp_factor);
  376|     26|    diff->undiff_buf[ci] =
  377|     26|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|     26|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|     26|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|     26|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|     26|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|     26|                                         (long)compptr->h_samp_factor),
  380|     26|                   (JDIMENSION)compptr->v_samp_factor);
  381|     26|  }
  382|       |
  383|     14|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 6, False: 8]
  ------------------
  384|      6|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|      6|    int access_rows;
  387|       |
  388|     24|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 18, False: 6]
  ------------------
  389|     18|         ci++, compptr++) {
  390|     18|      access_rows = compptr->v_samp_factor;
  391|     18|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|     18|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|     18|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|     18|#define FALSE   0               /* values of boolean */
  ------------------
  393|     18|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|     18|                               (long)compptr->h_samp_factor),
  395|     18|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|     18|                               (long)compptr->v_samp_factor),
  397|     18|         (JDIMENSION)access_rows);
  398|     18|    }
  399|      6|    diff->pub.consume_data = consume_data;
  400|      6|    diff->pub._decompress_data = output_data;
  ------------------
  |  |   53|      6|#define _decompress_data  decompress_data_16
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|      8|  } else {
  405|      8|    diff->pub.consume_data = dummy_consume_data;
  406|      8|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |   53|      8|#define _decompress_data  decompress_data_16
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|      8|  }
  409|     14|}
jddiffct-16.c:start_input_pass:
   94|      8|{
   95|      8|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   96|       |
   97|       |  /* Because it is hitching a ride on the jpeg_inverse_dct struct,
   98|       |   * start_pass_lossless() will be called at the start of the output pass.
   99|       |   * This ensures that it will be called at the start of the input pass as
  100|       |   * well.
  101|       |   */
  102|      8|  (*cinfo->idct->start_pass) (cinfo);
  103|       |
  104|       |  /* Check that the restart interval is an integer multiple of the number
  105|       |   * of MCUs in an MCU row.
  106|       |   */
  107|      8|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 0, False: 8]
  ------------------
  108|      0|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  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)))
  ------------------
  109|      8|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|      8|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|      8|  cinfo->input_iMCU_row = 0;
  115|      8|  start_iMCU_row(cinfo);
  116|      8|}
jddiffct-16.c:start_iMCU_row:
   67|      3|{
   68|      3|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
   69|       |
   70|       |  /* In an interleaved scan, an MCU row is the same as an iMCU row.
   71|       |   * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
   72|       |   * But at the bottom of the image, process only what's left.
   73|       |   */
   74|      3|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 0, False: 3]
  ------------------
   75|      0|    diff->MCU_rows_per_iMCU_row = 1;
   76|      3|  } else {
   77|      3|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 2, False: 1]
  ------------------
   78|      2|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|      1|    else
   80|      1|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|      3|  }
   82|       |
   83|      3|  diff->MCU_ctr = 0;
   84|      3|  diff->MCU_vert_offset = 0;
   85|      3|}
jddiffct-16.c:start_output_pass:
  147|      3|{
  148|      3|  cinfo->output_iMCU_row = 0;
  149|      3|}

jpeg_make_d_derived_tbl:
  145|  1.50k|{
  146|  1.50k|  JHUFF_TBL *htbl;
  147|  1.50k|  d_derived_tbl *dtbl;
  148|  1.50k|  int p, i, l, si, numsymbols;
  149|  1.50k|  int lookbits, ctr;
  150|  1.50k|  char huffsize[257];
  151|  1.50k|  unsigned int huffcode[257];
  152|  1.50k|  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|  1.50k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  1.50k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 1.50k]
  |  Branch (159:20): [True: 4, False: 1.50k]
  ------------------
  160|      4|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      4|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  161|  1.50k|  htbl =
  162|  1.50k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 967, False: 537]
  ------------------
  163|  1.50k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 1, False: 1.50k]
  ------------------
  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|  1.50k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 1.49k, False: 5]
  ------------------
  168|  1.49k|    *pdtbl = (d_derived_tbl *)
  169|  1.49k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.49k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  1.49k|                                  sizeof(d_derived_tbl));
  171|  1.50k|  dtbl = *pdtbl;
  172|  1.50k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  1.50k|  p = 0;
  177|  25.4k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 23.9k, False: 1.50k]
  ------------------
  178|  23.9k|    i = (int)htbl->bits[l];
  179|  23.9k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 23.9k]
  |  Branch (179:18): [True: 0, False: 23.9k]
  ------------------
  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|   103k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 79.4k, False: 23.9k]
  ------------------
  182|  79.4k|      huffsize[p++] = (char)l;
  183|  23.9k|  }
  184|  1.50k|  huffsize[p] = 0;
  185|  1.50k|  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|  1.50k|  code = 0;
  191|  1.50k|  si = huffsize[0];
  192|  1.50k|  p = 0;
  193|  17.1k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 15.6k, False: 1.50k]
  ------------------
  194|  94.6k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 78.9k, False: 15.6k]
  ------------------
  195|  78.9k|      huffcode[p++] = code;
  196|  78.9k|      code++;
  197|  78.9k|    }
  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|  15.6k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 9, False: 15.6k]
  ------------------
  202|      9|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|  15.6k|    code <<= 1;
  204|  15.6k|    si++;
  205|  15.6k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  1.50k|  p = 0;
  210|  25.3k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 23.8k, False: 1.50k]
  ------------------
  211|  23.8k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 15.3k, False: 8.52k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|  15.3k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|  15.3k|      p += htbl->bits[l];
  217|  15.3k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|  15.3k|    } else {
  219|  8.52k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|  8.52k|    }
  221|  23.8k|  }
  222|  1.50k|  dtbl->valoffset[17] = 0;
  223|  1.50k|  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|   382k|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|   382k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 381k, False: 1.50k]
  ------------------
  233|   381k|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   381k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|   381k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  1.50k|  p = 0;
  236|  13.4k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|  13.4k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 11.9k, False: 1.50k]
  ------------------
  237|  31.7k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 19.7k, False: 11.9k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|  19.7k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|  19.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|   386k|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|  19.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 366k, False: 19.7k]
  ------------------
  242|   366k|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|   366k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|   366k|        lookbits++;
  244|   366k|      }
  245|  19.7k|    }
  246|  11.9k|  }
  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|  1.50k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 960, False: 544]
  ------------------
  255|  12.4k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 11.4k, False: 960]
  ------------------
  256|  11.4k|      int sym = htbl->huffval[i];
  257|  11.4k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 11.4k]
  |  Branch (257:22): [True: 11, False: 11.4k]
  |  Branch (257:29): [True: 4.08k, False: 7.35k]
  ------------------
  258|     11|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     11|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  11.4k|    }
  260|    960|  }
  261|  1.50k|}
jpeg_fill_bit_buffer:
  291|   166k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   166k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   166k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   166k|  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|   166k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 165k, False: 1.17k]
  ------------------
  302|  1.32M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  1.32M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.32M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 1.15M, False: 164k]
  ------------------
  303|  1.15M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  1.15M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 251, False: 1.15M]
  ------------------
  307|    251|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 251]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|    251|        next_input_byte = cinfo->src->next_input_byte;
  310|    251|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|    251|      }
  312|  1.15M|      bytes_in_buffer--;
  313|  1.15M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  1.15M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 3.60k, False: 1.15M]
  ------------------
  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|  26.3k|        do {
  323|  26.3k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 1, False: 26.3k]
  ------------------
  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|  26.3k|          bytes_in_buffer--;
  330|  26.3k|          c = *next_input_byte++;
  331|  26.3k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 22.7k, False: 3.60k]
  ------------------
  332|       |
  333|  3.60k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 3.08k, False: 522]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  3.08k|          c = 0xFF;
  336|  3.08k|        } 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|    522|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|    522|          goto no_more_bytes;
  348|    522|        }
  349|  3.60k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  1.15M|      get_buffer = (get_buffer << 8) | c;
  353|  1.15M|      bits_left += 8;
  354|  1.15M|    } /* end while */
  355|   165k|  } else {
  356|  1.69k|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|  1.69k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 503, False: 1.19k]
  ------------------
  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|    503|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 503, False: 0]
  ------------------
  368|    503|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|    503|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    503|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|    503|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|    503|#define TRUE    1
  ------------------
  370|    503|      }
  371|       |      /* Fill the buffer with zero bits */
  372|    503|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|    503|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    503|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|    503|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|    503|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|    503|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|    503|    }
  375|  1.69k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   166k|  state->next_input_byte = next_input_byte;
  379|   166k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   166k|  state->get_buffer = get_buffer;
  381|   166k|  state->bits_left = bits_left;
  382|       |
  383|   166k|  return TRUE;
  ------------------
  |  |  210|   166k|#define TRUE    1
  ------------------
  384|   166k|}
jpeg_huff_decode:
  439|  6.81k|{
  440|  6.81k|  register int l = min_bits;
  441|  6.81k|  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|  6.81k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  6.81k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  6.81k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 247, False: 6.57k]
  |  |  ------------------
  |  |  162|    247|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 247]
  |  |  ------------------
  |  |  163|    247|      { action; } \
  |  |  164|    247|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    247|  } \
  |  |  166|  6.81k|}
  ------------------
  447|  6.81k|  code = GET_BITS(l);
  ------------------
  |  |  169|  6.81k|  (((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|  18.2k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 11.4k, False: 6.81k]
  ------------------
  453|  11.4k|    code <<= 1;
  454|  11.4k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|  11.4k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  11.4k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 389, False: 11.0k]
  |  |  ------------------
  |  |  162|    389|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 389]
  |  |  ------------------
  |  |  163|    389|      { action; } \
  |  |  164|    389|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    389|  } \
  |  |  166|  11.4k|}
  ------------------
  455|  11.4k|    code |= GET_BITS(1);
  ------------------
  |  |  169|  11.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|  11.4k|    l++;
  457|  11.4k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  6.81k|  state->get_buffer = get_buffer;
  461|  6.81k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  6.81k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 114, False: 6.70k]
  ------------------
  466|    114|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|    114|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    114|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|    114|    return 0;                   /* fake a zero as the safest result */
  468|    114|  }
  469|       |
  470|  6.70k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  6.81k|}
jinit_huff_decoder:
  815|    555|{
  816|    555|  huff_entropy_ptr entropy;
  817|    555|  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|    555|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|    555|  entropy = (huff_entropy_ptr)
  826|    555|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    555|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|    555|                                sizeof(huff_entropy_decoder));
  828|    555|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|    555|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|    555|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  2.77k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  2.77k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 2.22k, False: 555]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  2.22k|  }
  836|    555|}
jdhuff.c:start_pass_huff_decoder:
   80|    551|{
   81|    551|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|    551|  int ci, blkn, dctbl, actbl;
   83|    551|  d_derived_tbl **pdtbl;
   84|    551|  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|    551|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    550|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 1, False: 550]
  |  Branch (90:25): [True: 1, False: 549]
  ------------------
   91|    549|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 1, False: 548]
  |  Branch (91:25): [True: 1, False: 547]
  ------------------
   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|  1.09k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 547, False: 551]
  ------------------
   95|    547|    compptr = cinfo->cur_comp_info[ci];
   96|    547|    dctbl = compptr->dc_tbl_no;
   97|    547|    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|    547|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|    547|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|    547|#define TRUE    1
  ------------------
  102|    547|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|    547|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|    547|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|    547|    entropy->saved.last_dc_val[ci] = 0;
  106|    547|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  1.08k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 530, False: 551]
  ------------------
  110|    530|    ci = cinfo->MCU_membership[blkn];
  111|    530|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|    530|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|    530|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|    530|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 530, False: 0]
  ------------------
  117|    530|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|    530|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|    530|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|    530|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|    530|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|    530|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|    551|  entropy->bitstate.bits_left = 0;
  127|    551|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|    551|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    551|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|    551|  entropy->restarts_to_go = cinfo->restart_interval;
  132|    551|}
jdhuff.c:decode_mcu:
  771|   267k|{
  772|   267k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   267k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   267k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 0, False: 267k]
  ------------------
  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|   267k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   267k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   267k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 28.7k, False: 238k]
  ------------------
  784|   238k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 47, False: 238k]
  ------------------
  785|  28.7k|    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|   267k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 267k, False: 0]
  ------------------
  791|       |
  792|   267k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 238k, False: 28.7k]
  ------------------
  793|   238k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 2.90k, False: 235k]
  ------------------
  794|   238k|    } else {
  795|  31.6k|use_slow:
  796|  31.6k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 31.6k]
  ------------------
  797|  31.6k|    }
  798|       |
  799|   267k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   267k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 0, False: 267k]
  ------------------
  803|      0|    entropy->restarts_to_go--;
  804|       |
  805|   267k|  return TRUE;
  ------------------
  |  |  210|   267k|#define TRUE    1
  ------------------
  806|   267k|}
jdhuff.c:decode_mcu_fast:
  664|   238k|{
  665|   238k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|   238k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   238k|  register bit_buf_type get_buffer; \
  |  |  126|   238k|  register int bits_left; \
  |  |  127|   238k|  bitread_working_state br_state
  ------------------
  667|   238k|  JOCTET *buffer;
  668|   238k|  int blkn;
  669|   238k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|   238k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   238k|  br_state.cinfo = cinfop; \
  |  |  131|   238k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   238k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   238k|  get_buffer = permstate.get_buffer; \
  |  |  134|   238k|  bits_left = permstate.bits_left;
  ------------------
  674|   238k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|   238k|  state = entropy->saved;
  676|       |
  677|   476k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 238k, False: 238k]
  ------------------
  678|   238k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 238k, False: 0]
  ------------------
  679|   238k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   238k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   238k|    register int s, k, r, l;
  682|       |
  683|   238k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   238k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   238k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 30.4k, False: 207k]
  |  |  |  |  ------------------
  |  |  |  |  416|  30.4k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  30.4k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  30.4k|  register int c0, c1; \
  |  |  |  |  |  |  393|  30.4k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  30.4k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  30.4k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  30.4k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  30.4k|  bits_left += 8; \
  |  |  |  |  |  |  398|  30.4k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 669, False: 29.8k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    669|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    669|    buffer++; \
  |  |  |  |  |  |  401|    669|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 307, False: 362]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    307|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    307|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    307|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    307|      buffer -= 2; \
  |  |  |  |  |  |  406|    307|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    307|    } \
  |  |  |  |  |  |  408|    669|  } \
  |  |  |  |  |  |  409|  30.4k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  30.4k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  30.4k|  register int c0, c1; \
  |  |  |  |  |  |  393|  30.4k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  30.4k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  30.4k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  30.4k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  30.4k|  bits_left += 8; \
  |  |  |  |  |  |  398|  30.4k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 907, False: 29.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|    907|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|    907|    buffer++; \
  |  |  |  |  |  |  401|    907|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 543, False: 364]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    543|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    543|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    543|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    543|      buffer -= 2; \
  |  |  |  |  |  |  406|    543|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    543|    } \
  |  |  |  |  |  |  408|    907|  } \
  |  |  |  |  |  |  409|  30.4k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  30.4k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  30.4k|  register int c0, c1; \
  |  |  |  |  |  |  393|  30.4k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  30.4k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  30.4k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  30.4k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  30.4k|  bits_left += 8; \
  |  |  |  |  |  |  398|  30.4k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.26k, False: 29.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.26k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.26k|    buffer++; \
  |  |  |  |  |  |  401|  1.26k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 730, False: 530]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    730|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    730|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    730|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    730|      buffer -= 2; \
  |  |  |  |  |  |  406|    730|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    730|    } \
  |  |  |  |  |  |  408|  1.26k|  } \
  |  |  |  |  |  |  409|  30.4k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  30.4k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  30.4k|  register int c0, c1; \
  |  |  |  |  |  |  393|  30.4k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  30.4k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  30.4k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  30.4k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  30.4k|  bits_left += 8; \
  |  |  |  |  |  |  398|  30.4k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.25k, False: 29.2k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.25k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.25k|    buffer++; \
  |  |  |  |  |  |  401|  1.25k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 854, False: 403]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    854|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    854|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    854|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    854|      buffer -= 2; \
  |  |  |  |  |  |  406|    854|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    854|    } \
  |  |  |  |  |  |  408|  1.25k|  } \
  |  |  |  |  |  |  409|  30.4k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  30.4k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  30.4k|  register int c0, c1; \
  |  |  |  |  |  |  393|  30.4k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  30.4k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  30.4k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  30.4k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  30.4k|  bits_left += 8; \
  |  |  |  |  |  |  398|  30.4k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.40k, False: 29.0k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.40k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.40k|    buffer++; \
  |  |  |  |  |  |  401|  1.40k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 965, False: 442]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    965|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    965|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    965|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    965|      buffer -= 2; \
  |  |  |  |  |  |  406|    965|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    965|    } \
  |  |  |  |  |  |  408|  1.40k|  } \
  |  |  |  |  |  |  409|  30.4k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  30.4k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  30.4k|  register int c0, c1; \
  |  |  |  |  |  |  393|  30.4k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  30.4k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  30.4k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  30.4k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  30.4k|  bits_left += 8; \
  |  |  |  |  |  |  398|  30.4k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.52k, False: 28.9k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.52k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.52k|    buffer++; \
  |  |  |  |  |  |  401|  1.52k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.13k, False: 391]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.13k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.13k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.13k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.13k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.13k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.13k|    } \
  |  |  |  |  |  |  408|  1.52k|  } \
  |  |  |  |  |  |  409|  30.4k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  30.4k|  }
  |  |  ------------------
  |  |  225|   238k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   238k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   238k|  s = htbl->lookup[s]; \
  |  |  227|   238k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   238k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   238k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   238k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   238k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   238k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   238k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   238k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   476k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 3.98k, False: 234k]
  |  |  ------------------
  |  |  232|  3.98k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  3.98k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  3.98k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  19.3k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 15.3k, False: 3.98k]
  |  |  ------------------
  |  |  236|  15.3k|      s <<= 1; \
  |  |  237|  15.3k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  15.3k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  15.3k|      nb++; \
  |  |  239|  15.3k|    } \
  |  |  240|  3.98k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 1.83k, False: 2.15k]
  |  |  ------------------
  |  |  241|  3.98k|      s = 0; \
  |  |  242|  3.98k|    else \
  |  |  243|  3.98k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  3.98k|  }
  ------------------
  684|   238k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 188k, False: 49.9k]
  ------------------
  685|   188k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   188k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 13.1k, False: 175k]
  |  |  ------------------
  |  |  416|  13.1k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.1k|#define GET_BYTE { \
  |  |  |  |  392|  13.1k|  register int c0, c1; \
  |  |  |  |  393|  13.1k|  c0 = *buffer++; \
  |  |  |  |  394|  13.1k|  c1 = *buffer; \
  |  |  |  |  395|  13.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.1k|  bits_left += 8; \
  |  |  |  |  398|  13.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 285, False: 12.9k]
  |  |  |  |  ------------------
  |  |  |  |  399|    285|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    285|    buffer++; \
  |  |  |  |  401|    285|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 122, False: 163]
  |  |  |  |  ------------------
  |  |  |  |  402|    122|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    122|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    122|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    122|      buffer -= 2; \
  |  |  |  |  406|    122|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    122|    } \
  |  |  |  |  408|    285|  } \
  |  |  |  |  409|  13.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.1k|#define GET_BYTE { \
  |  |  |  |  392|  13.1k|  register int c0, c1; \
  |  |  |  |  393|  13.1k|  c0 = *buffer++; \
  |  |  |  |  394|  13.1k|  c1 = *buffer; \
  |  |  |  |  395|  13.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.1k|  bits_left += 8; \
  |  |  |  |  398|  13.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 397, False: 12.8k]
  |  |  |  |  ------------------
  |  |  |  |  399|    397|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    397|    buffer++; \
  |  |  |  |  401|    397|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 189, False: 208]
  |  |  |  |  ------------------
  |  |  |  |  402|    189|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    189|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    189|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    189|      buffer -= 2; \
  |  |  |  |  406|    189|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    189|    } \
  |  |  |  |  408|    397|  } \
  |  |  |  |  409|  13.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.1k|#define GET_BYTE { \
  |  |  |  |  392|  13.1k|  register int c0, c1; \
  |  |  |  |  393|  13.1k|  c0 = *buffer++; \
  |  |  |  |  394|  13.1k|  c1 = *buffer; \
  |  |  |  |  395|  13.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.1k|  bits_left += 8; \
  |  |  |  |  398|  13.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 415, False: 12.7k]
  |  |  |  |  ------------------
  |  |  |  |  399|    415|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    415|    buffer++; \
  |  |  |  |  401|    415|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 201, False: 214]
  |  |  |  |  ------------------
  |  |  |  |  402|    201|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    201|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    201|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    201|      buffer -= 2; \
  |  |  |  |  406|    201|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    201|    } \
  |  |  |  |  408|    415|  } \
  |  |  |  |  409|  13.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.1k|#define GET_BYTE { \
  |  |  |  |  392|  13.1k|  register int c0, c1; \
  |  |  |  |  393|  13.1k|  c0 = *buffer++; \
  |  |  |  |  394|  13.1k|  c1 = *buffer; \
  |  |  |  |  395|  13.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.1k|  bits_left += 8; \
  |  |  |  |  398|  13.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 385, False: 12.8k]
  |  |  |  |  ------------------
  |  |  |  |  399|    385|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    385|    buffer++; \
  |  |  |  |  401|    385|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 226, False: 159]
  |  |  |  |  ------------------
  |  |  |  |  402|    226|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    226|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    226|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    226|      buffer -= 2; \
  |  |  |  |  406|    226|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    226|    } \
  |  |  |  |  408|    385|  } \
  |  |  |  |  409|  13.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.1k|#define GET_BYTE { \
  |  |  |  |  392|  13.1k|  register int c0, c1; \
  |  |  |  |  393|  13.1k|  c0 = *buffer++; \
  |  |  |  |  394|  13.1k|  c1 = *buffer; \
  |  |  |  |  395|  13.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.1k|  bits_left += 8; \
  |  |  |  |  398|  13.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 503, False: 12.6k]
  |  |  |  |  ------------------
  |  |  |  |  399|    503|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    503|    buffer++; \
  |  |  |  |  401|    503|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 354, False: 149]
  |  |  |  |  ------------------
  |  |  |  |  402|    354|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    354|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    354|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    354|      buffer -= 2; \
  |  |  |  |  406|    354|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    354|    } \
  |  |  |  |  408|    503|  } \
  |  |  |  |  409|  13.1k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  13.1k|#define GET_BYTE { \
  |  |  |  |  392|  13.1k|  register int c0, c1; \
  |  |  |  |  393|  13.1k|  c0 = *buffer++; \
  |  |  |  |  394|  13.1k|  c1 = *buffer; \
  |  |  |  |  395|  13.1k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  13.1k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  13.1k|  bits_left += 8; \
  |  |  |  |  398|  13.1k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 548, False: 12.6k]
  |  |  |  |  ------------------
  |  |  |  |  399|    548|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    548|    buffer++; \
  |  |  |  |  401|    548|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 380, False: 168]
  |  |  |  |  ------------------
  |  |  |  |  402|    380|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    380|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    380|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    380|      buffer -= 2; \
  |  |  |  |  406|    380|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    380|    } \
  |  |  |  |  408|    548|  } \
  |  |  |  |  409|  13.1k|}
  |  |  ------------------
  |  |  417|  13.1k|  }
  ------------------
  686|   188k|      r = GET_BITS(s);
  ------------------
  |  |  169|   188k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|   188k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   188k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   188k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|   188k|    }
  689|       |
  690|   238k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 238k, False: 0]
  ------------------
  691|   238k|      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|   238k|      s += state.last_dc_val[ci];
  696|   238k|      state.last_dc_val[ci] = s;
  697|   238k|      if (block)
  ------------------
  |  Branch (697:11): [True: 238k, False: 0]
  ------------------
  698|   238k|        (*block)[0] = (JCOEF)s;
  699|   238k|    }
  700|       |
  701|   238k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 238k, False: 0]
  |  Branch (701:37): [True: 238k, False: 0]
  ------------------
  702|       |
  703|  2.80M|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|  2.80M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 2.76M, False: 43.4k]
  ------------------
  704|  2.76M|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|  2.76M|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|  2.76M|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 134k, False: 2.62M]
  |  |  |  |  ------------------
  |  |  |  |  416|   134k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   134k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   134k|  register int c0, c1; \
  |  |  |  |  |  |  393|   134k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   134k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   134k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   134k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   134k|  bits_left += 8; \
  |  |  |  |  |  |  398|   134k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.38k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.38k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.38k|    buffer++; \
  |  |  |  |  |  |  401|  2.38k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.40k, False: 982]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.40k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.40k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.40k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.40k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.40k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.40k|    } \
  |  |  |  |  |  |  408|  2.38k|  } \
  |  |  |  |  |  |  409|   134k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   134k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   134k|  register int c0, c1; \
  |  |  |  |  |  |  393|   134k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   134k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   134k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   134k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   134k|  bits_left += 8; \
  |  |  |  |  |  |  398|   134k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.52k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.52k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.52k|    buffer++; \
  |  |  |  |  |  |  401|  2.52k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.55k, False: 969]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.55k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.55k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.55k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.55k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.55k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.55k|    } \
  |  |  |  |  |  |  408|  2.52k|  } \
  |  |  |  |  |  |  409|   134k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   134k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   134k|  register int c0, c1; \
  |  |  |  |  |  |  393|   134k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   134k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   134k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   134k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   134k|  bits_left += 8; \
  |  |  |  |  |  |  398|   134k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.47k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.47k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.47k|    buffer++; \
  |  |  |  |  |  |  401|  2.47k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.64k, False: 832]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.64k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.64k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.64k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.64k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.64k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.64k|    } \
  |  |  |  |  |  |  408|  2.47k|  } \
  |  |  |  |  |  |  409|   134k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   134k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   134k|  register int c0, c1; \
  |  |  |  |  |  |  393|   134k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   134k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   134k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   134k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   134k|  bits_left += 8; \
  |  |  |  |  |  |  398|   134k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.53k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.53k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.53k|    buffer++; \
  |  |  |  |  |  |  401|  2.53k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.74k, False: 794]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.74k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.74k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.74k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.74k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.74k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.74k|    } \
  |  |  |  |  |  |  408|  2.53k|  } \
  |  |  |  |  |  |  409|   134k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   134k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   134k|  register int c0, c1; \
  |  |  |  |  |  |  393|   134k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   134k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   134k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   134k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   134k|  bits_left += 8; \
  |  |  |  |  |  |  398|   134k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.88k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.88k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.88k|    buffer++; \
  |  |  |  |  |  |  401|  2.88k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.80k, False: 1.07k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.80k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.80k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.80k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.80k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.80k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.80k|    } \
  |  |  |  |  |  |  408|  2.88k|  } \
  |  |  |  |  |  |  409|   134k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|   134k|#define GET_BYTE { \
  |  |  |  |  |  |  392|   134k|  register int c0, c1; \
  |  |  |  |  |  |  393|   134k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|   134k|  c1 = *buffer; \
  |  |  |  |  |  |  395|   134k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|   134k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|   134k|  bits_left += 8; \
  |  |  |  |  |  |  398|   134k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.61k, False: 132k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.61k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.61k|    buffer++; \
  |  |  |  |  |  |  401|  2.61k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.85k, False: 753]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.85k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.85k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.85k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.85k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.85k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.85k|    } \
  |  |  |  |  |  |  408|  2.61k|  } \
  |  |  |  |  |  |  409|   134k|}
  |  |  |  |  ------------------
  |  |  |  |  417|   134k|  }
  |  |  ------------------
  |  |  225|  2.76M|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  2.76M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|  2.76M|  s = htbl->lookup[s]; \
  |  |  227|  2.76M|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|  2.76M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|  2.76M|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|  2.76M|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  2.76M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|  2.76M|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  2.76M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|  2.76M|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  5.52M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 98.4k, False: 2.66M]
  |  |  ------------------
  |  |  232|  98.4k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  98.4k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  98.4k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   482k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 384k, False: 98.4k]
  |  |  ------------------
  |  |  236|   384k|      s <<= 1; \
  |  |  237|   384k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   384k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   384k|      nb++; \
  |  |  239|   384k|    } \
  |  |  240|  98.4k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 36.6k, False: 61.8k]
  |  |  ------------------
  |  |  241|  98.4k|      s = 0; \
  |  |  242|  98.4k|    else \
  |  |  243|  98.4k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  98.4k|  }
  ------------------
  705|  2.76M|        r = s >> 4;
  706|  2.76M|        s &= 15;
  707|       |
  708|  2.76M|        if (s) {
  ------------------
  |  Branch (708:13): [True: 2.56M, False: 196k]
  ------------------
  709|  2.56M|          k += r;
  710|  2.56M|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  2.56M|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 144k, False: 2.42M]
  |  |  ------------------
  |  |  416|   144k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   144k|#define GET_BYTE { \
  |  |  |  |  392|   144k|  register int c0, c1; \
  |  |  |  |  393|   144k|  c0 = *buffer++; \
  |  |  |  |  394|   144k|  c1 = *buffer; \
  |  |  |  |  395|   144k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   144k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   144k|  bits_left += 8; \
  |  |  |  |  398|   144k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.90k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.90k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.90k|    buffer++; \
  |  |  |  |  401|  3.90k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.02k, False: 878]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.02k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.02k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.02k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.02k|      buffer -= 2; \
  |  |  |  |  406|  3.02k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.02k|    } \
  |  |  |  |  408|  3.90k|  } \
  |  |  |  |  409|   144k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   144k|#define GET_BYTE { \
  |  |  |  |  392|   144k|  register int c0, c1; \
  |  |  |  |  393|   144k|  c0 = *buffer++; \
  |  |  |  |  394|   144k|  c1 = *buffer; \
  |  |  |  |  395|   144k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   144k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   144k|  bits_left += 8; \
  |  |  |  |  398|   144k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.98k, False: 140k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.98k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.98k|    buffer++; \
  |  |  |  |  401|  3.98k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.08k, False: 896]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.08k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.08k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.08k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.08k|      buffer -= 2; \
  |  |  |  |  406|  3.08k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.08k|    } \
  |  |  |  |  408|  3.98k|  } \
  |  |  |  |  409|   144k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   144k|#define GET_BYTE { \
  |  |  |  |  392|   144k|  register int c0, c1; \
  |  |  |  |  393|   144k|  c0 = *buffer++; \
  |  |  |  |  394|   144k|  c1 = *buffer; \
  |  |  |  |  395|   144k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   144k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   144k|  bits_left += 8; \
  |  |  |  |  398|   144k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.34k, False: 139k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.34k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.34k|    buffer++; \
  |  |  |  |  401|  4.34k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.17k, False: 1.17k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.17k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.17k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.17k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.17k|      buffer -= 2; \
  |  |  |  |  406|  3.17k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.17k|    } \
  |  |  |  |  408|  4.34k|  } \
  |  |  |  |  409|   144k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   144k|#define GET_BYTE { \
  |  |  |  |  392|   144k|  register int c0, c1; \
  |  |  |  |  393|   144k|  c0 = *buffer++; \
  |  |  |  |  394|   144k|  c1 = *buffer; \
  |  |  |  |  395|   144k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   144k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   144k|  bits_left += 8; \
  |  |  |  |  398|   144k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.39k, False: 139k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.39k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.39k|    buffer++; \
  |  |  |  |  401|  4.39k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.34k, False: 1.04k]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.34k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.34k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.34k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.34k|      buffer -= 2; \
  |  |  |  |  406|  3.34k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.34k|    } \
  |  |  |  |  408|  4.39k|  } \
  |  |  |  |  409|   144k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   144k|#define GET_BYTE { \
  |  |  |  |  392|   144k|  register int c0, c1; \
  |  |  |  |  393|   144k|  c0 = *buffer++; \
  |  |  |  |  394|   144k|  c1 = *buffer; \
  |  |  |  |  395|   144k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   144k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   144k|  bits_left += 8; \
  |  |  |  |  398|   144k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.22k, False: 139k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.22k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.22k|    buffer++; \
  |  |  |  |  401|  4.22k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.38k, False: 835]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.38k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.38k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.38k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.38k|      buffer -= 2; \
  |  |  |  |  406|  3.38k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.38k|    } \
  |  |  |  |  408|  4.22k|  } \
  |  |  |  |  409|   144k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|   144k|#define GET_BYTE { \
  |  |  |  |  392|   144k|  register int c0, c1; \
  |  |  |  |  393|   144k|  c0 = *buffer++; \
  |  |  |  |  394|   144k|  c1 = *buffer; \
  |  |  |  |  395|   144k|  /* Pre-execute most common case */ \
  |  |  |  |  396|   144k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|   144k|  bits_left += 8; \
  |  |  |  |  398|   144k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 4.52k, False: 139k]
  |  |  |  |  ------------------
  |  |  |  |  399|  4.52k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  4.52k|    buffer++; \
  |  |  |  |  401|  4.52k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 3.54k, False: 977]
  |  |  |  |  ------------------
  |  |  |  |  402|  3.54k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|  3.54k|      cinfo->unread_marker = c1; \
  |  |  |  |  404|  3.54k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|  3.54k|      buffer -= 2; \
  |  |  |  |  406|  3.54k|      get_buffer &= ~0xFF; \
  |  |  |  |  407|  3.54k|    } \
  |  |  |  |  408|  4.52k|  } \
  |  |  |  |  409|   144k|}
  |  |  ------------------
  |  |  417|   144k|  }
  ------------------
  711|  2.56M|          r = GET_BITS(s);
  ------------------
  |  |  169|  2.56M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|  2.56M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  2.56M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  2.56M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|  2.56M|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|  2.56M|        } else {
  715|   196k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 194k, False: 1.17k]
  ------------------
  716|  1.17k|          k += 15;
  717|  1.17k|        }
  718|  2.76M|      }
  719|       |
  720|   238k|    } 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|   238k|  }
  738|       |
  739|   238k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 2.90k, False: 235k]
  ------------------
  740|  2.90k|    cinfo->unread_marker = 0;
  741|  2.90k|    return FALSE;
  ------------------
  |  |  207|  2.90k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  2.90k|  }
  743|       |
  744|   235k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|   235k|  br_state.next_input_byte = buffer;
  746|   235k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   235k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   235k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   235k|  permstate.get_buffer = get_buffer; \
  |  |  140|   235k|  permstate.bits_left = bits_left
  ------------------
  747|   235k|  entropy->saved = state;
  748|   235k|  return TRUE;
  ------------------
  |  |  210|   235k|#define TRUE    1
  ------------------
  749|   238k|}
jdhuff.c:decode_mcu_slow:
  553|  31.6k|{
  554|  31.6k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  31.6k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  31.6k|  register bit_buf_type get_buffer; \
  |  |  126|  31.6k|  register int bits_left; \
  |  |  127|  31.6k|  bitread_working_state br_state
  ------------------
  556|  31.6k|  int blkn;
  557|  31.6k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  31.6k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  31.6k|  br_state.cinfo = cinfop; \
  |  |  131|  31.6k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  31.6k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  31.6k|  get_buffer = permstate.get_buffer; \
  |  |  134|  31.6k|  bits_left = permstate.bits_left;
  ------------------
  562|  31.6k|  state = entropy->saved;
  563|       |
  564|  63.2k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 31.6k, False: 31.5k]
  ------------------
  565|  31.6k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 31.6k, False: 0]
  ------------------
  566|  31.6k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  31.6k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  31.6k|    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|  31.6k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  31.6k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  31.6k|  register int nb, look; \
  |  |  202|  31.6k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  31.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 2.30k, False: 29.3k]
  |  |  ------------------
  |  |  203|  2.30k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 2.30k]
  |  |  ------------------
  |  |  204|  2.30k|      { failaction; } \
  |  |  205|  2.30k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  2.30k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.30k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 79, False: 2.22k]
  |  |  ------------------
  |  |  207|     79|      nb = 1;  goto slowlabel; \
  |  |  208|     79|    } \
  |  |  209|  2.30k|  } \
  |  |  210|  31.6k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  31.6k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  31.6k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  31.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  31.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 31.0k, False: 546]
  |  |  ------------------
  |  |  212|  31.0k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  31.0k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  31.0k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  31.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  31.0k|  } else { \
  |  |  215|    610|slowlabel: \
  |  |  216|    610|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 610]
  |  |  ------------------
  |  |  217|    610|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    610|      { failaction; } \
  |  |  219|    610|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    610|  } \
  |  |  221|  31.6k|}
  ------------------
  574|  31.6k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 25.9k, False: 5.72k]
  ------------------
  575|  25.9k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  25.9k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  25.9k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 382, False: 25.5k]
  |  |  ------------------
  |  |  162|    382|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 382]
  |  |  ------------------
  |  |  163|    382|      { action; } \
  |  |  164|    382|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    382|  } \
  |  |  166|  25.9k|}
  ------------------
  576|  25.9k|      r = GET_BITS(s);
  ------------------
  |  |  169|  25.9k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  25.9k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  25.9k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  25.9k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  25.9k|    }
  579|       |
  580|  31.6k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 31.5k, False: 109]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  31.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|  31.5k|      s += state.last_dc_val[ci];
  592|  31.5k|      state.last_dc_val[ci] = s;
  593|  31.5k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 31.5k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  31.5k|        (*block)[0] = (JCOEF)s;
  596|  31.5k|      }
  597|  31.5k|    }
  598|       |
  599|  31.6k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 31.5k, False: 109]
  |  Branch (599:37): [True: 31.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|   158k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   158k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 155k, False: 3.10k]
  ------------------
  604|   155k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|   155k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   155k|  register int nb, look; \
  |  |  202|   155k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   155k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 13.9k, False: 141k]
  |  |  ------------------
  |  |  203|  13.9k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 13.9k]
  |  |  ------------------
  |  |  204|  13.9k|      { failaction; } \
  |  |  205|  13.9k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  13.9k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  13.9k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 340, False: 13.5k]
  |  |  ------------------
  |  |  207|    340|      nb = 1;  goto slowlabel; \
  |  |  208|    340|    } \
  |  |  209|  13.9k|  } \
  |  |  210|   155k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   155k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   155k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   155k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   155k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 149k, False: 5.35k]
  |  |  ------------------
  |  |  212|   149k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   149k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   149k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   149k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   149k|  } else { \
  |  |  215|  5.61k|slowlabel: \
  |  |  216|  5.61k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 5.61k]
  |  |  ------------------
  |  |  217|  5.61k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  5.61k|      { failaction; } \
  |  |  219|  5.61k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  5.61k|  } \
  |  |  221|   155k|}
  ------------------
  605|       |
  606|   155k|        r = s >> 4;
  607|   155k|        s &= 15;
  608|       |
  609|   155k|        if (s) {
  ------------------
  |  Branch (609:13): [True: 126k, False: 28.8k]
  ------------------
  610|   126k|          k += r;
  611|   126k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   126k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   126k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 2.63k, False: 124k]
  |  |  ------------------
  |  |  162|  2.63k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 2.63k]
  |  |  ------------------
  |  |  163|  2.63k|      { action; } \
  |  |  164|  2.63k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  2.63k|  } \
  |  |  166|   126k|}
  ------------------
  612|   126k|          r = GET_BITS(s);
  ------------------
  |  |  169|   126k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|   126k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   126k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   126k|#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|   126k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|   126k|        } else {
  620|  28.8k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 28.3k, False: 508]
  ------------------
  621|  28.3k|            break;
  622|    508|          k += 15;
  623|    508|        }
  624|   155k|      }
  625|       |
  626|  31.5k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|    109|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|    109|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 109]
  ------------------
  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|    109|    }
  647|  31.6k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  31.5k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  31.5k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  31.5k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  31.5k|  permstate.get_buffer = get_buffer; \
  |  |  140|  31.5k|  permstate.bits_left = bits_left
  ------------------
  651|  31.5k|  entropy->saved = state;
  652|  31.5k|  return TRUE;
  ------------------
  |  |  210|  31.5k|#define TRUE    1
  ------------------
  653|  31.6k|}

jinit_input_controller:
  405|  2.61k|{
  406|  2.61k|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|  2.61k|  inputctl = (my_inputctl_ptr)
  410|  2.61k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  2.61k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|  2.61k|                                sizeof(my_input_controller));
  412|  2.61k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|  2.61k|  inputctl->pub.consume_input = consume_markers;
  415|  2.61k|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|  2.61k|  inputctl->pub.start_input_pass = start_input_pass;
  417|  2.61k|  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|  2.61k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  2.61k|#define FALSE   0               /* values of boolean */
  ------------------
  422|  2.61k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  2.61k|#define FALSE   0               /* values of boolean */
  ------------------
  423|  2.61k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  2.61k|#define TRUE    1
  ------------------
  424|  2.61k|}
jdinput.c:consume_markers:
  332|  4.68k|{
  333|  4.68k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|  4.68k|  int val;
  335|       |
  336|  4.68k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 4.68k]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|  4.68k|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|  4.68k|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 3.96k, False: 726]
  ------------------
  342|  3.26k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|  3.26k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 3.26k, False: 1.42k]
  ------------------
  343|  3.26k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 2.05k, False: 1.21k]
  ------------------
  344|  2.05k|      initial_setup(cinfo);
  345|  2.05k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|  2.05k|#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|  2.05k|    } else {                    /* 2nd or later SOS marker */
  351|  1.21k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 2, False: 1.21k]
  ------------------
  352|      2|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|  1.21k|      start_input_pass(cinfo);
  354|  1.21k|    }
  355|  3.26k|    break;
  356|    695|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|    695|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 695, False: 3.99k]
  ------------------
  357|    695|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|    695|#define TRUE    1
  ------------------
  358|    695|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 2, False: 693]
  ------------------
  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|    693|    } 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|    693|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 0, False: 693]
  ------------------
  366|      0|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|    693|    }
  368|    695|    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: 4.68k]
  ------------------
  370|      0|    break;
  371|  4.68k|  }
  372|       |
  373|  3.94k|  return val;
  374|  4.68k|}
jdinput.c:initial_setup:
   49|  2.05k|{
   50|  2.05k|  int ci;
   51|  2.05k|  jpeg_component_info *compptr;
   52|  2.05k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  1.64k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 411, False: 1.64k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|  2.05k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|  4.10k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 1, False: 2.05k]
  ------------------
   56|  2.05k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  2.05k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 1, False: 2.05k]
  ------------------
   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|  2.05k|#ifdef D_LOSSLESS_SUPPORTED
   63|  2.05k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (63:7): [True: 409, False: 1.64k]
  ------------------
   64|    409|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (64:9): [True: 1, False: 408]
  |  Branch (64:38): [True: 1, False: 407]
  ------------------
   65|      2|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  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)))
  ------------------
   66|    409|  } else
   67|  1.64k|#endif
   68|  1.64k|  {
   69|  1.64k|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (69:9): [True: 67, False: 1.57k]
  |  Branch (69:39): [True: 2, False: 65]
  ------------------
   70|      2|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  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)))
  ------------------
   71|  1.64k|  }
   72|       |
   73|       |  /* Check that number of components won't exceed internal array sizes */
   74|  2.05k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|  2.05k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (74:7): [True: 0, False: 2.05k]
  ------------------
   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|  2.05k|             MAX_COMPONENTS);
   77|       |
   78|       |  /* Compute maximum sampling factors; check factor validity */
   79|  2.05k|  cinfo->max_h_samp_factor = 1;
   80|  2.05k|  cinfo->max_v_samp_factor = 1;
   81|  4.27k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (81:44): [True: 2.22k, False: 2.05k]
  ------------------
   82|  2.22k|       ci++, compptr++) {
   83|  2.22k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (83:9): [True: 1, False: 2.22k]
  ------------------
   84|  2.22k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|  4.45k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (84:9): [True: 2, False: 2.22k]
  ------------------
   85|  2.22k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (85:9): [True: 1, False: 2.22k]
  ------------------
   86|  2.22k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|  2.22k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (86:9): [True: 1, False: 2.22k]
  ------------------
   87|      5|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|  2.22k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|  2.22k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 128, False: 2.09k]
  |  |  ------------------
  ------------------
   89|  2.22k|                                   compptr->h_samp_factor);
   90|  2.22k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|  2.22k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 68, False: 2.15k]
  |  |  ------------------
  ------------------
   91|  2.22k|                                   compptr->v_samp_factor);
   92|  2.22k|  }
   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|  2.05k|  cinfo->min_DCT_scaled_size = data_unit;
  108|  2.05k|#endif
  109|       |
  110|       |  /* Compute dimensions of components */
  111|  4.26k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (111:44): [True: 2.21k, False: 2.05k]
  ------------------
  112|  2.21k|       ci++, compptr++) {
  113|       |#if JPEG_LIB_VERSION >= 70
  114|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  115|       |#else
  116|  2.21k|    compptr->DCT_scaled_size = data_unit;
  117|  2.21k|#endif
  118|       |    /* Size in data units */
  119|  2.21k|    compptr->width_in_blocks = (JDIMENSION)
  120|  2.21k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  121|  2.21k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  122|  2.21k|    compptr->height_in_blocks = (JDIMENSION)
  123|  2.21k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  124|  2.21k|                    (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|  2.21k|    cinfo->master->first_MCU_col[ci] = 0;
  129|  2.21k|    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|  2.21k|    compptr->downsampled_width = (JDIMENSION)
  136|  2.21k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  137|  2.21k|                    (long)cinfo->max_h_samp_factor);
  138|  2.21k|    compptr->downsampled_height = (JDIMENSION)
  139|  2.21k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  140|  2.21k|                    (long)cinfo->max_v_samp_factor);
  141|       |    /* Mark component needed, until color conversion says otherwise */
  142|  2.21k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|  2.21k|#define TRUE    1
  ------------------
  143|       |    /* Mark no quantization table yet saved for component */
  144|  2.21k|    compptr->quant_table = NULL;
  145|  2.21k|  }
  146|       |
  147|       |  /* Compute number of fully interleaved MCU rows. */
  148|  2.05k|  cinfo->total_iMCU_rows = (JDIMENSION)
  149|  2.05k|    jdiv_round_up((long)cinfo->image_height,
  150|  2.05k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  151|       |
  152|       |  /* Decide whether file contains multiple scans */
  153|  2.05k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (153:7): [True: 99, False: 1.95k]
  |  Branch (153:55): [True: 846, False: 1.10k]
  ------------------
  154|    934|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  210|    934|#define TRUE    1
  ------------------
  155|  1.11k|  else
  156|  1.11k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  207|  1.11k|#define FALSE   0               /* values of boolean */
  ------------------
  157|  2.05k|}
jdinput.c:reset_input_controller:
  383|  2.61k|{
  384|  2.61k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  385|       |
  386|  2.61k|  inputctl->pub.consume_input = consume_markers;
  387|  2.61k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  2.61k|#define FALSE   0               /* values of boolean */
  ------------------
  388|  2.61k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  2.61k|#define FALSE   0               /* values of boolean */
  ------------------
  389|  2.61k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  2.61k|#define TRUE    1
  ------------------
  390|       |  /* Reset other modules */
  391|  2.61k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  392|  2.61k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  393|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  394|       |  cinfo->coef_bits = NULL;
  395|  2.61k|}
jdinput.c:start_input_pass:
  297|  3.19k|{
  298|  3.19k|  per_scan_setup(cinfo);
  299|  3.19k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (299:7): [True: 2.84k, False: 358]
  ------------------
  300|  2.84k|    latch_quant_tables(cinfo);
  301|  3.19k|  (*cinfo->entropy->start_pass) (cinfo);
  302|  3.19k|  (*cinfo->coef->start_input_pass) (cinfo);
  303|  3.19k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  304|  3.19k|}
jdinput.c:per_scan_setup:
  164|  3.19k|{
  165|  3.19k|  int ci, mcublks, tmp;
  166|  3.19k|  jpeg_component_info *compptr;
  167|  3.19k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  2.84k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (167:19): [True: 358, False: 2.84k]
  ------------------
  168|       |
  169|  3.19k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (169:7): [True: 3.19k, False: 0]
  ------------------
  170|       |
  171|       |    /* Noninterleaved (single-component) scan */
  172|  3.19k|    compptr = cinfo->cur_comp_info[0];
  173|       |
  174|       |    /* Overall image size in MCUs */
  175|  3.19k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  176|  3.19k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  177|       |
  178|       |    /* For noninterleaved scan, always one data unit per MCU */
  179|  3.19k|    compptr->MCU_width = 1;
  180|  3.19k|    compptr->MCU_height = 1;
  181|  3.19k|    compptr->MCU_blocks = 1;
  182|  3.19k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  3.19k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  183|  3.19k|    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|  3.19k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|  3.19k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (188:9): [True: 2.58k, False: 612]
  ------------------
  189|  3.19k|    compptr->last_row_height = tmp;
  190|       |
  191|       |    /* Prepare array describing MCU composition */
  192|  3.19k|    cinfo->blocks_in_MCU = 1;
  193|  3.19k|    cinfo->MCU_membership[0] = 0;
  194|       |
  195|  3.19k|  } 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|  3.19k|}
jdinput.c:latch_quant_tables:
  263|  2.84k|{
  264|  2.84k|  int ci, qtblno;
  265|  2.84k|  jpeg_component_info *compptr;
  266|  2.84k|  JQUANT_TBL *qtbl;
  267|       |
  268|  5.68k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (268:16): [True: 2.84k, False: 2.84k]
  ------------------
  269|  2.84k|    compptr = cinfo->cur_comp_info[ci];
  270|       |    /* No work if we already saved Q-table for this component */
  271|  2.84k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (271:9): [True: 1.21k, False: 1.62k]
  ------------------
  272|  1.21k|      continue;
  273|       |    /* Make sure specified quantization table is present */
  274|  1.62k|    qtblno = compptr->quant_tbl_no;
  275|  1.62k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|  3.25k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (275:9): [True: 0, False: 1.62k]
  |  Branch (275:23): [True: 22, False: 1.60k]
  ------------------
  276|  1.60k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (276:9): [True: 2, False: 1.60k]
  ------------------
  277|     24|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     24|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     24|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |    /* OK, save away the quantization table */
  279|  1.62k|    qtbl = (JQUANT_TBL *)
  280|  1.62k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.62k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  281|  1.62k|                                  sizeof(JQUANT_TBL));
  282|  1.62k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  283|  1.62k|    compptr->quant_table = qtbl;
  284|  1.62k|  }
  285|  2.84k|}
jdinput.c:finish_input_pass:
  315|  2.07k|{
  316|  2.07k|  cinfo->inputctl->consume_input = consume_markers;
  317|  2.07k|}

jinit_lhuff_decoder:
  284|    358|{
  285|    358|  lhuff_entropy_ptr entropy;
  286|    358|  int i;
  287|       |
  288|    358|  entropy = (lhuff_entropy_ptr)
  289|    358|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    358|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|    358|                                sizeof(lhuff_entropy_decoder));
  291|    358|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  292|    358|  entropy->pub.start_pass = start_pass_lhuff_decoder;
  293|    358|  entropy->pub.decode_mcus = decode_mcus;
  294|    358|  entropy->pub.process_restart = process_restart;
  295|       |
  296|       |  /* Mark tables unallocated */
  297|  1.79k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  1.79k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (297:15): [True: 1.43k, False: 358]
  ------------------
  298|       |    entropy->derived_tbls[i] = NULL;
  299|  1.43k|  }
  300|    358|}
jdlhuff.c:start_pass_lhuff_decoder:
   84|    358|{
   85|    358|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
   86|    358|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
   87|    358|  jpeg_component_info *compptr;
   88|       |
   89|    716|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (89:16): [True: 358, False: 358]
  ------------------
   90|    358|    compptr = cinfo->cur_comp_info[ci];
   91|    358|    dctbl = compptr->dc_tbl_no;
   92|       |    /* Make sure requested tables are present */
   93|    358|    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
  ------------------
  |  |   69|    716|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (93:9): [True: 0, False: 358]
  |  Branch (93:22): [True: 12, False: 346]
  ------------------
   94|    346|        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (94:9): [True: 4, False: 342]
  ------------------
   95|     16|      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|     16|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     16|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     16|   (*(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|    358|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|    358|#define TRUE    1
  ------------------
   99|    358|                            &entropy->derived_tbls[dctbl]);
  100|    358|  }
  101|       |
  102|       |  /* Precalculate decoding info for each sample in an MCU of this scan */
  103|    698|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (103:29): [True: 340, False: 358]
  ------------------
  104|    340|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  105|    340|    ci = compptr->component_index;
  106|    680|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (106:23): [True: 340, False: 340]
  ------------------
  107|       |      /* Precalculate the setup info for each output pointer */
  108|    340|      entropy->output_ptr_info[ptrn].ci = ci;
  109|    340|      entropy->output_ptr_info[ptrn].yoffset = yoffset;
  110|    340|      entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  111|    680|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (111:25): [True: 340, False: 340]
  ------------------
  112|       |        /* Precalculate the output pointer index for each sample */
  113|    340|        entropy->output_ptr_index[sampn] = ptrn;
  114|       |        /* Precalculate which table to use for each sample */
  115|    340|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  116|    340|      }
  117|    340|    }
  118|    340|  }
  119|    358|  entropy->num_output_ptrs = ptrn;
  120|       |
  121|       |  /* Initialize bitread state variables */
  122|    358|  entropy->bitstate.bits_left = 0;
  123|    358|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  124|    358|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    358|#define FALSE   0               /* values of boolean */
  ------------------
  125|    358|}
jdlhuff.c:decode_mcus:
  209|  30.8k|{
  210|  30.8k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  211|  30.8k|  int sampn, ci, yoffset, MCU_width, ptrn;
  212|  30.8k|  JDIMENSION mcu_num;
  213|  30.8k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  30.8k|  register bit_buf_type get_buffer; \
  |  |  126|  30.8k|  register int bits_left; \
  |  |  127|  30.8k|  bitread_working_state br_state
  ------------------
  214|       |
  215|       |  /* Set output pointer locations based on MCU_col_num */
  216|  61.6k|  for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) {
  ------------------
  |  Branch (216:18): [True: 30.8k, False: 30.8k]
  ------------------
  217|  30.8k|    ci = entropy->output_ptr_info[ptrn].ci;
  218|  30.8k|    yoffset = entropy->output_ptr_info[ptrn].yoffset;
  219|  30.8k|    MCU_width = entropy->output_ptr_info[ptrn].MCU_width;
  220|  30.8k|    entropy->output_ptr[ptrn] =
  221|  30.8k|      diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width);
  222|  30.8k|  }
  223|       |
  224|       |  /*
  225|       |   * If we've run out of data, zero out the buffers and return.
  226|       |   * By resetting the undifferencer, the output samples will be CENTERJSAMPLE.
  227|       |   *
  228|       |   * NB: We should find a way to do this without interacting with the
  229|       |   * undifferencer module directly.
  230|       |   */
  231|  30.8k|  if (entropy->pub.insufficient_data) {
  ------------------
  |  Branch (231:7): [True: 0, False: 30.8k]
  ------------------
  232|      0|    for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++)
  ------------------
  |  Branch (232:20): [True: 0, False: 0]
  ------------------
  233|      0|      jzero_far((void FAR *)entropy->output_ptr[ptrn],
  234|      0|                nMCU * entropy->output_ptr_info[ptrn].MCU_width *
  235|      0|                sizeof(JDIFF));
  236|       |
  237|      0|    (*cinfo->idct->start_pass) (cinfo);
  238|       |
  239|  30.8k|  } else {
  240|       |
  241|       |    /* Load up working state */
  242|  30.8k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  30.8k|  br_state.cinfo = cinfop; \
  |  |  131|  30.8k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  30.8k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  30.8k|  get_buffer = permstate.get_buffer; \
  |  |  134|  30.8k|  bits_left = permstate.bits_left;
  ------------------
  243|       |
  244|       |    /* Outer loop handles the number of MCUs requested */
  245|       |
  246|  1.58M|    for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {
  ------------------
  |  Branch (246:23): [True: 1.55M, False: 30.6k]
  ------------------
  247|       |
  248|       |      /* Inner loop handles the samples in the MCU */
  249|  3.10M|      for (sampn = 0; sampn < cinfo->blocks_in_MCU; sampn++) {
  ------------------
  |  Branch (249:23): [True: 1.55M, False: 1.55M]
  ------------------
  250|  1.55M|        d_derived_tbl *dctbl = entropy->cur_tbls[sampn];
  251|  1.55M|        register int s, r;
  252|       |
  253|       |        /* Section H.2.2: decode the sample difference */
  254|  1.55M|        HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
  ------------------
  |  |  200|  1.55M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  1.55M|  register int nb, look; \
  |  |  202|  1.55M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.55M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 138k, False: 1.41M]
  |  |  ------------------
  |  |  203|   138k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 138k]
  |  |  ------------------
  |  |  204|   138k|      { failaction; } \
  |  |  205|   138k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   138k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   138k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 243, False: 138k]
  |  |  ------------------
  |  |  207|    243|      nb = 1;  goto slowlabel; \
  |  |  208|    243|    } \
  |  |  209|   138k|  } \
  |  |  210|  1.55M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.55M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  1.55M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.55M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.55M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 1.55M, False: 352]
  |  |  ------------------
  |  |  212|  1.55M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.55M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  1.55M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.55M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  1.55M|  } else { \
  |  |  215|    472|slowlabel: \
  |  |  216|    472|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 472]
  |  |  ------------------
  |  |  217|    472|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    472|      { failaction; } \
  |  |  219|    472|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    472|  } \
  |  |  221|  1.55M|}
  ------------------
  255|  1.55M|        if (s) {
  ------------------
  |  Branch (255:13): [True: 1.05M, False: 496k]
  ------------------
  256|  1.05M|          if (s == 16)  /* special case: always output 32768 */
  ------------------
  |  Branch (256:15): [True: 14.0k, False: 1.04M]
  ------------------
  257|  14.0k|            s = 32768;
  258|  1.04M|          else {        /* normal case: fetch subsequent bits */
  259|  1.04M|            CHECK_BIT_BUFFER(br_state, s, return mcu_num);
  ------------------
  |  |  160|  1.04M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.04M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 4.53k, False: 1.03M]
  |  |  ------------------
  |  |  162|  4.53k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 4.53k]
  |  |  ------------------
  |  |  163|  4.53k|      { action; } \
  |  |  164|  4.53k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  4.53k|  } \
  |  |  166|  1.04M|}
  ------------------
  260|  1.04M|            r = GET_BITS(s);
  ------------------
  |  |  169|  1.04M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  261|  1.04M|            s = HUFF_EXTEND(r, s);
  ------------------
  |  |  138|  1.04M|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  136|  1.04M|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  262|  1.04M|          }
  263|  1.05M|        }
  264|       |
  265|       |        /* Output the sample difference */
  266|  1.55M|        *entropy->output_ptr[entropy->output_ptr_index[sampn]]++ = (JDIFF)s;
  267|  1.55M|      }
  268|       |
  269|       |      /* Completed MCU, so update state */
  270|  1.55M|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  1.55M|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  1.55M|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  1.55M|  permstate.get_buffer = get_buffer; \
  |  |  140|  1.55M|  permstate.bits_left = bits_left
  ------------------
  271|  1.55M|    }
  272|  30.8k|  }
  273|       |
  274|  30.6k| return nMCU;
  275|  30.8k|}

jinit_lossless_decompressor:
  281|    336|{
  282|    336|  lossless_decomp_ptr losslessd;
  283|       |
  284|    336|#if BITS_IN_JSAMPLE == 8
  285|    336|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    672|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 336]
  |  Branch (285:50): [True: 0, False: 336]
  ------------------
  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|    336|  losslessd = (lossless_decomp_ptr)
  294|    336|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    336|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    336|                                sizeof(jpeg_lossless_decompressor));
  296|    336|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    336|  losslessd->pub.start_pass = start_pass_lossless;
  298|    336|}
jdlossls-8.c:start_pass_lossless:
  243|    643|{
  244|    643|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|    643|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|    643|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 642]
  |  Branch (257:24): [True: 1, False: 641]
  ------------------
  258|    641|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 640]
  |  Branch (258:25): [True: 1, False: 639]
  ------------------
  259|    639|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 639]
  |  Branch (259:24): [True: 1, False: 638]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|    643|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  1.28k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 638, False: 643]
  ------------------
  265|    638|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|    643|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 202, False: 441]
  ------------------
  269|    202|    losslessd->scaler_scale = simple_upscale;
  270|    441|  else
  271|    441|    losslessd->scaler_scale = noscale;
  272|    643|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|    307|{
  178|    307|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|    307|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|    307|  int Ra; \
  |  |   60|    307|  \
  |  |   61|    307|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|    307|  *undiff_buf++ = Ra; \
  |  |   63|    307|  \
  |  |   64|  33.4k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 33.1k, False: 307]
  |  |  ------------------
  |  |   65|  33.1k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  33.1k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  33.1k|    *undiff_buf++ = Ra; \
  |  |   67|  33.1k|  }
  ------------------
  181|       |
  182|       |  /*
  183|       |   * Now that we have undifferenced the first row, we want to use the
  184|       |   * undifferencer that corresponds to the predictor specified in the
  185|       |   * scan header.
  186|       |   */
  187|    307|  switch (cinfo->Ss) {
  188|     41|  case 1:
  ------------------
  |  Branch (188:3): [True: 41, False: 266]
  ------------------
  189|     41|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|     41|    break;
  191|     72|  case 2:
  ------------------
  |  Branch (191:3): [True: 72, False: 235]
  ------------------
  192|     72|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|     72|    break;
  194|     63|  case 3:
  ------------------
  |  Branch (194:3): [True: 63, False: 244]
  ------------------
  195|     63|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|     63|    break;
  197|     32|  case 4:
  ------------------
  |  Branch (197:3): [True: 32, False: 275]
  ------------------
  198|     32|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|     32|    break;
  200|     31|  case 5:
  ------------------
  |  Branch (200:3): [True: 31, False: 276]
  ------------------
  201|     31|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|     31|    break;
  203|     32|  case 6:
  ------------------
  |  Branch (203:3): [True: 32, False: 275]
  ------------------
  204|     32|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|     32|    break;
  206|     36|  case 7:
  ------------------
  |  Branch (206:3): [True: 36, False: 271]
  ------------------
  207|     36|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|     36|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 307]
  ------------------
  210|      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)))
  ------------------
  211|    307|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|    307|  }
  213|    307|}
jdlossls-8.c:jpeg_undifference1:
  111|  3.70k|{
  112|  3.70k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  3.70k|  int Ra; \
  |  |   60|  3.70k|  \
  |  |   61|  3.70k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  3.70k|  *undiff_buf++ = Ra; \
  |  |   63|  3.70k|  \
  |  |   64|   338k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 334k, False: 3.70k]
  |  |  ------------------
  |  |   65|   334k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|   334k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|   334k|    *undiff_buf++ = Ra; \
  |  |   67|   334k|  }
  ------------------
  113|  3.70k|}
jdlossls-8.c:jpeg_undifference2:
  119|  6.20k|{
  120|  6.20k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  6.20k|  int Ra, Rb, Rc; \
  |  |   87|  6.20k|  \
  |  |   88|  6.20k|  Rb = *prev_row++; \
  |  |   89|  6.20k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  6.20k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  6.20k|  *undiff_buf++ = Ra; \
  |  |   91|  6.20k|  \
  |  |   92|   587k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 581k, False: 6.20k]
  |  |  ------------------
  |  |   93|   581k|    Rc = Rb; \
  |  |   94|   581k|    Rb = *prev_row++; \
  |  |   95|   581k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   581k|    *undiff_buf++ = Ra; \
  |  |   97|   581k|  }
  ------------------
  121|  6.20k|  (void)(Rc);
  122|  6.20k|}
jdlossls-8.c:jpeg_undifference3:
  128|  5.37k|{
  129|  5.37k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  5.37k|  int Ra, Rb, Rc; \
  |  |   87|  5.37k|  \
  |  |   88|  5.37k|  Rb = *prev_row++; \
  |  |   89|  5.37k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  5.37k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  5.37k|  *undiff_buf++ = Ra; \
  |  |   91|  5.37k|  \
  |  |   92|   263k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 257k, False: 5.37k]
  |  |  ------------------
  |  |   93|   257k|    Rc = Rb; \
  |  |   94|   257k|    Rb = *prev_row++; \
  |  |   95|   257k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   257k|    *undiff_buf++ = Ra; \
  |  |   97|   257k|  }
  ------------------
  130|  5.37k|}
jdlossls-8.c:jpeg_undifference4:
  136|  2.70k|{
  137|  2.70k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  2.70k|  int Ra, Rb, Rc; \
  |  |   87|  2.70k|  \
  |  |   88|  2.70k|  Rb = *prev_row++; \
  |  |   89|  2.70k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.70k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.70k|  *undiff_buf++ = Ra; \
  |  |   91|  2.70k|  \
  |  |   92|  82.4k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 79.7k, False: 2.70k]
  |  |  ------------------
  |  |   93|  79.7k|    Rc = Rb; \
  |  |   94|  79.7k|    Rb = *prev_row++; \
  |  |   95|  79.7k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  79.7k|    *undiff_buf++ = Ra; \
  |  |   97|  79.7k|  }
  ------------------
  138|  2.70k|}
jdlossls-8.c:jpeg_undifference5:
  144|  4.50k|{
  145|  4.50k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  4.50k|  int Ra, Rb, Rc; \
  |  |   87|  4.50k|  \
  |  |   88|  4.50k|  Rb = *prev_row++; \
  |  |   89|  4.50k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  4.50k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  4.50k|  *undiff_buf++ = Ra; \
  |  |   91|  4.50k|  \
  |  |   92|  12.1k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 7.61k, False: 4.50k]
  |  |  ------------------
  |  |   93|  7.61k|    Rc = Rb; \
  |  |   94|  7.61k|    Rb = *prev_row++; \
  |  |   95|  7.61k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  7.61k|    *undiff_buf++ = Ra; \
  |  |   97|  7.61k|  }
  ------------------
  146|  4.50k|}
jdlossls-8.c:jpeg_undifference6:
  152|  3.28k|{
  153|  3.28k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  3.28k|  int Ra, Rb, Rc; \
  |  |   87|  3.28k|  \
  |  |   88|  3.28k|  Rb = *prev_row++; \
  |  |   89|  3.28k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  3.28k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  3.28k|  *undiff_buf++ = Ra; \
  |  |   91|  3.28k|  \
  |  |   92|   185k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 182k, False: 3.28k]
  |  |  ------------------
  |  |   93|   182k|    Rc = Rb; \
  |  |   94|   182k|    Rb = *prev_row++; \
  |  |   95|   182k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   182k|    *undiff_buf++ = Ra; \
  |  |   97|   182k|  }
  ------------------
  154|  3.28k|}
jdlossls-8.c:jpeg_undifference7:
  160|  4.34k|{
  161|  4.34k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|  4.34k|  int Ra, Rb, Rc; \
  |  |   87|  4.34k|  \
  |  |   88|  4.34k|  Rb = *prev_row++; \
  |  |   89|  4.34k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  4.34k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  4.34k|  *undiff_buf++ = Ra; \
  |  |   91|  4.34k|  \
  |  |   92|  27.4k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 23.1k, False: 4.34k]
  |  |  ------------------
  |  |   93|  23.1k|    Rc = Rb; \
  |  |   94|  23.1k|    Rb = *prev_row++; \
  |  |   95|  23.1k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  23.1k|    *undiff_buf++ = Ra; \
  |  |   97|  23.1k|  }
  ------------------
  162|  4.34k|  (void)(Rc);
  163|  4.34k|}
jdlossls-8.c:simple_upscale:
  221|  6.28k|{
  222|   388k|  do {
  223|   388k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   388k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 382k, False: 6.28k]
  ------------------
  225|  6.28k|}
jdlossls-8.c:noscale:
  230|  24.1k|{
  231|  1.14M|  do {
  232|  1.14M|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  1.14M|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 1.11M, False: 24.1k]
  ------------------
  234|  24.1k|}
j12init_lossless_decompressor:
  281|     16|{
  282|     16|  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|     16|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     32|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 16]
  ------------------
  288|     16|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 16]
  ------------------
  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|     16|  losslessd = (lossless_decomp_ptr)
  294|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|     16|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|     16|                                sizeof(jpeg_lossless_decompressor));
  296|     16|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|     16|  losslessd->pub.start_pass = start_pass_lossless;
  298|     16|}
jdlossls-12.c:start_pass_lossless:
  243|     11|{
  244|     11|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|     11|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|     11|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 10]
  |  Branch (257:24): [True: 1, False: 9]
  ------------------
  258|      9|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 8]
  |  Branch (258:25): [True: 1, False: 7]
  ------------------
  259|      7|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 7]
  |  Branch (259:24): [True: 1, False: 6]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|     11|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|     17|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 6, False: 11]
  ------------------
  265|      6|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|     11|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 4, False: 7]
  ------------------
  269|      4|    losslessd->scaler_scale = simple_upscale;
  270|      7|  else
  271|      7|    losslessd->scaler_scale = noscale;
  272|     11|}
j16init_lossless_decompressor:
  281|     16|{
  282|     16|  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|     16|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     32|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (287:7): [True: 0, False: 16]
  ------------------
  288|     16|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (288:7): [True: 0, False: 16]
  ------------------
  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|     16|  losslessd = (lossless_decomp_ptr)
  294|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|     16|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|     16|                                sizeof(jpeg_lossless_decompressor));
  296|     16|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|     16|  losslessd->pub.start_pass = start_pass_lossless;
  298|     16|}
jdlossls-16.c:start_pass_lossless:
  243|     11|{
  244|     11|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|     11|  int ci;
  246|       |
  247|       |  /* Check that the scan parameters Ss, Se, Ah, Al are OK for lossless JPEG.
  248|       |   *
  249|       |   * Ss is the predictor selection value (psv).  Legal values for sequential
  250|       |   * lossless JPEG are: 1 <= psv <= 7.
  251|       |   *
  252|       |   * Se and Ah are not used and should be zero.
  253|       |   *
  254|       |   * Al specifies the point transform (Pt).
  255|       |   * Legal values are: 0 <= Pt <= (data precision - 1).
  256|       |   */
  257|     11|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 1, False: 10]
  |  Branch (257:24): [True: 1, False: 9]
  ------------------
  258|      9|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 1, False: 8]
  |  Branch (258:25): [True: 1, False: 7]
  ------------------
  259|      7|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 7]
  |  Branch (259:24): [True: 1, False: 6]
  ------------------
  260|      5|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      5|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      5|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      5|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      5|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|     11|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|     17|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 6, False: 11]
  ------------------
  265|      6|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|     11|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 4, False: 7]
  ------------------
  269|      4|    losslessd->scaler_scale = simple_upscale;
  270|      7|  else
  271|      7|    losslessd->scaler_scale = noscale;
  272|     11|}

jinit_d_main_controller:
  429|  1.89k|{
  430|  1.89k|  my_main_ptr main_ptr;
  431|  1.89k|  int ci, rgroup, ngroups;
  432|  1.89k|  jpeg_component_info *compptr;
  433|       |
  434|  1.89k|#ifdef D_LOSSLESS_SUPPORTED
  435|  1.89k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 330, False: 1.56k]
  ------------------
  436|    330|#if BITS_IN_JSAMPLE == 8
  437|    330|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    660|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 330]
  |  Branch (437:52): [True: 0, False: 330]
  ------------------
  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|    330|  } else
  444|  1.56k|#endif
  445|  1.56k|  {
  446|  1.56k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (446:9): [True: 0, False: 1.56k]
  ------------------
  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|  1.56k|  }
  449|       |
  450|  1.89k|  main_ptr = (my_main_ptr)
  451|  1.89k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.89k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|  1.89k|                                sizeof(my_main_controller));
  453|  1.89k|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|  1.89k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|  1.89k|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|  1.89k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 1.89k]
  ------------------
  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.89k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 4, False: 1.89k]
  ------------------
  464|      4|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 4]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|      4|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|      4|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|  1.89k|  } else {
  469|  1.89k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.89k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  1.89k|  }
  471|       |
  472|  3.82k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 1.92k, False: 1.89k]
  ------------------
  473|  1.92k|       ci++, compptr++) {
  474|  1.92k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.92k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  1.92k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  1.92k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  1.92k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  1.92k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.92k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  1.92k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  1.92k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  1.92k|                         (JDIMENSION)(rgroup * ngroups));
  480|  1.92k|  }
  481|  1.89k|}
jdmainct-8.c:start_pass_main:
  259|  1.60k|{
  260|  1.60k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|  1.60k|  switch (pass_mode) {
  263|  1.60k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 1.60k, False: 0]
  ------------------
  264|  1.60k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 1.60k]
  ------------------
  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|  1.60k|    } else {
  271|       |      /* Simple case with no context needed */
  272|  1.60k|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  256|  1.60k|#define _process_data  process_data
  ------------------
  273|  1.60k|    }
  274|  1.60k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|  1.60k|#define FALSE   0               /* values of boolean */
  ------------------
  275|  1.60k|    main_ptr->rowgroup_ctr = 0;
  276|  1.60k|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 1.60k]
  ------------------
  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: 1.60k]
  ------------------
  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.60k|  }
  287|  1.60k|}
jdmainct-8.c:process_data_simple_main:
  298|   398k|{
  299|   398k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|   398k|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|   398k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 48.5k, False: 349k]
  ------------------
  304|  48.5k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  258|  48.5k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (304:9): [True: 0, False: 48.5k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  48.5k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  48.5k|#define TRUE    1
  ------------------
  307|  48.5k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|   398k|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   398k|#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|   398k|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  260|   398k|#define _post_process_data  post_process_data
  ------------------
  318|   398k|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|   398k|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|   398k|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 46.9k, False: 351k]
  ------------------
  323|  46.9k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  46.9k|#define FALSE   0               /* values of boolean */
  ------------------
  324|  46.9k|    main_ptr->rowgroup_ctr = 0;
  325|  46.9k|  }
  326|   398k|}
jdmainct-8.c:alloc_funny_pointers:
  139|      4|{
  140|      4|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|      4|  int ci, rgroup;
  142|      4|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      4|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|      4|  jpeg_component_info *compptr;
  144|      4|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|      4|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  145|       |
  146|       |  /* Get top-level space for component array pointers.
  147|       |   * We alloc both arrays with one call to save a few cycles.
  148|       |   */
  149|      4|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|      4|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      4|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|      4|                                cinfo->num_components * 2 *
  152|      4|                                sizeof(_JSAMPARRAY));
  153|      4|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|     16|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 12, False: 4]
  ------------------
  156|     12|       ci++, compptr++) {
  157|     12|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     12|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|     12|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|     12|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  159|       |    /* Get space for pointer lists --- M+4 row groups in each list.
  160|       |     * We alloc both pointer lists with one call to save a few cycles.
  161|       |     */
  162|     12|    xbuf = (_JSAMPARRAY)
  163|     12|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     12|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|     12|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|     12|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|     12|    main_ptr->xbuffer[0][ci] = xbuf;
  167|     12|    xbuf += rgroup * (M + 4);
  168|     12|    main_ptr->xbuffer[1][ci] = xbuf;
  169|     12|  }
  170|      4|}
j12init_d_main_controller:
  429|     76|{
  430|     76|  my_main_ptr main_ptr;
  431|     76|  int ci, rgroup, ngroups;
  432|     76|  jpeg_component_info *compptr;
  433|       |
  434|     76|#ifdef D_LOSSLESS_SUPPORTED
  435|     76|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 14, False: 62]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|     14|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     28|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (439:9): [True: 0, False: 14]
  ------------------
  440|     14|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:9): [True: 0, False: 14]
  ------------------
  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|     14|  } else
  444|     62|#endif
  445|     62|  {
  446|     62|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     62|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (446:9): [True: 0, False: 62]
  ------------------
  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|     62|  }
  449|       |
  450|     76|  main_ptr = (my_main_ptr)
  451|     76|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     76|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|     76|                                sizeof(my_main_controller));
  453|     76|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|     76|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|     76|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|     76|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 76]
  ------------------
  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|     76|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 5, False: 71]
  ------------------
  464|      5|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|      5|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 5]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|      5|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|      5|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|      5|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|     71|  } else {
  469|     71|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     71|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|     71|  }
  471|       |
  472|    186|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 110, False: 76]
  ------------------
  473|    110|       ci++, compptr++) {
  474|    110|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    110|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|    110|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    110|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|    110|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|    110|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    110|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|    110|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|    110|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|    110|                         (JDIMENSION)(rgroup * ngroups));
  480|    110|  }
  481|     76|}
jdmainct-12.c:start_pass_main:
  259|     18|{
  260|     18|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|     18|  switch (pass_mode) {
  263|     18|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 18, False: 0]
  ------------------
  264|     18|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 18]
  ------------------
  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|     18|    } else {
  271|       |      /* Simple case with no context needed */
  272|     18|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  140|     18|#define _process_data  process_data_12
  ------------------
  273|     18|    }
  274|     18|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|     18|#define FALSE   0               /* values of boolean */
  ------------------
  275|     18|    main_ptr->rowgroup_ctr = 0;
  276|     18|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 18]
  ------------------
  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: 18]
  ------------------
  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|     18|  }
  287|     18|}
jdmainct-12.c:alloc_funny_pointers:
  139|      5|{
  140|      5|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|      5|  int ci, rgroup;
  142|      5|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|      5|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|      5|  jpeg_component_info *compptr;
  144|      5|  _JSAMPARRAY xbuf;
  ------------------
  |  |  114|      5|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  145|       |
  146|       |  /* Get top-level space for component array pointers.
  147|       |   * We alloc both arrays with one call to save a few cycles.
  148|       |   */
  149|      5|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|      5|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|      5|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|      5|                                cinfo->num_components * 2 *
  152|      5|                                sizeof(_JSAMPARRAY));
  153|      5|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|     20|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 15, False: 5]
  ------------------
  156|     15|       ci++, compptr++) {
  157|     15|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     15|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|     15|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|     15|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  159|       |    /* Get space for pointer lists --- M+4 row groups in each list.
  160|       |     * We alloc both pointer lists with one call to save a few cycles.
  161|       |     */
  162|     15|    xbuf = (_JSAMPARRAY)
  163|     15|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     15|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|     15|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|     15|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|     15|    main_ptr->xbuffer[0][ci] = xbuf;
  167|     15|    xbuf += rgroup * (M + 4);
  168|     15|    main_ptr->xbuffer[1][ci] = xbuf;
  169|     15|  }
  170|      5|}
j16init_d_main_controller:
  429|     14|{
  430|     14|  my_main_ptr main_ptr;
  431|     14|  int ci, rgroup, ngroups;
  432|     14|  jpeg_component_info *compptr;
  433|       |
  434|     14|#ifdef D_LOSSLESS_SUPPORTED
  435|     14|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 14, False: 0]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|     14|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     28|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (439:9): [True: 0, False: 14]
  ------------------
  440|     14|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     14|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (440:9): [True: 0, False: 14]
  ------------------
  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|     14|  } 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|     14|  main_ptr = (my_main_ptr)
  451|     14|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     14|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|     14|                                sizeof(my_main_controller));
  453|     14|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|     14|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|     14|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|     14|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 14]
  ------------------
  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|     14|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 14]
  ------------------
  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|     14|  } else {
  469|     14|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     14|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|     14|  }
  471|       |
  472|     40|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 26, False: 14]
  ------------------
  473|     26|       ci++, compptr++) {
  474|     26|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     26|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|     26|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|     26|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|     26|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|     26|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     26|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|     26|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|     26|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|     26|                         (JDIMENSION)(rgroup * ngroups));
  480|     26|  }
  481|     14|}
jdmainct-16.c:start_pass_main:
  259|      3|{
  260|      3|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|      3|  switch (pass_mode) {
  263|      3|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 3, False: 0]
  ------------------
  264|      3|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 3]
  ------------------
  265|      0|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |   51|      0|#define _process_data  process_data_16
  ------------------
  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|      3|    } else {
  271|       |      /* Simple case with no context needed */
  272|      3|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |   51|      3|#define _process_data  process_data_16
  ------------------
  273|      3|    }
  274|      3|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|      3|#define FALSE   0               /* values of boolean */
  ------------------
  275|      3|    main_ptr->rowgroup_ctr = 0;
  276|      3|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 3]
  ------------------
  279|       |    /* For last pass of 2-pass quantization, just crank the postprocessor */
  280|      0|    main_ptr->pub._process_data = process_data_crank_post;
  ------------------
  |  |   51|      0|#define _process_data  process_data_16
  ------------------
  281|      0|    break;
  282|      0|#endif
  283|      0|  default:
  ------------------
  |  Branch (283:3): [True: 0, False: 3]
  ------------------
  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|      3|  }
  287|      3|}

jinit_marker_reader:
 1288|  2.61k|{
 1289|  2.61k|  my_marker_ptr marker;
 1290|  2.61k|  int i;
 1291|       |
 1292|       |  /* Create subobject in permanent pool */
 1293|  2.61k|  marker = (my_marker_ptr)
 1294|  2.61k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  2.61k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1295|  2.61k|                                sizeof(my_marker_reader));
 1296|  2.61k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1297|       |  /* Initialize public method pointers */
 1298|  2.61k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1299|  2.61k|  marker->pub.read_markers = read_markers;
 1300|  2.61k|  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|  2.61k|  marker->process_COM = skip_variable;
 1306|  2.61k|  marker->length_limit_COM = 0;
 1307|  44.5k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1307:15): [True: 41.9k, False: 2.61k]
  ------------------
 1308|  41.9k|    marker->process_APPn[i] = skip_variable;
 1309|  41.9k|    marker->length_limit_APPn[i] = 0;
 1310|  41.9k|  }
 1311|  2.61k|  marker->process_APPn[0] = get_interesting_appn;
 1312|  2.61k|  marker->process_APPn[14] = get_interesting_appn;
 1313|       |  /* Reset marker processing state */
 1314|  2.61k|  reset_marker_reader(cinfo);
 1315|  2.61k|}
jdmarker.c:next_marker:
  892|  62.9k|{
  893|  62.9k|  int c;
  894|  62.9k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  62.9k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  62.9k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  62.9k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  895|       |
  896|  83.7k|  for (;;) {
  897|  83.7k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  83.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  83.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 92]
  |  |  |  |  |  Branch (279:38): [True: 92, False: 83.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 83.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  83.7k|            bytes_in_buffer--; \
  |  |  156|  83.7k|            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|  6.42M|    while (c != 0xFF) {
  ------------------
  |  Branch (903:12): [True: 6.33M, False: 83.7k]
  ------------------
  904|  6.33M|      cinfo->marker->discarded_bytes++;
  905|  6.33M|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  6.33M|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  6.33M|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  906|  6.33M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  6.33M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.33M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 55]
  |  |  |  |  |  Branch (279:38): [True: 55, False: 6.33M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 6.33M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.33M|            bytes_in_buffer--; \
  |  |  156|  6.33M|            V = *next_input_byte++; )
  ------------------
  907|  6.33M|    }
  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|  2.09M|    do {
  914|  2.09M|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.09M|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.09M|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.09M]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.09M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.09M|            bytes_in_buffer--; \
  |  |  156|  2.09M|            V = *next_input_byte++; )
  ------------------
  915|  2.09M|    } while (c == 0xFF);
  ------------------
  |  Branch (915:14): [True: 2.01M, False: 83.7k]
  ------------------
  916|  83.7k|    if (c != 0)
  ------------------
  |  Branch (916:9): [True: 62.7k, False: 20.9k]
  ------------------
  917|  62.7k|      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|  20.9k|    cinfo->marker->discarded_bytes += 2;
  922|  20.9k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  20.9k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  20.9k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  923|  20.9k|  }
  924|       |
  925|  62.9k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (925:7): [True: 170, False: 62.7k]
  ------------------
  926|    170|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|    170|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    170|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    170|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    170|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  927|    170|    cinfo->marker->discarded_bytes = 0;
  928|    170|  }
  929|       |
  930|  62.9k|  cinfo->unread_marker = c;
  931|       |
  932|  62.9k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  62.9k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  62.9k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  933|  62.9k|  return TRUE;
  ------------------
  |  |  210|  62.9k|#define TRUE    1
  ------------------
  934|  62.9k|}
jdmarker.c:reset_marker_reader:
 1268|  5.23k|{
 1269|  5.23k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1270|       |
 1271|  5.23k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1272|  5.23k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1273|  5.23k|  cinfo->unread_marker = 0;             /* no pending marker */
 1274|  5.23k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|  5.23k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|  5.23k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|  5.23k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|  5.23k|  marker->pub.discarded_bytes = 0;
 1277|       |  marker->cur_marker = NULL;
 1278|  5.23k|}
jdmarker.c:read_markers:
  970|  4.68k|{
  971|       |  /* Outer loop repeats once for each marker. */
  972|  67.5k|  for (;;) {
  973|       |    /* Collect the marker proper, unless we already did. */
  974|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  975|  67.5k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (975:9): [True: 65.5k, False: 2.02k]
  ------------------
  976|  65.5k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (976:11): [True: 2.61k, False: 62.9k]
  ------------------
  977|  2.61k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (977:13): [True: 0, False: 2.61k]
  ------------------
  978|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  979|  62.9k|      } else {
  980|  62.9k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (980:13): [True: 0, False: 62.9k]
  ------------------
  981|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  982|  62.9k|      }
  983|  65.5k|    }
  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|  67.5k|    switch (cinfo->unread_marker) {
  989|  2.58k|    case M_SOI:
  ------------------
  |  Branch (989:5): [True: 2.58k, False: 64.9k]
  ------------------
  990|  2.58k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (990:11): [True: 0, False: 2.58k]
  ------------------
  991|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  992|  2.58k|      break;
  993|       |
  994|  2.58k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (994:5): [True: 565, False: 66.9k]
  ------------------
  995|    575|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (995:5): [True: 10, False: 67.5k]
  ------------------
  996|    575|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|    575|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|    575|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|    575|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (996:11): [True: 0, False: 575]
  ------------------
  997|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  998|    575|      break;
  999|       |
 1000|    575|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1000:5): [True: 94, False: 67.4k]
  ------------------
 1001|     94|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|     94|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|     94|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|     94|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1001:11): [True: 0, False: 94]
  ------------------
 1002|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1003|     94|      break;
 1004|       |
 1005|    371|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1005:5): [True: 371, False: 67.1k]
  ------------------
 1006|    371|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|    371|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|    371|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|    371|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1006:11): [True: 0, False: 371]
  ------------------
 1007|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1008|    371|      break;
 1009|       |
 1010|    371|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1010:5): [True: 224, False: 67.3k]
  ------------------
 1011|    224|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|    224|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|    224|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|    224|#define TRUE    1
  ------------------
  |  Branch (1011:11): [True: 0, False: 224]
  ------------------
 1012|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1013|    224|      break;
 1014|       |
 1015|    825|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1015:5): [True: 825, False: 66.7k]
  ------------------
 1016|    825|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|    825|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|    825|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|    825|#define TRUE    1
  ------------------
  |  Branch (1016:11): [True: 0, False: 825]
  ------------------
 1017|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1018|    825|      break;
 1019|       |
 1020|    825|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 53, False: 67.5k]
  ------------------
 1021|     53|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|     53|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|     53|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|     53|#define TRUE    1
  ------------------
  |  Branch (1021:11): [True: 0, False: 53]
  ------------------
 1022|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1023|     53|      break;
 1024|       |
 1025|       |    /* Currently unsupported SOFn types */
 1026|     53|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1026:5): [True: 1, False: 67.5k]
  ------------------
 1027|      3|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1027:5): [True: 2, False: 67.5k]
  ------------------
 1028|      5|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1028:5): [True: 2, False: 67.5k]
  ------------------
 1029|      6|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1029:5): [True: 1, False: 67.5k]
  ------------------
 1030|      7|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 1, False: 67.5k]
  ------------------
 1031|      8|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 1, False: 67.5k]
  ------------------
 1032|     10|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 2, False: 67.5k]
  ------------------
 1033|     10|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     10|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1034|     10|      break;
 1035|       |
 1036|  3.28k|    case M_SOS:
  ------------------
  |  Branch (1036:5): [True: 3.28k, False: 64.2k]
  ------------------
 1037|  3.28k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 3.28k]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|  3.28k|      cinfo->unread_marker = 0; /* processed the marker */
 1040|  3.28k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|  3.28k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1041|       |
 1042|    695|    case M_EOI:
  ------------------
  |  Branch (1042:5): [True: 695, False: 66.8k]
  ------------------
 1043|    695|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|    695|  ((cinfo)->err->msg_code = (code), \
  |  |  298|    695|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1044|    695|      cinfo->unread_marker = 0; /* processed the marker */
 1045|    695|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|    695|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1046|       |
 1047|     23|    case M_DAC:
  ------------------
  |  Branch (1047:5): [True: 23, False: 67.5k]
  ------------------
 1048|     23|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1048:11): [True: 0, False: 23]
  ------------------
 1049|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1050|     23|      break;
 1051|       |
 1052|  2.06k|    case M_DHT:
  ------------------
  |  Branch (1052:5): [True: 2.06k, False: 65.4k]
  ------------------
 1053|  2.06k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1053:11): [True: 0, False: 2.06k]
  ------------------
 1054|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1055|  2.06k|      break;
 1056|       |
 1057|  2.09k|    case M_DQT:
  ------------------
  |  Branch (1057:5): [True: 2.09k, False: 65.4k]
  ------------------
 1058|  2.09k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1058:11): [True: 0, False: 2.09k]
  ------------------
 1059|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1060|  2.09k|      break;
 1061|       |
 1062|  2.09k|    case M_DRI:
  ------------------
  |  Branch (1062:5): [True: 4, False: 67.5k]
  ------------------
 1063|      4|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1063:11): [True: 0, False: 4]
  ------------------
 1064|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1065|      4|      break;
 1066|       |
 1067|  38.9k|    case M_APP0:
  ------------------
  |  Branch (1067:5): [True: 38.9k, False: 28.6k]
  ------------------
 1068|  38.9k|    case M_APP1:
  ------------------
  |  Branch (1068:5): [True: 38, False: 67.5k]
  ------------------
 1069|  38.9k|    case M_APP2:
  ------------------
  |  Branch (1069:5): [True: 15, False: 67.5k]
  ------------------
 1070|  38.9k|    case M_APP3:
  ------------------
  |  Branch (1070:5): [True: 10, False: 67.5k]
  ------------------
 1071|  39.0k|    case M_APP4:
  ------------------
  |  Branch (1071:5): [True: 11, False: 67.5k]
  ------------------
 1072|  39.0k|    case M_APP5:
  ------------------
  |  Branch (1072:5): [True: 28, False: 67.5k]
  ------------------
 1073|  39.0k|    case M_APP6:
  ------------------
  |  Branch (1073:5): [True: 21, False: 67.5k]
  ------------------
 1074|  39.0k|    case M_APP7:
  ------------------
  |  Branch (1074:5): [True: 20, False: 67.5k]
  ------------------
 1075|  39.6k|    case M_APP8:
  ------------------
  |  Branch (1075:5): [True: 551, False: 67.0k]
  ------------------
 1076|  39.6k|    case M_APP9:
  ------------------
  |  Branch (1076:5): [True: 10, False: 67.5k]
  ------------------
 1077|  39.6k|    case M_APP10:
  ------------------
  |  Branch (1077:5): [True: 4, False: 67.5k]
  ------------------
 1078|  39.6k|    case M_APP11:
  ------------------
  |  Branch (1078:5): [True: 14, False: 67.5k]
  ------------------
 1079|  39.7k|    case M_APP12:
  ------------------
  |  Branch (1079:5): [True: 68, False: 67.4k]
  ------------------
 1080|  39.7k|    case M_APP13:
  ------------------
  |  Branch (1080:5): [True: 66, False: 67.4k]
  ------------------
 1081|  41.8k|    case M_APP14:
  ------------------
  |  Branch (1081:5): [True: 2.06k, False: 65.4k]
  ------------------
 1082|  41.8k|    case M_APP15:
  ------------------
  |  Branch (1082:5): [True: 21, False: 67.5k]
  ------------------
 1083|  41.8k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1083:11): [True: 0, False: 41.8k]
  ------------------
 1084|  41.8k|               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|  41.8k|      break;
 1087|       |
 1088|  41.8k|    case M_COM:
  ------------------
  |  Branch (1088:5): [True: 136, False: 67.4k]
  ------------------
 1089|    136|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1089:11): [True: 0, False: 136]
  ------------------
 1090|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1091|    136|      break;
 1092|       |
 1093|    136|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1093:5): [True: 88, False: 67.4k]
  ------------------
 1094|    172|    case M_RST1:
  ------------------
  |  Branch (1094:5): [True: 84, False: 67.4k]
  ------------------
 1095|    271|    case M_RST2:
  ------------------
  |  Branch (1095:5): [True: 99, False: 67.4k]
  ------------------
 1096|    864|    case M_RST3:
  ------------------
  |  Branch (1096:5): [True: 593, False: 66.9k]
  ------------------
 1097|    990|    case M_RST4:
  ------------------
  |  Branch (1097:5): [True: 126, False: 67.4k]
  ------------------
 1098|  1.05k|    case M_RST5:
  ------------------
  |  Branch (1098:5): [True: 66, False: 67.4k]
  ------------------
 1099|  2.13k|    case M_RST6:
  ------------------
  |  Branch (1099:5): [True: 1.07k, False: 66.4k]
  ------------------
 1100|  2.22k|    case M_RST7:
  ------------------
  |  Branch (1100:5): [True: 93, False: 67.4k]
  ------------------
 1101|  12.0k|    case M_TEM:
  ------------------
  |  Branch (1101:5): [True: 9.86k, False: 57.6k]
  ------------------
 1102|  12.0k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  12.0k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  12.0k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  12.0k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1103|  12.0k|      break;
 1104|       |
 1105|     77|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1105:5): [True: 77, False: 67.4k]
  ------------------
 1106|     77|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1106:11): [True: 0, False: 77]
  ------------------
 1107|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1108|     77|      break;
 1109|       |
 1110|    127|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1110:5): [True: 127, False: 67.4k]
  ------------------
 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|    127|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|    127|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    127|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    127|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1117|    127|      break;
 1118|  67.5k|    }
 1119|       |    /* Successfully processed marker, so reset state variable */
 1120|  62.8k|    cinfo->unread_marker = 0;
 1121|  62.8k|  } /* end loop */
 1122|  4.68k|}
jdmarker.c:first_marker:
  945|  2.61k|{
  946|  2.61k|  int c, c2;
  947|  2.61k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.61k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.61k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.61k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  948|       |
  949|  2.61k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.61k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.61k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.61k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.61k|            bytes_in_buffer--; \
  |  |  156|  2.61k|            V = *next_input_byte++; )
  ------------------
  950|  2.61k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|  2.61k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.62k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.61k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.61k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.61k|            bytes_in_buffer--; \
  |  |  156|  2.61k|            V = *next_input_byte++; )
  ------------------
  951|  2.61k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (951:7): [True: 32, False: 2.58k]
  |  Branch (951:20): [True: 5, False: 2.58k]
  ------------------
  952|     36|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|     36|  ((cinfo)->err->msg_code = (code), \
  |  |  248|     36|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|     36|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|     36|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  953|       |
  954|  2.61k|  cinfo->unread_marker = c2;
  955|       |
  956|  2.61k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.61k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.61k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  957|  2.61k|  return TRUE;
  ------------------
  |  |  210|  2.61k|#define TRUE    1
  ------------------
  958|  2.61k|}
jdmarker.c:get_soi:
  204|  2.58k|{
  205|  2.58k|  int i;
  206|       |
  207|  2.58k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  2.58k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  2.58k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  2.58k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 3, False: 2.58k]
  ------------------
  210|      3|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|  43.8k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  43.8k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 41.3k, False: 2.58k]
  ------------------
  215|  41.3k|    cinfo->arith_dc_L[i] = 0;
  216|  41.3k|    cinfo->arith_dc_U[i] = 1;
  217|  41.3k|    cinfo->arith_ac_K[i] = 5;
  218|  41.3k|  }
  219|  2.58k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  2.58k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  2.58k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  2.58k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  2.58k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  2.58k|  cinfo->JFIF_minor_version = 1;
  229|  2.58k|  cinfo->density_unit = 0;
  230|  2.58k|  cinfo->X_density = 1;
  231|  2.58k|  cinfo->Y_density = 1;
  232|  2.58k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|  2.58k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  2.58k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  2.58k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|  2.58k|#define TRUE    1
  ------------------
  236|       |
  237|  2.58k|  return TRUE;
  ------------------
  |  |  210|  2.58k|#define TRUE    1
  ------------------
  238|  2.58k|}
jdmarker.c:get_sof:
  245|  2.14k|{
  246|  2.14k|  JLONG length;
  247|  2.14k|  int c, ci;
  248|  2.14k|  jpeg_component_info *compptr;
  249|  2.14k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.14k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.14k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.14k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  2.14k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 5, False: 2.13k]
  ------------------
  252|      5|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|  2.14k|  cinfo->progressive_mode = is_prog;
  255|  2.14k|  cinfo->master->lossless = is_lossless;
  256|  2.14k|  cinfo->arith_code = is_arith;
  257|       |
  258|  2.14k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.14k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.14k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.14k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.14k|            bytes_in_buffer--; \
  |  |  164|  2.14k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.14k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.14k|            bytes_in_buffer--; \
  |  |  167|  2.14k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|  2.14k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  2.14k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.14k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.14k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.14k|            bytes_in_buffer--; \
  |  |  156|  2.14k|            V = *next_input_byte++; )
  ------------------
  261|  2.14k|  cinfo->master->jpeg_data_precision = cinfo->data_precision;
  262|  2.14k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  2.14k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.29k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.14k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.14k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.14k|            bytes_in_buffer--; \
  |  |  164|  2.14k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.14k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.14k|            bytes_in_buffer--; \
  |  |  167|  2.14k|            V += *next_input_byte++; )
  ------------------
  263|  2.14k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  2.14k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.14k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.14k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.14k|            bytes_in_buffer--; \
  |  |  164|  2.14k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.14k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.14k|            bytes_in_buffer--; \
  |  |  167|  2.14k|            V += *next_input_byte++; )
  ------------------
  264|  2.14k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  2.14k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.14k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.14k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.14k|            bytes_in_buffer--; \
  |  |  156|  2.14k|            V = *next_input_byte++; )
  ------------------
  265|       |
  266|  2.14k|  length -= 8;
  267|       |
  268|  2.14k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  2.14k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.14k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.14k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  2.14k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  2.14k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  2.14k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  269|  2.14k|           (int)cinfo->image_width, (int)cinfo->image_height,
  270|  2.14k|           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|  2.14k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (275:7): [True: 11, False: 2.13k]
  |  Branch (275:35): [True: 1, False: 2.13k]
  ------------------
  276|  2.13k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (276:7): [True: 1, False: 2.12k]
  ------------------
  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|  2.14k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (279:7): [True: 18, False: 2.12k]
  ------------------
  280|     18|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     18|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|  2.14k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (282:7): [True: 2.11k, False: 31]
  ------------------
  283|  2.11k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  284|  2.11k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.11k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  285|  2.11k|                         cinfo->num_components * sizeof(jpeg_component_info));
  286|       |
  287|  4.49k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 2.35k, False: 2.14k]
  ------------------
  288|  2.35k|       ci++, compptr++) {
  289|  2.35k|    compptr->component_index = ci;
  290|  2.35k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|  2.35k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.36k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 2.35k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.35k|            bytes_in_buffer--; \
  |  |  156|  2.35k|            V = *next_input_byte++; )
  ------------------
  291|  2.35k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  2.35k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.36k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.35k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.35k|            bytes_in_buffer--; \
  |  |  156|  2.35k|            V = *next_input_byte++; )
  ------------------
  292|  2.35k|    compptr->h_samp_factor = (c >> 4) & 15;
  293|  2.35k|    compptr->v_samp_factor = (c     ) & 15;
  294|  2.35k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|  2.35k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.36k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.35k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.35k|            bytes_in_buffer--; \
  |  |  156|  2.35k|            V = *next_input_byte++; )
  ------------------
  295|       |
  296|  2.35k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|  2.35k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.35k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.35k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  2.35k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  2.35k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  2.35k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  297|  2.35k|             compptr->component_id, compptr->h_samp_factor,
  298|  2.35k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  299|  2.35k|  }
  300|       |
  301|  2.14k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|  2.14k|#define TRUE    1
  ------------------
  302|       |
  303|  2.14k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.14k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.14k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  304|  2.14k|  return TRUE;
  ------------------
  |  |  210|  2.14k|#define TRUE    1
  ------------------
  305|  2.14k|}
jdmarker.c:get_sos:
  311|  3.28k|{
  312|  3.28k|  JLONG length;
  313|  3.28k|  int i, ci, n, c, cc, pi;
  314|  3.28k|  jpeg_component_info *compptr;
  315|  3.28k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  3.28k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  3.28k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  3.28k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  316|       |
  317|  3.28k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (317:7): [True: 1, False: 3.28k]
  ------------------
  318|      1|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|  3.28k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  3.28k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.57k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.28k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.28k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  3.28k|            bytes_in_buffer--; \
  |  |  164|  3.28k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  3.28k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  3.28k|            bytes_in_buffer--; \
  |  |  167|  3.28k|            V += *next_input_byte++; )
  ------------------
  321|       |
  322|  3.28k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|  3.28k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.28k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.28k|            bytes_in_buffer--; \
  |  |  156|  3.28k|            V = *next_input_byte++; )
  ------------------
  323|       |
  324|  3.28k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|  3.28k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  3.28k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  3.28k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  325|       |
  326|  3.28k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  3.27k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (326:7): [True: 9, False: 3.28k]
  |  Branch (326:32): [True: 1, False: 3.27k]
  |  Branch (326:41): [True: 1, False: 3.27k]
  ------------------
  327|     10|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  328|       |
  329|  3.28k|  cinfo->comps_in_scan = n;
  330|       |
  331|       |  /* Collect the component-spec parameters */
  332|       |
  333|  16.4k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|  16.4k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:15): [True: 13.1k, False: 3.28k]
  ------------------
  334|  13.1k|    cinfo->cur_comp_info[i] = NULL;
  335|       |
  336|  6.55k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (336:15): [True: 3.27k, False: 3.28k]
  ------------------
  337|  3.27k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|  3.27k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.27k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.27k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.27k|            bytes_in_buffer--; \
  |  |  156|  3.27k|            V = *next_input_byte++; )
  ------------------
  338|  3.27k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.27k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.27k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.27k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.27k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.27k|            bytes_in_buffer--; \
  |  |  156|  3.27k|            V = *next_input_byte++; )
  ------------------
  339|       |
  340|  3.27k|    for (ci = 0, compptr = cinfo->comp_info;
  341|  3.47k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|  3.46k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (341:10): [True: 3.46k, False: 8]
  |  Branch (341:40): [True: 3.46k, False: 1]
  ------------------
  342|  3.46k|         ci++, compptr++) {
  343|  3.46k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (343:11): [True: 3.26k, False: 199]
  |  Branch (343:42): [True: 3.26k, False: 0]
  ------------------
  344|  3.26k|        goto id_found;
  345|  3.46k|    }
  346|       |
  347|      9|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  244|      9|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|  3.26k|id_found:
  350|       |
  351|  3.26k|    cinfo->cur_comp_info[i] = compptr;
  352|  3.26k|    compptr->dc_tbl_no = (c >> 4) & 15;
  353|  3.26k|    compptr->ac_tbl_no = (c     ) & 15;
  354|       |
  355|  3.26k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|  3.26k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  3.26k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.26k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  3.26k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  3.26k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  3.26k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  356|  3.26k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  357|       |
  358|       |    /* This CSi (cc) should differ from the previous CSi */
  359|  3.26k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (359:18): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|  }
  365|       |
  366|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  367|  3.28k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.28k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.28k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.28k|            bytes_in_buffer--; \
  |  |  156|  3.28k|            V = *next_input_byte++; )
  ------------------
  368|  3.28k|  cinfo->Ss = c;
  369|  3.28k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.28k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 3.27k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.28k|            bytes_in_buffer--; \
  |  |  156|  3.28k|            V = *next_input_byte++; )
  ------------------
  370|  3.28k|  cinfo->Se = c;
  371|  3.28k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  3.28k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3.28k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.28k|            bytes_in_buffer--; \
  |  |  156|  3.28k|            V = *next_input_byte++; )
  ------------------
  372|  3.28k|  cinfo->Ah = (c >> 4) & 15;
  373|  3.28k|  cinfo->Al = (c     ) & 15;
  374|       |
  375|  3.28k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|  3.28k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  3.28k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  3.28k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  3.28k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  3.28k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  376|  3.28k|           cinfo->Ah, cinfo->Al);
  377|       |
  378|       |  /* Prepare to scan data & restart markers */
  379|  3.28k|  cinfo->marker->next_restart_num = 0;
  380|       |
  381|       |  /* Count another SOS marker */
  382|  3.28k|  cinfo->input_scan_number++;
  383|       |
  384|  3.28k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  3.28k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  3.28k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  385|  3.28k|  return TRUE;
  ------------------
  |  |  210|  3.28k|#define TRUE    1
  ------------------
  386|  3.28k|}
jdmarker.c:get_dac:
  394|     23|{
  395|     23|  JLONG length;
  396|     23|  int index, val;
  397|     23|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|     23|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|     23|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|     23|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  398|       |
  399|     23|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|     23|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|     46|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 23]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 23]
  |  |  |  |  |  Branch (279:53): [Folded, False: 23]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|     23|            bytes_in_buffer--; \
  |  |  164|     23|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|     23|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|     23|            bytes_in_buffer--; \
  |  |  167|     23|            V += *next_input_byte++; )
  ------------------
  400|     23|  length -= 2;
  401|       |
  402|  3.22k|  while (length > 0) {
  ------------------
  |  Branch (402:10): [True: 3.19k, False: 23]
  ------------------
  403|  3.19k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  3.19k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.20k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 3.19k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.19k|            bytes_in_buffer--; \
  |  |  156|  3.19k|            V = *next_input_byte++; )
  ------------------
  404|  3.19k|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|  3.19k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  3.20k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 3.19k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 3.19k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  3.19k|            bytes_in_buffer--; \
  |  |  156|  3.19k|            V = *next_input_byte++; )
  ------------------
  405|       |
  406|  3.19k|    length -= 2;
  407|       |
  408|  3.19k|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|  3.19k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  3.19k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  3.19k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  3.19k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  409|       |
  410|  3.19k|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|  3.19k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (410:9): [True: 2, False: 3.19k]
  |  Branch (410:22): [True: 14, False: 3.18k]
  ------------------
  411|     14|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     14|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|       |
  413|  3.19k|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|  3.19k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (413:9): [True: 242, False: 2.95k]
  ------------------
  414|    242|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|    242|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  415|  2.95k|    } else {                    /* define DC table */
  416|  2.95k|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  417|  2.95k|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  418|  2.95k|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (418:11): [True: 5, False: 2.95k]
  ------------------
  419|      5|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  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)))
  ------------------
  420|  2.95k|    }
  421|  3.19k|  }
  422|       |
  423|     23|  if (length != 0)
  ------------------
  |  Branch (423:7): [True: 1, False: 22]
  ------------------
  424|      1|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  425|       |
  426|     23|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|     23|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|     23|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  427|     23|  return TRUE;
  ------------------
  |  |  210|     23|#define TRUE    1
  ------------------
  428|     23|}
jdmarker.c:get_dht:
  440|  2.06k|{
  441|  2.06k|  JLONG length;
  442|  2.06k|  UINT8 bits[17];
  443|  2.06k|  UINT8 huffval[256];
  444|  2.06k|  int i, index, count;
  445|  2.06k|  JHUFF_TBL **htblptr;
  446|  2.06k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.06k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.06k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.06k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  447|       |
  448|  2.06k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.06k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.12k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.06k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.06k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.06k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.06k|            bytes_in_buffer--; \
  |  |  164|  2.06k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.06k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.06k|            bytes_in_buffer--; \
  |  |  167|  2.06k|            V += *next_input_byte++; )
  ------------------
  449|  2.06k|  length -= 2;
  450|       |
  451|  7.88k|  while (length > 16) {
  ------------------
  |  Branch (451:10): [True: 5.82k, False: 2.06k]
  ------------------
  452|  5.82k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  5.82k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.82k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 5.82k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.82k|            bytes_in_buffer--; \
  |  |  156|  5.82k|            V = *next_input_byte++; )
  ------------------
  453|       |
  454|  5.82k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|  5.82k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  5.82k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  5.82k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  455|       |
  456|  5.82k|    bits[0] = 0;
  457|  5.82k|    count = 0;
  458|  98.8k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (458:17): [True: 92.9k, False: 5.82k]
  ------------------
  459|  92.9k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|  92.9k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  93.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 22]
  |  |  |  |  |  Branch (279:38): [True: 22, False: 92.9k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 92.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  92.9k|            bytes_in_buffer--; \
  |  |  156|  92.9k|            V = *next_input_byte++; )
  ------------------
  460|  92.9k|      count += bits[i];
  461|  92.9k|    }
  462|       |
  463|  5.82k|    length -= 1 + 16;
  464|       |
  465|  5.82k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  5.82k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.82k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  5.82k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  5.82k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  5.82k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  5.82k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  466|  5.82k|             bits[1], bits[2], bits[3], bits[4],
  467|  5.82k|             bits[5], bits[6], bits[7], bits[8]);
  468|  5.82k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  5.82k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.82k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.82k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  5.82k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  5.82k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  5.82k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  5.82k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|  5.82k|             bits[9], bits[10], bits[11], bits[12],
  470|  5.82k|             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|  5.82k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (475:9): [True: 64, False: 5.75k]
  |  Branch (475:24): [True: 1, False: 5.75k]
  ------------------
  476|     42|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     42|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     42|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  477|       |
  478|   281k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (478:17): [True: 275k, False: 5.82k]
  ------------------
  479|   275k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|   275k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   281k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 18]
  |  |  |  |  |  Branch (279:38): [True: 18, False: 275k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 275k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.82k|            bytes_in_buffer--; \
  |  |  156|  5.82k|            V = *next_input_byte++; )
  ------------------
  480|       |
  481|  5.82k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  482|       |
  483|  5.82k|    length -= count;
  484|       |
  485|  5.82k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (485:9): [True: 2.01k, False: 3.80k]
  ------------------
  486|  2.01k|      index -= 0x10;
  487|  2.01k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  2.01k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (487:11): [True: 0, False: 2.01k]
  |  Branch (487:24): [True: 2, False: 2.01k]
  ------------------
  488|      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)))
  ------------------
  489|  2.01k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  490|  3.80k|    } else {                    /* DC table definition */
  491|  3.80k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  3.72k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (491:11): [True: 83, False: 3.72k]
  |  Branch (491:24): [True: 3, False: 3.72k]
  ------------------
  492|      3|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  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)))
  ------------------
  493|  3.80k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  494|  3.80k|    }
  495|       |
  496|  5.82k|    if (*htblptr == NULL)
  ------------------
  |  Branch (496:9): [True: 4.07k, False: 1.75k]
  ------------------
  497|  4.07k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  498|       |
  499|  5.82k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  500|  5.82k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  501|  5.82k|  }
  502|       |
  503|  2.06k|  if (length != 0)
  ------------------
  |  Branch (503:7): [True: 6, False: 2.05k]
  ------------------
  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|  2.06k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.06k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.06k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  507|  2.06k|  return TRUE;
  ------------------
  |  |  210|  2.06k|#define TRUE    1
  ------------------
  508|  2.06k|}
jdmarker.c:get_dqt:
  514|  2.09k|{
  515|  2.09k|  JLONG length;
  516|  2.09k|  int n, i, prec;
  517|  2.09k|  unsigned int tmp;
  518|  2.09k|  JQUANT_TBL *quant_ptr;
  519|  2.09k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  2.09k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  2.09k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  2.09k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  520|       |
  521|  2.09k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  2.09k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  4.18k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 2.08k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2.09k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  2.09k|            bytes_in_buffer--; \
  |  |  164|  2.09k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  2.09k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  2.09k|            bytes_in_buffer--; \
  |  |  167|  2.09k|            V += *next_input_byte++; )
  ------------------
  522|  2.09k|  length -= 2;
  523|       |
  524|  4.63k|  while (length > 0) {
  ------------------
  |  Branch (524:10): [True: 2.54k, False: 2.09k]
  ------------------
  525|  2.54k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  2.54k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.54k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 2.53k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.54k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  2.54k|            bytes_in_buffer--; \
  |  |  156|  2.54k|            V = *next_input_byte++; )
  ------------------
  526|  2.54k|    prec = n >> 4;
  527|  2.54k|    n &= 0x0F;
  528|       |
  529|  2.54k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  2.54k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  2.54k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  2.54k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  2.54k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  530|       |
  531|  2.54k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  2.54k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (531:9): [True: 8, False: 2.53k]
  ------------------
  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|  2.54k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (534:9): [True: 2.11k, False: 429]
  ------------------
  535|  2.11k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  536|  2.54k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  537|       |
  538|   163k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|   163k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (538:17): [True: 160k, False: 2.54k]
  ------------------
  539|   160k|      if (prec)
  ------------------
  |  Branch (539:11): [True: 13.7k, False: 146k]
  ------------------
  540|   160k|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  13.7k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  27.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5]
  |  |  |  |  |  Branch (279:38): [True: 5, False: 13.7k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 9]
  |  |  |  |  |  Branch (279:38): [True: 9, False: 13.7k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 13.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   160k|            bytes_in_buffer--; \
  |  |  164|   160k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   160k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   160k|            bytes_in_buffer--; \
  |  |  167|   160k|            V += *next_input_byte++; )
  ------------------
  541|   146k|      else
  542|   160k|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|   146k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   146k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 18]
  |  |  |  |  |  Branch (279:38): [True: 18, False: 146k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 146k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   160k|            bytes_in_buffer--; \
  |  |  156|   160k|            V = *next_input_byte++; )
  ------------------
  543|       |      /* We convert the zigzag-order table to natural array order. */
  544|   160k|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  545|   160k|    }
  546|       |
  547|  2.54k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (547:9): [True: 0, False: 2.54k]
  ------------------
  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|  2.54k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  2.54k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  558|  2.54k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|    213|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (558:9): [True: 213, False: 2.32k]
  ------------------
  559|  2.54k|  }
  560|       |
  561|  2.09k|  if (length != 0)
  ------------------
  |  Branch (561:7): [True: 7, False: 2.08k]
  ------------------
  562|      7|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|       |
  564|  2.09k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.09k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.09k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  565|  2.09k|  return TRUE;
  ------------------
  |  |  210|  2.09k|#define TRUE    1
  ------------------
  566|  2.09k|}
jdmarker.c:get_dri:
  572|      4|{
  573|      4|  JLONG length;
  574|      4|  unsigned int tmp;
  575|      4|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|      4|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|      4|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|      4|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  576|       |
  577|      4|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|      4|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|      8|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:53): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|      4|            bytes_in_buffer--; \
  |  |  164|      4|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|      4|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|      4|            bytes_in_buffer--; \
  |  |  167|      4|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|      4|  if (length != 4)
  ------------------
  |  Branch (579:7): [True: 2, False: 2]
  ------------------
  580|      2|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|      4|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|      4|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|      8|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:53): [Folded, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|      4|            bytes_in_buffer--; \
  |  |  164|      4|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|      4|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|      4|            bytes_in_buffer--; \
  |  |  167|      4|            V += *next_input_byte++; )
  ------------------
  583|       |
  584|      4|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|      4|  ((cinfo)->err->msg_code = (code), \
  |  |  301|      4|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|      4|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  585|       |
  586|      4|  cinfo->restart_interval = tmp;
  587|       |
  588|      4|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|      4|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|      4|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  589|      4|  return TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
  590|      4|}
jdmarker.c:skip_variable:
  864|  1.09k|{
  865|  1.09k|  JLONG length;
  866|  1.09k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  1.09k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  1.09k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  1.09k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  867|       |
  868|  1.09k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  1.09k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  2.18k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1.09k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 1.08k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 1.09k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  1.09k|            bytes_in_buffer--; \
  |  |  164|  1.09k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  1.09k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  1.09k|            bytes_in_buffer--; \
  |  |  167|  1.09k|            V += *next_input_byte++; )
  ------------------
  869|  1.09k|  length -= 2;
  870|       |
  871|  1.09k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  1.09k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  1.09k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  1.09k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  1.09k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  872|       |
  873|  1.09k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  1.09k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  1.09k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  874|  1.09k|  if (length > 0)
  ------------------
  |  Branch (874:7): [True: 975, False: 115]
  ------------------
  875|    975|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  876|       |
  877|  1.09k|  return TRUE;
  ------------------
  |  |  210|  1.09k|#define TRUE    1
  ------------------
  878|  1.09k|}
jdmarker.c:get_interesting_appn:
  712|  40.9k|{
  713|  40.9k|  JLONG length;
  714|  40.9k|  JOCTET b[APPN_DATA_LEN];
  715|  40.9k|  unsigned int i, numtoread;
  716|  40.9k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  40.9k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  40.9k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  40.9k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  717|       |
  718|  40.9k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  40.9k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  81.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 40.9k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:38): [True: 4, False: 40.9k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 40.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  40.9k|            bytes_in_buffer--; \
  |  |  164|  40.9k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  40.9k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  40.9k|            bytes_in_buffer--; \
  |  |  167|  40.9k|            V += *next_input_byte++; )
  ------------------
  719|  40.9k|  length -= 2;
  720|       |
  721|       |  /* get the interesting part of the marker data */
  722|  40.9k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  602|  40.9k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (722:7): [True: 38.8k, False: 2.13k]
  ------------------
  723|  38.8k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  602|  38.8k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  724|  2.13k|  else if (length > 0)
  ------------------
  |  Branch (724:12): [True: 2.07k, False: 56]
  ------------------
  725|  2.07k|    numtoread = (unsigned int)length;
  726|     56|  else
  727|     56|    numtoread = 0;
  728|   609k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (728:15): [True: 568k, False: 40.9k]
  ------------------
  729|   568k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|   568k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   609k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 568k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 568k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  40.9k|            bytes_in_buffer--; \
  |  |  156|  40.9k|            V = *next_input_byte++; )
  ------------------
  730|  40.9k|  length -= numtoread;
  731|       |
  732|       |  /* process it */
  733|  40.9k|  switch (cinfo->unread_marker) {
  734|  38.9k|  case M_APP0:
  ------------------
  |  Branch (734:3): [True: 38.9k, False: 2.06k]
  ------------------
  735|  38.9k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  736|  38.9k|    break;
  737|  2.06k|  case M_APP14:
  ------------------
  |  Branch (737:3): [True: 2.06k, False: 38.9k]
  ------------------
  738|  2.06k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  739|  2.06k|    break;
  740|      0|  default:
  ------------------
  |  Branch (740:3): [True: 0, False: 40.9k]
  ------------------
  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|  40.9k|  }
  745|       |
  746|       |  /* skip any remaining data -- could be lots */
  747|  40.9k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  40.9k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  40.9k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  748|  40.9k|  if (length > 0)
  ------------------
  |  Branch (748:7): [True: 6.82k, False: 34.1k]
  ------------------
  749|  6.82k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  750|       |
  751|  40.9k|  return TRUE;
  ------------------
  |  |  210|  40.9k|#define TRUE    1
  ------------------
  752|  40.9k|}
jdmarker.c:examine_app0:
  612|  38.9k|{
  613|  38.9k|  JLONG totallen = (JLONG)datalen + remaining;
  614|       |
  615|  38.9k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  600|  77.8k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (615:7): [True: 38.8k, False: 84]
  ------------------
  616|  38.8k|      data[0] == 0x4A &&
  ------------------
  |  Branch (616:7): [True: 38.1k, False: 713]
  ------------------
  617|  38.1k|      data[1] == 0x46 &&
  ------------------
  |  Branch (617:7): [True: 36.6k, False: 1.51k]
  ------------------
  618|  36.6k|      data[2] == 0x49 &&
  ------------------
  |  Branch (618:7): [True: 36.3k, False: 238]
  ------------------
  619|  36.3k|      data[3] == 0x46 &&
  ------------------
  |  Branch (619:7): [True: 33.3k, False: 3.05k]
  ------------------
  620|  33.3k|      data[4] == 0) {
  ------------------
  |  Branch (620:7): [True: 32.2k, False: 1.10k]
  ------------------
  621|       |    /* Found JFIF APP0 marker: save info */
  622|  32.2k|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|  32.2k|#define TRUE    1
  ------------------
  623|  32.2k|    cinfo->JFIF_major_version = data[5];
  624|  32.2k|    cinfo->JFIF_minor_version = data[6];
  625|  32.2k|    cinfo->density_unit = data[7];
  626|  32.2k|    cinfo->X_density = (data[8] << 8) + data[9];
  627|  32.2k|    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|  32.2k|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (634:9): [True: 1, False: 32.2k]
  ------------------
  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|  32.2k|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  637|       |    /* Generate trace messages */
  638|  32.2k|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|  32.2k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  32.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 32.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|  32.2k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|  32.2k|           _mp[4] = (p5); \
  |  |  322|  32.2k|           (cinfo)->err->msg_code = (code); \
  |  |  323|  32.2k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  639|  32.2k|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  640|  32.2k|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  641|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  642|  32.2k|    if (data[12] | data[13])
  ------------------
  |  Branch (642:9): [True: 5.76k, False: 26.4k]
  ------------------
  643|  5.76k|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|  5.76k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  5.76k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  5.76k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  5.76k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  644|  32.2k|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  600|  32.2k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  645|  32.2k|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (645:9): [True: 8.14k, False: 24.0k]
  ------------------
  646|  8.14k|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|  8.14k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  8.14k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  8.14k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  647|  32.2k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (647:14): [True: 6.65k, False: 54]
  ------------------
  648|  6.65k|             data[0] == 0x4A &&
  ------------------
  |  Branch (648:14): [True: 5.91k, False: 743]
  ------------------
  649|  5.91k|             data[1] == 0x46 &&
  ------------------
  |  Branch (649:14): [True: 4.39k, False: 1.51k]
  ------------------
  650|  4.39k|             data[2] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 14, False: 4.38k]
  ------------------
  651|     14|             data[3] == 0x58 &&
  ------------------
  |  Branch (651:14): [True: 7, False: 7]
  ------------------
  652|      7|             data[4] == 0) {
  ------------------
  |  Branch (652:14): [True: 4, False: 3]
  ------------------
  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|      4|    switch (data[5]) {
  658|      1|    case 0x10:
  ------------------
  |  Branch (658:5): [True: 1, False: 3]
  ------------------
  659|      1|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (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)))
  ------------------
  660|      1|      break;
  661|      1|    case 0x11:
  ------------------
  |  Branch (661:5): [True: 1, False: 3]
  ------------------
  662|      1|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (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)))
  ------------------
  663|      1|      break;
  664|      1|    case 0x13:
  ------------------
  |  Branch (664:5): [True: 1, False: 3]
  ------------------
  665|      1|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (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)))
  ------------------
  666|      1|      break;
  667|      1|    default:
  ------------------
  |  Branch (667:5): [True: 1, False: 3]
  ------------------
  668|      1|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  305|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|      1|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|      1|      break;
  670|      4|    }
  671|  6.70k|  } else {
  672|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  673|  6.70k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|  6.70k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  6.70k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  6.70k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  674|  6.70k|  }
  675|  38.9k|}
jdmarker.c:examine_app14:
  685|  2.06k|{
  686|  2.06k|  unsigned int version, flags0, flags1, transform;
  687|       |
  688|  2.06k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  601|  4.12k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (688:7): [True: 2.06k, False: 1]
  ------------------
  689|  2.06k|      data[0] == 0x41 &&
  ------------------
  |  Branch (689:7): [True: 1.12k, False: 936]
  ------------------
  690|  1.12k|      data[1] == 0x64 &&
  ------------------
  |  Branch (690:7): [True: 1.11k, False: 11]
  ------------------
  691|  1.11k|      data[2] == 0x6F &&
  ------------------
  |  Branch (691:7): [True: 556, False: 558]
  ------------------
  692|    556|      data[3] == 0x62 &&
  ------------------
  |  Branch (692:7): [True: 535, False: 21]
  ------------------
  693|    535|      data[4] == 0x65) {
  ------------------
  |  Branch (693:7): [True: 527, False: 8]
  ------------------
  694|       |    /* Found Adobe APP14 marker */
  695|    527|    version = (data[5] << 8) + data[6];
  696|    527|    flags0 = (data[7] << 8) + data[8];
  697|    527|    flags1 = (data[9] << 8) + data[10];
  698|    527|    transform = data[11];
  699|    527|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|    527|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    527|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 527]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    527|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    527|           (cinfo)->err->msg_code = (code); \
  |  |  317|    527|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  700|    527|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|    527|#define TRUE    1
  ------------------
  701|    527|    cinfo->Adobe_transform = (UINT8)transform;
  702|  1.53k|  } else {
  703|       |    /* Start of APP14 does not match "Adobe", or too short */
  704|  1.53k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|  1.53k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  1.53k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  1.53k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  705|  1.53k|  }
  706|  2.06k|}

jpeg_calc_output_dimensions:
  269|  4.04k|{
  270|  4.04k|#ifdef IDCT_SCALING_SUPPORTED
  271|  4.04k|  int ci;
  272|  4.04k|  jpeg_component_info *compptr;
  273|  4.04k|#endif
  274|       |
  275|       |  /* Prevent application from calling me at wrong times */
  276|  4.04k|  if (cinfo->global_state != DSTATE_READY)
  ------------------
  |  |   50|  4.04k|#define DSTATE_READY     202    /* found SOS, ready for start_decompress */
  ------------------
  |  Branch (276:7): [True: 0, False: 4.04k]
  ------------------
  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|  4.04k|  jpeg_core_output_dimensions(cinfo);
  281|       |
  282|  4.04k|#ifdef IDCT_SCALING_SUPPORTED
  283|       |
  284|  4.04k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (284:7): [True: 3.26k, False: 782]
  ------------------
  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|  6.63k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (290:46): [True: 3.37k, False: 3.26k]
  ------------------
  291|  3.37k|         ci++, compptr++) {
  292|  3.37k|      int ssize = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  3.37k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  293|  3.37k|      while (ssize < DCTSIZE &&
  ------------------
  |  |   66|  6.74k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (293:14): [True: 0, False: 3.37k]
  ------------------
  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|  3.37k|      compptr->DCT_scaled_size = ssize;
  304|  3.37k|#endif
  305|  3.37k|    }
  306|       |
  307|       |    /* Recompute downsampled dimensions of components;
  308|       |     * application needs to know these if using raw downsampled data.
  309|       |     */
  310|  6.63k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (310:46): [True: 3.37k, False: 3.26k]
  ------------------
  311|  3.37k|         ci++, compptr++) {
  312|       |      /* Size in samples, after IDCT scaling */
  313|  3.37k|      compptr->downsampled_width = (JDIMENSION)
  314|  3.37k|        jdiv_round_up((long)cinfo->image_width *
  315|  3.37k|                      (long)(compptr->h_samp_factor *
  316|  3.37k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  3.37k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  317|  3.37k|                      (long)(cinfo->max_h_samp_factor * DCTSIZE));
  ------------------
  |  |   66|  3.37k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  318|  3.37k|      compptr->downsampled_height = (JDIMENSION)
  319|  3.37k|        jdiv_round_up((long)cinfo->image_height *
  320|  3.37k|                      (long)(compptr->v_samp_factor *
  321|  3.37k|                             compptr->_DCT_scaled_size),
  ------------------
  |  |   24|  3.37k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  322|  3.37k|                      (long)(cinfo->max_v_samp_factor * DCTSIZE));
  ------------------
  |  |   66|  3.37k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  323|  3.37k|    }
  324|  3.26k|  } else
  325|    782|#endif /* IDCT_SCALING_SUPPORTED */
  326|    782|  {
  327|       |    /* Hardwire it to "no scaling" */
  328|    782|    cinfo->output_width = cinfo->image_width;
  329|    782|    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|    782|  }
  334|       |
  335|       |  /* Report number of components in selected colorspace. */
  336|       |  /* Probably this should be in the color conversion module... */
  337|  4.04k|  switch (cinfo->out_color_space) {
  338|  3.90k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (338:3): [True: 3.90k, False: 148]
  ------------------
  339|  3.90k|    cinfo->out_color_components = 1;
  340|  3.90k|    break;
  341|    148|  case JCS_RGB:
  ------------------
  |  Branch (341:3): [True: 148, False: 3.90k]
  ------------------
  342|    148|  case JCS_EXT_RGB:
  ------------------
  |  Branch (342:3): [True: 0, False: 4.04k]
  ------------------
  343|    148|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (343:3): [True: 0, False: 4.04k]
  ------------------
  344|    148|  case JCS_EXT_BGR:
  ------------------
  |  Branch (344:3): [True: 0, False: 4.04k]
  ------------------
  345|    148|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (345:3): [True: 0, False: 4.04k]
  ------------------
  346|    148|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (346:3): [True: 0, False: 4.04k]
  ------------------
  347|    148|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (347:3): [True: 0, False: 4.04k]
  ------------------
  348|    148|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (348:3): [True: 0, False: 4.04k]
  ------------------
  349|    148|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (349:3): [True: 0, False: 4.04k]
  ------------------
  350|    148|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (350:3): [True: 0, False: 4.04k]
  ------------------
  351|    148|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (351:3): [True: 0, False: 4.04k]
  ------------------
  352|    148|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  353|    148|    break;
  354|      0|  case JCS_YCbCr:
  ------------------
  |  Branch (354:3): [True: 0, False: 4.04k]
  ------------------
  355|      0|  case JCS_RGB565:
  ------------------
  |  Branch (355:3): [True: 0, False: 4.04k]
  ------------------
  356|      0|    cinfo->out_color_components = 3;
  357|      0|    break;
  358|      0|  case JCS_CMYK:
  ------------------
  |  Branch (358:3): [True: 0, False: 4.04k]
  ------------------
  359|      0|  case JCS_YCCK:
  ------------------
  |  Branch (359:3): [True: 0, False: 4.04k]
  ------------------
  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: 4.04k]
  ------------------
  363|      0|    cinfo->out_color_components = cinfo->num_components;
  364|      0|    break;
  365|  4.04k|  }
  366|  4.04k|  cinfo->output_components = (cinfo->quantize_colors ? 1 :
  ------------------
  |  Branch (366:31): [True: 0, False: 4.04k]
  ------------------
  367|  4.04k|                              cinfo->out_color_components);
  368|       |
  369|       |  /* See if upsampler will want to emit more than one row at a time */
  370|  4.04k|  if (use_merged_upsample(cinfo))
  ------------------
  |  Branch (370:7): [True: 0, False: 4.04k]
  ------------------
  371|      0|    cinfo->rec_outbuf_height = cinfo->max_v_samp_factor;
  372|  4.04k|  else
  373|  4.04k|    cinfo->rec_outbuf_height = 1;
  374|  4.04k|}
jinit_master_decompress:
  902|  2.00k|{
  903|  2.00k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  904|       |
  905|       |#ifdef WITH_PROFILE
  906|       |  master->pub.total_start = getTime();
  907|       |#endif
  908|       |
  909|  2.00k|  master->pub.prepare_for_output_pass = prepare_for_output_pass;
  910|  2.00k|  master->pub.finish_output_pass = finish_output_pass;
  911|       |
  912|  2.00k|  master->pub.is_dummy_pass = FALSE;
  ------------------
  |  |  207|  2.00k|#define FALSE   0               /* values of boolean */
  ------------------
  913|  2.00k|  master->pub.jinit_upsampler_no_alloc = FALSE;
  ------------------
  |  |  207|  2.00k|#define FALSE   0               /* values of boolean */
  ------------------
  914|       |
  915|  2.00k|  master_selection(cinfo);
  916|  2.00k|}
jdmaster.c:jpeg_core_output_dimensions:
  103|  4.04k|{
  104|  4.04k|#ifdef IDCT_SCALING_SUPPORTED
  105|  4.04k|  int ci;
  106|  4.04k|  jpeg_component_info *compptr;
  107|       |
  108|  4.04k|  if (!cinfo->master->lossless) {
  ------------------
  |  Branch (108:7): [True: 3.26k, False: 782]
  ------------------
  109|       |    /* Compute actual output image dimensions and DCT scaling choices. */
  110|  3.26k|    if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (110:9): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (118:16): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (126:16): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (134:16): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (142:16): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (150:16): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (158:16): [True: 0, False: 3.26k]
  ------------------
  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|  3.26k|    } else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (166:16): [True: 3.26k, False: 0]
  ------------------
  167|       |      /* Provide 8/block_size scaling */
  168|  3.26k|      cinfo->output_width = (JDIMENSION)
  169|  3.26k|        jdiv_round_up((long)cinfo->image_width * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  170|  3.26k|      cinfo->output_height = (JDIMENSION)
  171|  3.26k|        jdiv_round_up((long)cinfo->image_height * 8L, (long)DCTSIZE);
  ------------------
  |  |   66|  3.26k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  172|  3.26k|      cinfo->_min_DCT_h_scaled_size = 8;
  ------------------
  |  |   28|  3.26k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  173|  3.26k|      cinfo->_min_DCT_v_scaled_size = 8;
  ------------------
  |  |   29|  3.26k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  174|  3.26k|    } 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|  6.63k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (241:46): [True: 3.37k, False: 3.26k]
  ------------------
  242|  3.37k|         ci++, compptr++) {
  243|  3.37k|      compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   25|  3.37k|#define _DCT_h_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
  ------------------
  |  |   28|  3.37k|#define _min_DCT_h_scaled_size  min_DCT_scaled_size
  ------------------
  244|  3.37k|      compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   26|  3.37k|#define _DCT_v_scaled_size  DCT_scaled_size
  ------------------
                    compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
  ------------------
  |  |   29|  3.37k|#define _min_DCT_v_scaled_size  min_DCT_scaled_size
  ------------------
  245|  3.37k|    }
  246|  3.26k|  } else
  247|    782|#endif /* !IDCT_SCALING_SUPPORTED */
  248|    782|  {
  249|       |    /* Hardwire it to "no scaling" */
  250|    782|    cinfo->output_width = cinfo->image_width;
  251|    782|    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|    782|  }
  256|  4.04k|}
jdmaster.c:use_merged_upsample:
   39|  6.05k|{
   40|  6.05k|#ifdef UPSAMPLE_MERGING_SUPPORTED
   41|       |  /* Colorspace conversion is not supported with lossless JPEG images */
   42|  6.05k|  if (cinfo->master->lossless)
  ------------------
  |  Branch (42:7): [True: 1.16k, False: 4.89k]
  ------------------
   43|  1.16k|    return FALSE;
  ------------------
  |  |  207|  1.16k|#define FALSE   0               /* values of boolean */
  ------------------
   44|       |  /* Merging is the equivalent of plain box-filter upsampling */
   45|  4.89k|  if (cinfo->do_fancy_upsampling || cinfo->CCIR601_sampling)
  ------------------
  |  Branch (45:7): [True: 4.89k, False: 0]
  |  Branch (45:37): [True: 0, False: 0]
  ------------------
   46|  4.89k|    return FALSE;
  ------------------
  |  |  207|  4.89k|#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|  1.62k|{
  798|  1.62k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  799|       |
  800|  1.62k|  if (master->pub.is_dummy_pass) {
  ------------------
  |  Branch (800:7): [True: 0, False: 1.62k]
  ------------------
  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|  1.62k|  } else {
  811|  1.62k|    if (cinfo->quantize_colors && cinfo->colormap == NULL) {
  ------------------
  |  Branch (811:9): [True: 0, False: 1.62k]
  |  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|  1.62k|    (*cinfo->idct->start_pass) (cinfo);
  823|  1.62k|    (*cinfo->coef->start_output_pass) (cinfo);
  824|  1.62k|    if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (824:9): [True: 1.62k, False: 0]
  ------------------
  825|  1.62k|      if (!master->using_merged_upsample)
  ------------------
  |  Branch (825:11): [True: 1.62k, False: 0]
  ------------------
  826|  1.62k|        (*cinfo->cconvert->start_pass) (cinfo);
  827|  1.62k|      (*cinfo->upsample->start_pass) (cinfo);
  828|  1.62k|      if (cinfo->quantize_colors)
  ------------------
  |  Branch (828:11): [True: 0, False: 1.62k]
  ------------------
  829|      0|        (*cinfo->cquantize->start_pass) (cinfo, master->pub.is_dummy_pass);
  830|  1.62k|      (*cinfo->post->start_pass) (cinfo,
  831|  1.62k|            (master->pub.is_dummy_pass ? JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
  ------------------
  |  Branch (831:14): [True: 0, False: 1.62k]
  ------------------
  832|  1.62k|      (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
  833|  1.62k|    }
  834|  1.62k|  }
  835|       |
  836|       |  /* Set up progress monitor's pass info if present */
  837|  1.62k|  if (cinfo->progress != NULL) {
  ------------------
  |  Branch (837:7): [True: 1.62k, False: 0]
  ------------------
  838|  1.62k|    cinfo->progress->completed_passes = master->pass_number;
  839|  1.62k|    cinfo->progress->total_passes = master->pass_number +
  840|  1.62k|                                    (master->pub.is_dummy_pass ? 2 : 1);
  ------------------
  |  Branch (840:38): [True: 0, False: 1.62k]
  ------------------
  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|  1.62k|    if (cinfo->buffered_image && !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (844:9): [True: 0, False: 1.62k]
  |  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|  1.62k|  }
  848|  1.62k|}
jdmaster.c:finish_output_pass:
  857|    776|{
  858|    776|  my_master_ptr master = (my_master_ptr)cinfo->master;
  859|       |
  860|    776|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (860:7): [True: 0, False: 776]
  ------------------
  861|      0|    (*cinfo->cquantize->finish_pass) (cinfo);
  862|    776|  master->pass_number++;
  863|    776|}
jdmaster.c:master_selection:
  515|  2.00k|{
  516|  2.00k|  my_master_ptr master = (my_master_ptr)cinfo->master;
  517|  2.00k|  boolean use_c_buffer;
  518|  2.00k|  long samplesperrow;
  519|  2.00k|  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|  2.00k|  if (cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (527:7): [True: 2.00k, False: 0]
  ------------------
  528|  2.00k|      cinfo->data_precision != cinfo->master->jpeg_data_precision &&
  ------------------
  |  Branch (528:7): [True: 0, False: 2.00k]
  ------------------
  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|  2.00k|#ifdef D_LOSSLESS_SUPPORTED
  539|  2.00k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (539:7): [True: 378, False: 1.62k]
  ------------------
  540|    378|    cinfo->raw_data_out = FALSE;
  ------------------
  |  |  207|    378|#define FALSE   0               /* values of boolean */
  ------------------
  541|    378|    cinfo->scale_num = cinfo->scale_denom = 1;
  542|    378|  }
  543|  2.00k|#endif
  544|       |
  545|       |  /* Initialize dimensions and other stuff */
  546|  2.00k|  jpeg_calc_output_dimensions(cinfo);
  547|  2.00k|  prepare_range_limit_table(cinfo);
  548|       |
  549|       |  /* Width of an output scanline must be representable as JDIMENSION. */
  550|  2.00k|  samplesperrow = (long)cinfo->output_width *
  551|  2.00k|                  (long)cinfo->out_color_components;
  552|  2.00k|  jd_samplesperrow = (JDIMENSION)samplesperrow;
  553|  2.00k|  if ((long)jd_samplesperrow != samplesperrow)
  ------------------
  |  Branch (553:7): [True: 0, False: 2.00k]
  ------------------
  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|  2.00k|  master->pass_number = 0;
  558|  2.00k|  master->using_merged_upsample = use_merged_upsample(cinfo);
  559|       |
  560|       |  /* Color quantizer selection */
  561|  2.00k|  master->quantizer_1pass = NULL;
  562|  2.00k|  master->quantizer_2pass = NULL;
  563|       |  /* No mode changes if not using buffered-image mode. */
  564|  2.00k|  if (!cinfo->quantize_colors || !cinfo->buffered_image) {
  ------------------
  |  Branch (564:7): [True: 2.00k, False: 0]
  |  Branch (564:34): [True: 0, False: 0]
  ------------------
  565|  2.00k|    cinfo->enable_1pass_quant = FALSE;
  ------------------
  |  |  207|  2.00k|#define FALSE   0               /* values of boolean */
  ------------------
  566|  2.00k|    cinfo->enable_external_quant = FALSE;
  ------------------
  |  |  207|  2.00k|#define FALSE   0               /* values of boolean */
  ------------------
  567|  2.00k|    cinfo->enable_2pass_quant = FALSE;
  ------------------
  |  |  207|  2.00k|#define FALSE   0               /* values of boolean */
  ------------------
  568|  2.00k|  }
  569|  2.00k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (569:7): [True: 0, False: 2.00k]
  ------------------
  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|  2.00k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (621:7): [True: 2.00k, False: 0]
  ------------------
  622|  2.00k|    if (master->using_merged_upsample) {
  ------------------
  |  Branch (622:9): [True: 0, False: 2.00k]
  ------------------
  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|  2.00k|    } else {
  634|  2.00k|      if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (634:11): [True: 1.90k, False: 103]
  ------------------
  635|  1.90k|        jinit_color_deconverter(cinfo);
  636|  1.90k|        jinit_upsampler(cinfo);
  637|  1.90k|      } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (637:18): [True: 82, False: 21]
  ------------------
  638|     82|        j12init_color_deconverter(cinfo);
  639|     82|        j12init_upsampler(cinfo);
  640|     82|      } else {
  641|     21|#ifdef D_LOSSLESS_SUPPORTED
  642|     21|        j16init_color_deconverter(cinfo);
  643|     21|        j16init_upsampler(cinfo);
  644|       |#else
  645|       |        ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  646|       |#endif
  647|     21|      }
  648|  2.00k|    }
  649|  2.00k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (649:9): [True: 1.90k, False: 106]
  ------------------
  650|  1.90k|      jinit_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  651|    106|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (651:14): [True: 78, False: 28]
  ------------------
  652|     78|      j12init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  653|     28|    else
  654|     28|#ifdef D_LOSSLESS_SUPPORTED
  655|     28|      j16init_d_post_controller(cinfo, cinfo->enable_2pass_quant);
  656|       |#else
  657|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  658|       |#endif
  659|  2.00k|  }
  660|       |
  661|  2.00k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (661:7): [True: 368, False: 1.63k]
  ------------------
  662|    368|#ifdef D_LOSSLESS_SUPPORTED
  663|       |    /* Prediction, sample undifferencing, point transform, and sample size
  664|       |     * scaling
  665|       |     */
  666|    368|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (666:9): [True: 336, False: 32]
  ------------------
  667|    336|      jinit_lossless_decompressor(cinfo);
  668|     32|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (668:14): [True: 16, False: 16]
  ------------------
  669|     16|      j12init_lossless_decompressor(cinfo);
  670|     16|    else
  671|     16|      j16init_lossless_decompressor(cinfo);
  672|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  673|    368|    if (cinfo->arith_code) {
  ------------------
  |  Branch (673:9): [True: 10, False: 358]
  ------------------
  674|     10|      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  675|    358|    } else {
  676|    358|      jinit_lhuff_decoder(cinfo);
  677|    358|    }
  678|       |
  679|       |    /* Initialize principal buffer controllers. */
  680|    368|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (680:20): [True: 26, False: 342]
  ------------------
  681|    342|                   cinfo->buffered_image;
  ------------------
  |  Branch (681:20): [True: 0, False: 342]
  ------------------
  682|    368|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (682:9): [True: 330, False: 38]
  ------------------
  683|    330|      jinit_d_diff_controller(cinfo, use_c_buffer);
  684|     38|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (684:14): [True: 14, False: 24]
  ------------------
  685|     14|      j12init_d_diff_controller(cinfo, use_c_buffer);
  686|     24|    else
  687|     24|      j16init_d_diff_controller(cinfo, use_c_buffer);
  688|       |#else
  689|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  690|       |#endif
  691|  1.63k|  } else {
  692|  1.63k|#if defined(DCT_ISLOW_SUPPORTED) || defined(DCT_IFAST_SUPPORTED) || \
  693|  1.63k|    defined(DCT_FLOAT_SUPPORTED)
  694|       |    /* Inverse DCT */
  695|  1.63k|    if (cinfo->data_precision == 8)
  ------------------
  |  Branch (695:9): [True: 1.56k, False: 74]
  ------------------
  696|  1.56k|      jinit_inverse_dct(cinfo);
  697|     74|    else if (cinfo->data_precision == 12)
  ------------------
  |  Branch (697:14): [True: 62, False: 12]
  ------------------
  698|     62|      j12init_inverse_dct(cinfo);
  699|     12|    else
  700|     12|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  243|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     12|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     12|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  701|       |    /* Entropy decoding: either Huffman or arithmetic coding. */
  702|  1.63k|    if (cinfo->arith_code) {
  ------------------
  |  Branch (702:9): [True: 980, False: 659]
  ------------------
  703|    980|#ifdef D_ARITH_CODING_SUPPORTED
  704|    980|      jinit_arith_decoder(cinfo);
  705|       |#else
  706|       |      ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
  707|       |#endif
  708|    980|    } else {
  709|    659|      if (cinfo->progressive_mode) {
  ------------------
  |  Branch (709:11): [True: 92, False: 567]
  ------------------
  710|     92|#ifdef D_PROGRESSIVE_SUPPORTED
  711|     92|        jinit_phuff_decoder(cinfo);
  712|       |#else
  713|       |        ERREXIT(cinfo, JERR_NOT_COMPILED);
  714|       |#endif
  715|     92|      } else
  716|    567|        jinit_huff_decoder(cinfo);
  717|    659|    }
  718|       |
  719|       |    /* Initialize principal buffer controllers. */
  720|  1.63k|    use_c_buffer = cinfo->inputctl->has_multiple_scans ||
  ------------------
  |  Branch (720:20): [True: 875, False: 764]
  ------------------
  721|    764|                   cinfo->buffered_image;
  ------------------
  |  Branch (721:20): [True: 0, False: 764]
  ------------------
  722|  1.63k|    if (cinfo->data_precision == 12)
  ------------------
  |  Branch (722:9): [True: 62, False: 1.57k]
  ------------------
  723|     62|      j12init_d_coef_controller(cinfo, use_c_buffer);
  724|  1.57k|    else
  725|  1.57k|      jinit_d_coef_controller(cinfo, use_c_buffer);
  726|       |#else
  727|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  728|       |#endif
  729|  1.63k|  }
  730|       |
  731|  2.00k|  if (!cinfo->raw_data_out) {
  ------------------
  |  Branch (731:7): [True: 1.98k, False: 22]
  ------------------
  732|  1.98k|    if (cinfo->data_precision <= 8)
  ------------------
  |  Branch (732:9): [True: 1.89k, False: 90]
  ------------------
  733|  1.89k|      jinit_d_main_controller(cinfo, FALSE /* never need full buffer here */);
  ------------------
  |  |  207|  1.89k|#define FALSE   0               /* values of boolean */
  ------------------
  734|     90|    else if (cinfo->data_precision <= 12)
  ------------------
  |  Branch (734:14): [True: 76, False: 14]
  ------------------
  735|     76|      j12init_d_main_controller(cinfo,
  736|     76|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|     76|#define FALSE   0               /* values of boolean */
  ------------------
  737|     14|    else
  738|     14|#ifdef D_LOSSLESS_SUPPORTED
  739|     14|      j16init_d_main_controller(cinfo,
  740|     14|                                FALSE /* never need full buffer here */);
  ------------------
  |  |  207|     14|#define FALSE   0               /* values of boolean */
  ------------------
  741|       |#else
  742|       |      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  743|       |#endif
  744|  1.98k|  }
  745|       |
  746|       |  /* We can now tell the memory manager to allocate virtual arrays. */
  747|  2.00k|  (*cinfo->mem->realize_virt_arrays) ((j_common_ptr)cinfo);
  748|       |
  749|       |  /* Initialize input side of decompressor to consume first scan. */
  750|  2.00k|  (*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|  2.00k|  cinfo->master->first_iMCU_col = 0;
  756|  2.00k|  cinfo->master->last_iMCU_col = cinfo->MCUs_per_row - 1;
  757|  2.00k|  cinfo->master->last_good_iMCU_row = 0;
  758|       |
  759|  2.00k|#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|  2.00k|  if (cinfo->progress != NULL && !cinfo->buffered_image &&
  ------------------
  |  Branch (764:7): [True: 1.88k, False: 127]
  |  Branch (764:34): [True: 1.88k, False: 0]
  ------------------
  765|  1.88k|      cinfo->inputctl->has_multiple_scans) {
  ------------------
  |  Branch (765:7): [True: 816, False: 1.06k]
  ------------------
  766|    816|    int nscans;
  767|       |    /* Estimate number of scans to set pass_limit. */
  768|    816|    if (cinfo->progressive_mode) {
  ------------------
  |  Branch (768:9): [True: 816, False: 0]
  ------------------
  769|       |      /* Arbitrarily estimate 2 interleaved DC scans + 3 AC scans/component. */
  770|    816|      nscans = 2 + 3 * cinfo->num_components;
  771|    816|    } else {
  772|       |      /* For a nonprogressive multiscan file, estimate 1 scan per component. */
  773|      0|      nscans = cinfo->num_components;
  774|      0|    }
  775|    816|    cinfo->progress->pass_counter = 0L;
  776|    816|    cinfo->progress->pass_limit = (long)cinfo->total_iMCU_rows * nscans;
  777|    816|    cinfo->progress->completed_passes = 0;
  778|    816|    cinfo->progress->total_passes = (cinfo->enable_2pass_quant ? 3 : 2);
  ------------------
  |  Branch (778:38): [True: 0, False: 816]
  ------------------
  779|       |    /* Count the input pass as done */
  780|    816|    master->pass_number++;
  781|    816|  }
  782|  2.00k|#endif /* D_MULTISCAN_FILES_SUPPORTED */
  783|  2.00k|}
jdmaster.c:prepare_range_limit_table:
  420|  2.00k|{
  421|  2.00k|  JSAMPLE *table;
  422|  2.00k|  J12SAMPLE *table12;
  423|  2.00k|#ifdef D_LOSSLESS_SUPPORTED
  424|  2.00k|  J16SAMPLE *table16;
  425|  2.00k|#endif
  426|  2.00k|  int i;
  427|       |
  428|  2.00k|  if (cinfo->data_precision <= 8) {
  ------------------
  |  Branch (428:7): [True: 1.90k, False: 103]
  ------------------
  429|  1.90k|    table = (JSAMPLE *)
  430|  1.90k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.90k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  431|  1.90k|                  (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
                                (5 * (MAXJSAMPLE + 1) + CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|  1.90k|#define CENTERJSAMPLE    128
  ------------------
  432|  1.90k|    table += (MAXJSAMPLE + 1);  /* allow negative subscripts of simple table */
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
  433|  1.90k|    cinfo->sample_range_limit = table;
  434|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  435|  1.90k|    memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
                  memset(table - (MAXJSAMPLE + 1), 0, (MAXJSAMPLE + 1) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
  436|       |    /* Main part of "simple" table: limit[x] = x */
  437|   489k|    for (i = 0; i <= MAXJSAMPLE; i++)
  ------------------
  |  |   52|   489k|#define MAXJSAMPLE       255
  ------------------
  |  Branch (437:17): [True: 487k, False: 1.90k]
  ------------------
  438|   487k|      table[i] = (JSAMPLE)i;
  439|  1.90k|    table += CENTERJSAMPLE;     /* Point to where post-IDCT table starts */
  ------------------
  |  |   53|  1.90k|#define CENTERJSAMPLE    128
  ------------------
  440|       |    /* End of simple table, rest of first half of post-IDCT table */
  441|   733k|    for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   53|  1.90k|#define CENTERJSAMPLE    128
  ------------------
                  for (i = CENTERJSAMPLE; i < 2 * (MAXJSAMPLE + 1); i++)
  ------------------
  |  |   52|   733k|#define MAXJSAMPLE       255
  ------------------
  |  Branch (441:29): [True: 731k, False: 1.90k]
  ------------------
  442|   731k|      table[i] = MAXJSAMPLE;
  ------------------
  |  |   52|   731k|#define MAXJSAMPLE       255
  ------------------
  443|       |    /* Second half of post-IDCT table */
  444|  1.90k|    memset(table + (2 * (MAXJSAMPLE + 1)), 0,
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
  445|  1.90k|           (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
                         (2 * (MAXJSAMPLE + 1) - CENTERJSAMPLE) * sizeof(JSAMPLE));
  ------------------
  |  |   53|  1.90k|#define CENTERJSAMPLE    128
  ------------------
  446|  1.90k|    memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   52|  1.90k|#define MAXJSAMPLE       255
  ------------------
                  memcpy(table + (4 * (MAXJSAMPLE + 1) - CENTERJSAMPLE),
  ------------------
  |  |   53|  1.90k|#define CENTERJSAMPLE    128
  ------------------
  447|  1.90k|           cinfo->sample_range_limit, CENTERJSAMPLE * sizeof(JSAMPLE));
  ------------------
  |  |   53|  1.90k|#define CENTERJSAMPLE    128
  ------------------
  448|  1.90k|  } else if (cinfo->data_precision <= 12) {
  ------------------
  |  Branch (448:14): [True: 82, False: 21]
  ------------------
  449|     82|    table12 = (J12SAMPLE *)
  450|     82|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     82|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  451|     82|                  (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
                                (5 * (MAXJ12SAMPLE + 1) + CENTERJ12SAMPLE) *
  ------------------
  |  |   61|     82|#define CENTERJ12SAMPLE  2048
  ------------------
  452|     82|                  sizeof(J12SAMPLE));
  453|     82|    table12 += (MAXJ12SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
  454|       |                                       table */
  455|     82|    cinfo->sample_range_limit = (JSAMPLE *)table12;
  456|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  457|     82|    memset(table12 - (MAXJ12SAMPLE + 1), 0,
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
  458|     82|           (MAXJ12SAMPLE + 1) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
  459|       |    /* Main part of "simple" table: limit[x] = x */
  460|   335k|    for (i = 0; i <= MAXJ12SAMPLE; i++)
  ------------------
  |  |   60|   335k|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (460:17): [True: 335k, False: 82]
  ------------------
  461|   335k|      table12[i] = (J12SAMPLE)i;
  462|     82|    table12 += CENTERJ12SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   61|     82|#define CENTERJ12SAMPLE  2048
  ------------------
  463|       |    /* End of simple table, rest of first half of post-IDCT table */
  464|   503k|    for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   61|     82|#define CENTERJ12SAMPLE  2048
  ------------------
                  for (i = CENTERJ12SAMPLE; i < 2 * (MAXJ12SAMPLE + 1); i++)
  ------------------
  |  |   60|   503k|#define MAXJ12SAMPLE     4095
  ------------------
  |  Branch (464:31): [True: 503k, False: 82]
  ------------------
  465|   503k|      table12[i] = MAXJ12SAMPLE;
  ------------------
  |  |   60|   503k|#define MAXJ12SAMPLE     4095
  ------------------
  466|       |    /* Second half of post-IDCT table */
  467|     82|    memset(table12 + (2 * (MAXJ12SAMPLE + 1)), 0,
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
  468|     82|           (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
                         (2 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE) * sizeof(J12SAMPLE));
  ------------------
  |  |   61|     82|#define CENTERJ12SAMPLE  2048
  ------------------
  469|     82|    memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   60|     82|#define MAXJ12SAMPLE     4095
  ------------------
                  memcpy(table12 + (4 * (MAXJ12SAMPLE + 1) - CENTERJ12SAMPLE),
  ------------------
  |  |   61|     82|#define CENTERJ12SAMPLE  2048
  ------------------
  470|     82|           cinfo->sample_range_limit, CENTERJ12SAMPLE * sizeof(J12SAMPLE));
  ------------------
  |  |   61|     82|#define CENTERJ12SAMPLE  2048
  ------------------
  471|     82|  } else {
  472|     21|#ifdef D_LOSSLESS_SUPPORTED
  473|     21|    table16 = (J16SAMPLE *)
  474|     21|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     21|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  475|     21|                  (5 * (MAXJ16SAMPLE + 1) + CENTERJ16SAMPLE) *
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
                                (5 * (MAXJ16SAMPLE + 1) + CENTERJ16SAMPLE) *
  ------------------
  |  |   69|     21|#define CENTERJ16SAMPLE  32768
  ------------------
  476|     21|                  sizeof(J16SAMPLE));
  477|     21|    table16 += (MAXJ16SAMPLE + 1);  /* allow negative subscripts of simple
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
  478|       |                                       table */
  479|     21|    cinfo->sample_range_limit = (JSAMPLE *)table16;
  480|       |    /* First segment of "simple" table: limit[x] = 0 for x < 0 */
  481|     21|    memset(table16 - (MAXJ16SAMPLE + 1), 0,
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
  482|     21|           (MAXJ16SAMPLE + 1) * sizeof(J16SAMPLE));
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
  483|       |    /* Main part of "simple" table: limit[x] = x */
  484|  1.37M|    for (i = 0; i <= MAXJ16SAMPLE; i++)
  ------------------
  |  |   68|  1.37M|#define MAXJ16SAMPLE     65535
  ------------------
  |  Branch (484:17): [True: 1.37M, False: 21]
  ------------------
  485|  1.37M|      table16[i] = (J16SAMPLE)i;
  486|     21|    table16 += CENTERJ16SAMPLE; /* Point to where post-IDCT table starts */
  ------------------
  |  |   69|     21|#define CENTERJ16SAMPLE  32768
  ------------------
  487|       |    /* End of simple table, rest of first half of post-IDCT table */
  488|  2.06M|    for (i = CENTERJ16SAMPLE; i < 2 * (MAXJ16SAMPLE + 1); i++)
  ------------------
  |  |   69|     21|#define CENTERJ16SAMPLE  32768
  ------------------
                  for (i = CENTERJ16SAMPLE; i < 2 * (MAXJ16SAMPLE + 1); i++)
  ------------------
  |  |   68|  2.06M|#define MAXJ16SAMPLE     65535
  ------------------
  |  Branch (488:31): [True: 2.06M, False: 21]
  ------------------
  489|  2.06M|      table16[i] = MAXJ16SAMPLE;
  ------------------
  |  |   68|  2.06M|#define MAXJ16SAMPLE     65535
  ------------------
  490|       |    /* Second half of post-IDCT table */
  491|     21|    memset(table16 + (2 * (MAXJ16SAMPLE + 1)), 0,
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
  492|     21|           (2 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE) * sizeof(J16SAMPLE));
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
                         (2 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE) * sizeof(J16SAMPLE));
  ------------------
  |  |   69|     21|#define CENTERJ16SAMPLE  32768
  ------------------
  493|     21|    memcpy(table16 + (4 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE),
  ------------------
  |  |   68|     21|#define MAXJ16SAMPLE     65535
  ------------------
                  memcpy(table16 + (4 * (MAXJ16SAMPLE + 1) - CENTERJ16SAMPLE),
  ------------------
  |  |   69|     21|#define CENTERJ16SAMPLE  32768
  ------------------
  494|     21|           cinfo->sample_range_limit, CENTERJ16SAMPLE * sizeof(J16SAMPLE));
  ------------------
  |  |   69|     21|#define CENTERJ16SAMPLE  32768
  ------------------
  495|       |#else
  496|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  497|       |#endif
  498|     21|  }
  499|  2.00k|}

jinit_phuff_decoder:
  654|     92|{
  655|     92|  phuff_entropy_ptr entropy;
  656|     92|  int *coef_bit_ptr;
  657|     92|  int ci, i;
  658|       |
  659|     92|  entropy = (phuff_entropy_ptr)
  660|     92|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     92|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|     92|                                sizeof(phuff_entropy_decoder));
  662|     92|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|     92|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|    460|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|    460|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 368, False: 92]
  ------------------
  667|    368|    entropy->derived_tbls[i] = NULL;
  668|    368|  }
  669|       |
  670|       |  /* Create progression status table */
  671|     92|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|     92|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     92|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|     92|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|     92|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|     92|                                sizeof(int));
  675|     92|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|    186|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 94, False: 92]
  ------------------
  677|  6.11k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|  6.11k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 6.01k, False: 94]
  ------------------
  678|  6.01k|      *coef_bit_ptr++ = -1;
  679|     92|}
jdphuff.c:start_pass_phuff_decoder:
   83|     90|{
   84|     90|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|     90|  boolean is_DC_band, bad;
   86|     90|  int ci, coefi, tbl;
   87|     90|  d_derived_tbl **pdtbl;
   88|     90|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|     90|  jpeg_component_info *compptr;
   90|       |
   91|     90|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|     90|  bad = FALSE;
  ------------------
  |  |  207|     90|#define FALSE   0               /* values of boolean */
  ------------------
   95|     90|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 85, False: 5]
  ------------------
   96|     85|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 1, False: 84]
  ------------------
   97|      1|      bad = TRUE;
  ------------------
  |  |  210|      1|#define TRUE    1
  ------------------
   98|     85|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|      5|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|      3|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 2, False: 3]
  |  Branch (100:34): [True: 1, False: 2]
  ------------------
  101|      3|      bad = TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|      5|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 0, False: 5]
  ------------------
  104|      0|      bad = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  105|      5|  }
  106|     90|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 7, False: 83]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|      7|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 5, False: 2]
  ------------------
  109|      5|      bad = TRUE;
  ------------------
  |  |  210|      5|#define TRUE    1
  ------------------
  110|      7|  }
  111|     90|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 4, False: 86]
  ------------------
  112|      4|    bad = TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
  113|       |  /* Arguably the maximum Al value should be less than 13 for 8-bit precision,
  114|       |   * but the spec doesn't say so, and we try to be liberal about what we
  115|       |   * accept.  Note: large Al values could result in out-of-range DC
  116|       |   * coefficients during early scans, leading to bizarre displays due to
  117|       |   * overflows in the IDCT math.  But we won't crash.
  118|       |   */
  119|     90|  if (bad)
  ------------------
  |  Branch (119:7): [True: 8, False: 82]
  ------------------
  120|      8|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|      8|  ((cinfo)->err->msg_code = (code), \
  |  |  259|      8|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|      8|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|      8|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|      8|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|      8|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|     90|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  122|       |  /* Update progression status, and verify that scan order is legal.
  123|       |   * Note that inter-scan inconsistencies are treated as warnings
  124|       |   * not fatal errors ... not clear if this is right way to behave.
  125|       |   */
  126|    172|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 82, False: 90]
  ------------------
  127|     82|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|     82|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|     82|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|     82|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 1, False: 81]
  |  Branch (130:24): [True: 1, False: 0]
  ------------------
  131|      1|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  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))
  ------------------
  132|    892|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|     82|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 81, False: 1]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|    892|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 0, False: 892]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 810, False: 82]
  ------------------
  133|    810|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 0, False: 810]
  ------------------
  134|      0|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|    810|      else
  136|    810|        prev_coef_bit_ptr[coefi] = 0;
  137|    810|    }
  138|    163|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 81, False: 82]
  ------------------
  139|     81|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 81, False: 0]
  ------------------
  140|     81|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 1, False: 80]
  ------------------
  141|      1|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  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))
  ------------------
  142|     81|      coef_bit_ptr[coefi] = cinfo->Al;
  143|     81|    }
  144|     82|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|     90|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 80, False: 10]
  ------------------
  148|     80|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 80, False: 0]
  ------------------
  149|     80|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|      0|    else
  151|      0|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|     80|  } else {
  153|     10|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 0, False: 10]
  ------------------
  154|      0|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|     10|    else
  156|     10|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|     10|  }
  158|       |
  159|    170|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 80, False: 90]
  ------------------
  160|     80|    compptr = cinfo->cur_comp_info[ci];
  161|       |    /* Make sure requested tables are present, and compute derived tables.
  162|       |     * We may build same derived table more than once, but it's not expensive.
  163|       |     */
  164|     80|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 80, False: 0]
  ------------------
  165|     80|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 80, False: 0]
  ------------------
  166|     80|        tbl = compptr->dc_tbl_no;
  167|     80|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|     80|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|     80|#define TRUE    1
  ------------------
  169|     80|      }
  170|     80|    } else {
  171|      0|      tbl = compptr->ac_tbl_no;
  172|      0|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|      0|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|      0|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|      0|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|     80|    entropy->saved.last_dc_val[ci] = 0;
  179|     80|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|     90|  entropy->bitstate.bits_left = 0;
  183|     90|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|     90|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|     90|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|     90|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|     90|  entropy->restarts_to_go = cinfo->restart_interval;
  191|     90|}
jdphuff.c:decode_mcu_DC_first:
  291|  28.7k|{
  292|  28.7k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  28.7k|  int Al = cinfo->Al;
  294|  28.7k|  register int s, r;
  295|  28.7k|  int blkn, ci;
  296|  28.7k|  JBLOCKROW block;
  297|  28.7k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  28.7k|  register bit_buf_type get_buffer; \
  |  |  126|  28.7k|  register int bits_left; \
  |  |  127|  28.7k|  bitread_working_state br_state
  ------------------
  298|  28.7k|  savable_state state;
  299|  28.7k|  d_derived_tbl *tbl;
  300|  28.7k|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  28.7k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 0, False: 28.7k]
  ------------------
  304|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (304:9): [True: 0, False: 0]
  ------------------
  305|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (305:11): [True: 0, False: 0]
  ------------------
  306|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  307|      0|  }
  308|       |
  309|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  310|       |   * This way, we return uniform gray for the remainder of the segment.
  311|       |   */
  312|  28.7k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 28.7k, False: 0]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  28.7k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  28.7k|  br_state.cinfo = cinfop; \
  |  |  131|  28.7k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  28.7k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  28.7k|  get_buffer = permstate.get_buffer; \
  |  |  134|  28.7k|  bits_left = permstate.bits_left;
  ------------------
  316|  28.7k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|  57.4k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 28.7k, False: 28.7k]
  ------------------
  321|  28.7k|      block = MCU_data[blkn];
  322|  28.7k|      ci = cinfo->MCU_membership[blkn];
  323|  28.7k|      compptr = cinfo->cur_comp_info[ci];
  324|  28.7k|      tbl = entropy->derived_tbls[compptr->dc_tbl_no];
  325|       |
  326|       |      /* Decode a single block's worth of coefficients */
  327|       |
  328|       |      /* Section F.2.2.1: decode the DC coefficient difference */
  329|  28.7k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|  28.7k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  28.7k|  register int nb, look; \
  |  |  202|  28.7k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  28.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 2.98k, False: 25.7k]
  |  |  ------------------
  |  |  203|  2.98k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 2.98k]
  |  |  ------------------
  |  |  204|  2.98k|      { failaction; } \
  |  |  205|  2.98k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  2.98k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  2.98k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 87, False: 2.89k]
  |  |  ------------------
  |  |  207|     87|      nb = 1;  goto slowlabel; \
  |  |  208|     87|    } \
  |  |  209|  2.98k|  } \
  |  |  210|  28.7k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  28.6k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  28.6k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  28.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  28.6k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 28.5k, False: 42]
  |  |  ------------------
  |  |  212|  28.5k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  28.5k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  28.5k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  28.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  28.5k|  } else { \
  |  |  215|    125|slowlabel: \
  |  |  216|    125|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 125]
  |  |  ------------------
  |  |  217|    125|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    125|      { failaction; } \
  |  |  219|    125|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    125|  } \
  |  |  221|  28.6k|}
  ------------------
  330|  28.7k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 25.0k, False: 3.67k]
  ------------------
  331|  25.0k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  25.0k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  25.0k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 319, False: 24.7k]
  |  |  ------------------
  |  |  162|    319|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 319]
  |  |  ------------------
  |  |  163|    319|      { action; } \
  |  |  164|    319|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    319|  } \
  |  |  166|  25.0k|}
  ------------------
  332|  25.0k|        r = GET_BITS(s);
  ------------------
  |  |  169|  25.0k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|  25.0k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  25.0k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|  16.0k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 16.0k, False: 9.01k]
  |  |  ------------------
  ------------------
  334|  25.0k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|  28.7k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 12.3k, False: 16.3k]
  ------------------
  338|  12.3k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 12.3k]
  ------------------
  339|  28.6k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 16.3k, False: 12.3k]
  |  Branch (339:41): [True: 0, False: 16.3k]
  ------------------
  340|      0|        ERREXIT(cinfo, JERR_BAD_DCT_COEF);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  341|  28.7k|      s += state.last_dc_val[ci];
  342|  28.7k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|  28.7k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  28.7k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|  28.7k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  28.7k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  28.7k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  28.7k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  28.7k|  permstate.get_buffer = get_buffer; \
  |  |  140|  28.7k|  permstate.bits_left = bits_left
  ------------------
  349|  28.7k|    entropy->saved = state;
  350|  28.7k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  28.7k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 0, False: 28.7k]
  ------------------
  354|      0|    entropy->restarts_to_go--;
  355|       |
  356|  28.7k|  return TRUE;
  ------------------
  |  |  210|  28.7k|#define TRUE    1
  ------------------
  357|  28.7k|}

jinit_d_post_controller:
  267|  1.90k|{
  268|  1.90k|  my_post_ptr post;
  269|       |
  270|  1.90k|#ifdef D_LOSSLESS_SUPPORTED
  271|  1.90k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 336, False: 1.56k]
  ------------------
  272|    336|#if BITS_IN_JSAMPLE == 8
  273|    336|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    672|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (273:9): [True: 0, False: 336]
  |  Branch (273:52): [True: 0, False: 336]
  ------------------
  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|    336|  } else
  280|  1.56k|#endif
  281|  1.56k|  {
  282|  1.56k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (282:9): [True: 0, False: 1.56k]
  ------------------
  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|  1.56k|  }
  285|       |
  286|  1.90k|  post = (my_post_ptr)
  287|  1.90k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.90k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|  1.90k|                                sizeof(my_post_controller));
  289|  1.90k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|  1.90k|  post->pub.start_pass = start_pass_dpost;
  291|  1.90k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|  1.90k|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|  1.90k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 1.90k]
  ------------------
  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|  1.90k|}
jdpostct-8.c:start_pass_dpost:
   85|  1.60k|{
   86|  1.60k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|  1.60k|  switch (pass_mode) {
   89|  1.60k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 1.60k, False: 0]
  ------------------
   90|  1.60k|#if BITS_IN_JSAMPLE != 16
   91|  1.60k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 1.60k]
  ------------------
   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|  1.60k|#endif
  105|  1.60k|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|  1.60k|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  260|  1.60k|#define _post_process_data  post_process_data
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  265|  1.60k|#define _upsample  upsample
  ------------------
  110|  1.60k|    }
  111|  1.60k|    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.60k]
  ------------------
  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: 1.60k]
  ------------------
  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: 1.60k]
  ------------------
  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.60k|  }
  130|  1.60k|  post->starting_row = post->next_row = 0;
  131|  1.60k|}
j12init_d_post_controller:
  267|     78|{
  268|     78|  my_post_ptr post;
  269|       |
  270|     78|#ifdef D_LOSSLESS_SUPPORTED
  271|     78|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 16, False: 62]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|     16|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     32|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (275:9): [True: 0, False: 16]
  ------------------
  276|     16|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (276:9): [True: 0, False: 16]
  ------------------
  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|     16|  } else
  280|     62|#endif
  281|     62|  {
  282|     62|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     62|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (282:9): [True: 0, False: 62]
  ------------------
  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|     62|  }
  285|       |
  286|     78|  post = (my_post_ptr)
  287|     78|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     78|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|     78|                                sizeof(my_post_controller));
  289|     78|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|     78|  post->pub.start_pass = start_pass_dpost;
  291|     78|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|     78|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|     78|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 78]
  ------------------
  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|     78|}
jdpostct-12.c:start_pass_dpost:
   85|     18|{
   86|     18|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|     18|  switch (pass_mode) {
   89|     18|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 18, False: 0]
  ------------------
   90|     18|#if BITS_IN_JSAMPLE != 16
   91|     18|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 18]
  ------------------
   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|     18|#endif
  105|     18|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|     18|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  144|     18|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  149|     18|#define _upsample  upsample_12
  ------------------
  110|     18|    }
  111|     18|    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: 18]
  ------------------
  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: 18]
  ------------------
  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: 18]
  ------------------
  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|     18|  }
  130|     18|  post->starting_row = post->next_row = 0;
  131|     18|}
j16init_d_post_controller:
  267|     16|{
  268|     16|  my_post_ptr post;
  269|       |
  270|     16|#ifdef D_LOSSLESS_SUPPORTED
  271|     16|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 16, False: 0]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|     16|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     32|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (275:9): [True: 0, False: 16]
  ------------------
  276|     16|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     16|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (276:9): [True: 0, False: 16]
  ------------------
  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|     16|  } 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|     16|  post = (my_post_ptr)
  287|     16|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     16|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|     16|                                sizeof(my_post_controller));
  289|     16|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|     16|  post->pub.start_pass = start_pass_dpost;
  291|     16|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|     16|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|     16|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 16]
  ------------------
  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|     16|}
jdpostct-16.c:start_pass_dpost:
   85|      3|{
   86|      3|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|      3|  switch (pass_mode) {
   89|      3|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 3, False: 0]
  ------------------
   90|       |#if BITS_IN_JSAMPLE != 16
   91|       |    if (cinfo->quantize_colors) {
   92|       |      /* Single-pass processing with color quantization. */
   93|       |      post->pub._post_process_data = post_process_1pass;
   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|       |      if (post->buffer == NULL) {
   99|       |        post->buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  100|       |          ((j_common_ptr)cinfo, post->whole_image,
  101|       |           (JDIMENSION)0, post->strip_height, TRUE);
  102|       |      }
  103|       |    } else
  104|       |#endif
  105|      3|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|      3|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |   55|      3|#define _post_process_data  post_process_data_16
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |   57|      3|#define _upsample  upsample_16
  ------------------
  110|      3|    }
  111|      3|    break;
  112|       |#if defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16
  113|       |  case JBUF_SAVE_AND_PASS:
  114|       |    /* First pass of 2-pass quantization */
  115|       |    if (post->whole_image == NULL)
  116|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  117|       |    post->pub._post_process_data = post_process_prepass;
  118|       |    break;
  119|       |  case JBUF_CRANK_DEST:
  120|       |    /* Second pass of 2-pass quantization */
  121|       |    if (post->whole_image == NULL)
  122|       |      ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
  123|       |    post->pub._post_process_data = post_process_2pass;
  124|       |    break;
  125|       |#endif /* defined(QUANT_2PASS_SUPPORTED) && BITS_IN_JSAMPLE != 16 */
  126|      0|  default:
  ------------------
  |  Branch (126:3): [True: 0, False: 3]
  ------------------
  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|      3|  }
  130|      3|  post->starting_row = post->next_row = 0;
  131|      3|}

jinit_upsampler:
  438|  1.90k|{
  439|  1.90k|  my_upsample_ptr upsample;
  440|  1.90k|  int ci;
  441|  1.90k|  jpeg_component_info *compptr;
  442|  1.90k|  boolean need_buffer, do_fancy;
  443|  1.90k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|  1.90k|#ifdef D_LOSSLESS_SUPPORTED
  446|  1.90k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 338, False: 1.56k]
  ------------------
  447|    338|#if BITS_IN_JSAMPLE == 8
  448|    338|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|    676|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 338]
  |  Branch (448:52): [True: 0, False: 338]
  ------------------
  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|    338|  } else
  455|  1.56k|#endif
  456|  1.56k|  {
  457|  1.56k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  1.56k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 1.56k]
  ------------------
  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|  1.56k|  }
  460|       |
  461|  1.90k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 1.90k, False: 0]
  ------------------
  462|  1.90k|    upsample = (my_upsample_ptr)
  463|  1.90k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.90k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  1.90k|                                  sizeof(my_upsampler));
  465|  1.90k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|  1.90k|    upsample->pub.start_pass = start_pass_upsample;
  467|  1.90k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|  1.90k|#define _upsample  upsample
  ------------------
  468|  1.90k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  1.90k|#define FALSE   0               /* values of boolean */
  ------------------
  469|  1.90k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|  1.90k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 1.90k]
  ------------------
  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.90k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  1.90k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 1.90k, False: 0]
  |  Branch (478:44): [True: 1.56k, False: 338]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  3.84k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 1.94k, False: 1.90k]
  ------------------
  484|  1.94k|       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.94k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.94k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  1.94k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.94k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  1.94k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.94k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  1.94k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.94k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  1.94k|    h_out_group = cinfo->max_h_samp_factor;
  493|  1.94k|    v_out_group = cinfo->max_v_samp_factor;
  494|  1.94k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  1.94k|    need_buffer = TRUE;
  ------------------
  |  |  210|  1.94k|#define TRUE    1
  ------------------
  496|  1.94k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 1.94k]
  ------------------
  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.94k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 1.90k, False: 38]
  |  Branch (500:45): [True: 1.89k, False: 12]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|  1.89k|      upsample->methods[ci] = fullsize_upsample;
  503|  1.89k|      need_buffer = FALSE;
  ------------------
  |  |  207|  1.89k|#define FALSE   0               /* values of boolean */
  ------------------
  504|  1.89k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 25, False: 25]
  |  Branch (504:49): [True: 12, False: 13]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|     12|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 7, False: 5]
  |  Branch (506:23): [True: 3, False: 4]
  ------------------
  507|      3|#ifdef WITH_SIMD
  508|      3|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 0, False: 3]
  ------------------
  509|      0|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|      3|        else
  511|      3|#endif
  512|      3|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      9|      } else {
  514|      9|#ifdef WITH_SIMD
  515|      9|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 0, False: 9]
  ------------------
  516|      0|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|      9|        else
  518|      9|#endif
  519|      9|          upsample->methods[ci] = h2v1_upsample;
  520|      9|      }
  521|     38|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 12, False: 26]
  ------------------
  522|     12|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 7, False: 5]
  |  Branch (522:49): [True: 3, False: 4]
  ------------------
  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|      3|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      3|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  531|     35|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 13, False: 22]
  ------------------
  532|     13|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 10, False: 3]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|     10|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 6, False: 4]
  |  Branch (534:23): [True: 3, False: 3]
  ------------------
  535|      3|#ifdef WITH_SIMD
  536|      3|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 0, False: 3]
  ------------------
  537|      0|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|      3|        else
  539|      3|#endif
  540|      3|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|      3|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  542|      7|      } else {
  543|      7|#ifdef WITH_SIMD
  544|      7|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 0, False: 7]
  ------------------
  545|      0|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|      7|        else
  547|      7|#endif
  548|      7|          upsample->methods[ci] = h2v2_upsample;
  549|      7|      }
  550|     25|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 24, False: 1]
  ------------------
  551|     24|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 23, False: 1]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|     23|      upsample->methods[ci] = int_upsample;
  554|     23|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|     23|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|     23|    } else
  557|      2|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      2|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|  1.94k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 48, False: 1.89k]
  |  Branch (558:24): [True: 48, False: 0]
  ------------------
  559|     48|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|     48|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|     48|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|     48|                               (long)cinfo->max_h_samp_factor),
  563|     48|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|     48|    }
  565|  1.94k|  }
  566|  1.90k|}
jdsample-8.c:start_pass_upsample:
   47|  1.60k|{
   48|  1.60k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  1.60k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  1.60k|  upsample->rows_to_go = cinfo->output_height;
   54|  1.60k|}
jdsample-8.c:sep_upsample:
   70|   397k|{
   71|   397k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|   397k|  int ci;
   73|   397k|  jpeg_component_info *compptr;
   74|   397k|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|   397k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 207k, False: 190k]
  ------------------
   78|   414k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 207k, False: 207k]
  ------------------
   79|   207k|         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|   207k|      (*upsample->methods[ci]) (cinfo, compptr,
   87|   207k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|   207k|        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|   207k|    }
   95|   207k|    upsample->next_row_out = 0;
   96|   207k|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|   397k|  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|   397k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 801, False: 396k]
  ------------------
  106|    801|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|   397k|  out_rows_avail -= *out_row_ctr;
  109|   397k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 190k, False: 207k]
  ------------------
  110|   190k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|   397k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|   397k|#define _color_convert  color_convert
  ------------------
  116|   397k|                                      (JDIMENSION)upsample->next_row_out,
  117|   397k|                                      output_buf + *out_row_ctr,
  118|   397k|                                      (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|   397k|  *out_row_ctr += num_rows;
  127|   397k|  upsample->rows_to_go -= num_rows;
  128|   397k|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|   397k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 206k, False: 190k]
  ------------------
  131|   206k|    (*in_row_group_ctr)++;
  132|   397k|}
jdsample-8.c:fullsize_upsample:
  151|   207k|{
  152|   207k|  *output_data_ptr = input_data;
  153|   207k|}
j12init_upsampler:
  438|     81|{
  439|     81|  my_upsample_ptr upsample;
  440|     81|  int ci;
  441|     81|  jpeg_component_info *compptr;
  442|     81|  boolean need_buffer, do_fancy;
  443|     81|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|     81|#ifdef D_LOSSLESS_SUPPORTED
  446|     81|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 17, False: 64]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|     17|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     34|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 17]
  ------------------
  451|     17|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     17|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 17]
  ------------------
  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|     17|  } else
  455|     64|#endif
  456|     64|  {
  457|     64|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|     64|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 64]
  ------------------
  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|     64|  }
  460|       |
  461|     81|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 81, False: 0]
  ------------------
  462|     81|    upsample = (my_upsample_ptr)
  463|     81|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     81|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|     81|                                  sizeof(my_upsampler));
  465|     81|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|     81|    upsample->pub.start_pass = start_pass_upsample;
  467|     81|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|     81|#define _upsample  upsample_12
  ------------------
  468|     81|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|     81|#define FALSE   0               /* values of boolean */
  ------------------
  469|     81|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|     81|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 81]
  ------------------
  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|     81|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|     81|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 81, False: 0]
  |  Branch (478:44): [True: 64, False: 17]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|    203|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 122, False: 81]
  ------------------
  484|    122|       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|    122|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    122|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|    122|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    122|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|    122|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    122|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|    122|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    122|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|    122|    h_out_group = cinfo->max_h_samp_factor;
  493|    122|    v_out_group = cinfo->max_v_samp_factor;
  494|    122|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|    122|    need_buffer = TRUE;
  ------------------
  |  |  210|    122|#define TRUE    1
  ------------------
  496|    122|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 122]
  ------------------
  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|    122|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 94, False: 28]
  |  Branch (500:45): [True: 78, False: 16]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|     78|      upsample->methods[ci] = fullsize_upsample;
  503|     78|      need_buffer = FALSE;
  ------------------
  |  |  207|     78|#define FALSE   0               /* values of boolean */
  ------------------
  504|     78|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 21, False: 23]
  |  Branch (504:49): [True: 10, False: 11]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|     10|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 7, False: 3]
  |  Branch (506:23): [True: 4, False: 3]
  ------------------
  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|      4|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|      6|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      6|          upsample->methods[ci] = h2v1_upsample;
  520|      6|      }
  521|     34|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 16, False: 18]
  ------------------
  522|     16|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 12, False: 4]
  |  Branch (522:49): [True: 6, False: 6]
  ------------------
  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|      6|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|      6|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      6|#define TRUE    1
  ------------------
  531|     28|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 11, False: 17]
  ------------------
  532|     11|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 10, False: 1]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|     10|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 6, False: 4]
  |  Branch (534:23): [True: 3, False: 3]
  ------------------
  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|      3|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|      3|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|      3|#define TRUE    1
  ------------------
  542|      7|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      7|          upsample->methods[ci] = h2v2_upsample;
  549|      7|      }
  550|     18|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 17, False: 1]
  ------------------
  551|     17|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 15, False: 2]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|     15|      upsample->methods[ci] = int_upsample;
  554|     15|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|     15|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|     15|    } else
  557|      3|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|    122|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 41, False: 81]
  |  Branch (558:24): [True: 41, False: 0]
  ------------------
  559|     41|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|     41|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     41|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|     41|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|     41|                               (long)cinfo->max_h_samp_factor),
  563|     41|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|     41|    }
  565|    122|  }
  566|     81|}
jdsample-12.c:start_pass_upsample:
   47|     18|{
   48|     18|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|     18|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|     18|  upsample->rows_to_go = cinfo->output_height;
   54|     18|}
j16init_upsampler:
  438|     21|{
  439|     21|  my_upsample_ptr upsample;
  440|     21|  int ci;
  441|     21|  jpeg_component_info *compptr;
  442|     21|  boolean need_buffer, do_fancy;
  443|     21|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|     21|#ifdef D_LOSSLESS_SUPPORTED
  446|     21|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 21, False: 0]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|     21|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|     42|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (450:9): [True: 0, False: 21]
  ------------------
  451|     21|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|     21|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (451:9): [True: 0, False: 21]
  ------------------
  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|     21|  } 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|     21|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 21, False: 0]
  ------------------
  462|     21|    upsample = (my_upsample_ptr)
  463|     21|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     21|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|     21|                                  sizeof(my_upsampler));
  465|     21|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|     21|    upsample->pub.start_pass = start_pass_upsample;
  467|     21|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |   57|     21|#define _upsample  upsample_16
  ------------------
  468|     21|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|     21|#define FALSE   0               /* values of boolean */
  ------------------
  469|     21|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|     21|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 21]
  ------------------
  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|     21|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|     21|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 21, False: 0]
  |  Branch (478:44): [True: 0, False: 21]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|     65|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 44, False: 21]
  ------------------
  484|     44|       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|     44|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     44|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|     44|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     44|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|     44|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|     44|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|     44|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     44|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|     44|    h_out_group = cinfo->max_h_samp_factor;
  493|     44|    v_out_group = cinfo->max_v_samp_factor;
  494|     44|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|     44|    need_buffer = TRUE;
  ------------------
  |  |  210|     44|#define TRUE    1
  ------------------
  496|     44|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 44]
  ------------------
  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|     44|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 27, False: 17]
  |  Branch (500:45): [True: 18, False: 9]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|     18|      upsample->methods[ci] = fullsize_upsample;
  503|     18|      need_buffer = FALSE;
  ------------------
  |  |  207|     18|#define FALSE   0               /* values of boolean */
  ------------------
  504|     26|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 10, False: 16]
  |  Branch (504:49): [True: 5, False: 5]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|      5|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 5]
  |  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|      5|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|      5|          upsample->methods[ci] = h2v1_upsample;
  520|      5|      }
  521|     21|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 9, False: 12]
  ------------------
  522|      9|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 4, False: 5]
  |  Branch (522:49): [True: 0, False: 4]
  ------------------
  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|     21|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 5, False: 16]
  ------------------
  532|      5|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 3, False: 2]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|      3|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 3]
  |  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|      3|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|      3|          upsample->methods[ci] = h2v2_upsample;
  549|      3|      }
  550|     18|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 15, False: 3]
  ------------------
  551|     15|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 13, False: 2]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|     13|      upsample->methods[ci] = int_upsample;
  554|     13|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|     13|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|     13|    } else
  557|      5|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      5|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      5|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|     44|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 21, False: 23]
  |  Branch (558:24): [True: 21, False: 0]
  ------------------
  559|     21|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|     21|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     21|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|     21|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|     21|                               (long)cinfo->max_h_samp_factor),
  563|     21|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|     21|    }
  565|     44|  }
  566|     21|}
jdsample-16.c:start_pass_upsample:
   47|      3|{
   48|      3|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|      3|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|      3|  upsample->rows_to_go = cinfo->output_height;
   54|      3|}

jpeg_std_error:
  229|  5.23k|{
  230|  5.23k|  memset(err, 0, sizeof(struct jpeg_error_mgr));
  231|       |
  232|  5.23k|  err->error_exit = error_exit;
  233|  5.23k|  err->emit_message = emit_message;
  234|  5.23k|  err->output_message = output_message;
  235|  5.23k|  err->format_message = format_message;
  236|  5.23k|  err->reset_error_mgr = reset_error_mgr;
  237|       |
  238|       |  /* Initialize message table pointers */
  239|  5.23k|  err->jpeg_message_table = jpeg_std_message_table;
  240|  5.23k|  err->last_jpeg_message = (int)JMSG_LASTMSGCODE - 1;
  241|       |
  242|  5.23k|  return err;
  243|  5.23k|}
jerror.c:format_message:
  155|    469|{
  156|    469|  struct jpeg_error_mgr *err = cinfo->err;
  157|    469|  int msg_code = err->msg_code;
  158|    469|  const char *msgtext = NULL;
  159|    469|  const char *msgptr;
  160|    469|  char ch;
  161|    469|  boolean isstring;
  162|       |
  163|       |  /* Look up message string in proper table */
  164|    469|  if (msg_code > 0 && msg_code <= err->last_jpeg_message) {
  ------------------
  |  Branch (164:7): [True: 469, False: 0]
  |  Branch (164:23): [True: 469, False: 0]
  ------------------
  165|    469|    msgtext = err->jpeg_message_table[msg_code];
  166|    469|  } 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|    469|  if (msgtext == NULL) {
  ------------------
  |  Branch (173:7): [True: 0, False: 469]
  ------------------
  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|    469|  isstring = FALSE;
  ------------------
  |  |  207|    469|#define FALSE   0               /* values of boolean */
  ------------------
  180|    469|  msgptr = msgtext;
  181|  13.4k|  while ((ch = *msgptr++) != '\0') {
  ------------------
  |  Branch (181:10): [True: 13.3k, False: 149]
  ------------------
  182|  13.3k|    if (ch == '%') {
  ------------------
  |  Branch (182:9): [True: 320, False: 13.0k]
  ------------------
  183|    320|      if (*msgptr == 's') isstring = TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (183:11): [True: 0, False: 320]
  ------------------
  184|    320|      break;
  185|    320|    }
  186|  13.3k|  }
  187|       |
  188|       |  /* Format the message into the passed buffer */
  189|    469|  if (isstring)
  ------------------
  |  Branch (189:7): [True: 0, False: 469]
  ------------------
  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|    469|  else
  192|    469|    SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |   55|    469|#define SNPRINTF  snprintf
  ------------------
                  SNPRINTF(buffer, JMSG_LENGTH_MAX, msgtext,
  ------------------
  |  |  792|    469|#define JMSG_LENGTH_MAX  200    /* recommended size of format_message buffer */
  ------------------
  193|    469|             err->msg_parm.i[0], err->msg_parm.i[1],
  194|    469|             err->msg_parm.i[2], err->msg_parm.i[3],
  195|    469|             err->msg_parm.i[4], err->msg_parm.i[5],
  196|    469|             err->msg_parm.i[6], err->msg_parm.i[7]);
  197|    469|}
jerror.c:reset_error_mgr:
  210|  2.61k|{
  211|  2.61k|  cinfo->err->num_warnings = 0;
  212|       |  /* trace_level is not reset since it is an application-supplied parameter */
  213|  2.61k|  cinfo->err->msg_code = 0;     /* may be useful as a flag for "no error" */
  214|  2.61k|}

jpeg_idct_islow:
  198|  1.96M|{
  199|  1.96M|  JLONG tmp0, tmp1, tmp2, tmp3;
  200|  1.96M|  JLONG tmp10, tmp11, tmp12, tmp13;
  201|  1.96M|  JLONG z1, z2, z3, z4, z5;
  202|  1.96M|  JCOEFPTR inptr;
  203|  1.96M|  ISLOW_MULT_TYPE *quantptr;
  204|  1.96M|  int *wsptr;
  205|  1.96M|  _JSAMPROW outptr;
  ------------------
  |  |  229|  1.96M|#define _JSAMPROW  JSAMPROW
  ------------------
  206|  1.96M|  _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |  224|  1.96M|#define _JSAMPLE  JSAMPLE
  ------------------
                _JSAMPLE *range_limit = IDCT_range_limit(cinfo);
  ------------------
  |  |   95|  1.96M|  ((_JSAMPLE *)((cinfo)->sample_range_limit) + _CENTERJSAMPLE)
  |  |  ------------------
  |  |  |  |  227|  1.96M|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|  1.96M|#define CENTERJSAMPLE    128
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  207|  1.96M|  int ctr;
  208|  1.96M|  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|  1.96M|  inptr = coef_block;
  217|  1.96M|  quantptr = (ISLOW_MULT_TYPE *)compptr->dct_table;
  218|  1.96M|  wsptr = workspace;
  219|  17.6M|  for (ctr = DCTSIZE; ctr > 0; ctr--) {
  ------------------
  |  |   66|  1.96M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (219:23): [True: 15.7M, False: 1.96M]
  ------------------
  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|  15.7M|    if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  15.7M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  if (inptr[DCTSIZE * 1] == 0 && inptr[DCTSIZE * 2] == 0 &&
  ------------------
  |  |   66|  13.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (229:9): [True: 13.6M, False: 2.04M]
  |  Branch (229:36): [True: 13.4M, False: 203k]
  ------------------
  230|  13.4M|        inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  13.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 3] == 0 && inptr[DCTSIZE * 4] == 0 &&
  ------------------
  |  |   66|  13.4M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (230:9): [True: 13.4M, False: 64.4k]
  |  Branch (230:36): [True: 13.3M, False: 35.3k]
  ------------------
  231|  13.3M|        inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                      inptr[DCTSIZE * 5] == 0 && inptr[DCTSIZE * 6] == 0 &&
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (231:9): [True: 13.3M, False: 18.3k]
  |  Branch (231:36): [True: 13.3M, False: 14.5k]
  ------------------
  232|  13.3M|        inptr[DCTSIZE * 7] == 0) {
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (232:9): [True: 13.3M, False: 16.4k]
  ------------------
  233|       |      /* AC terms all zero */
  234|  13.3M|      int dcval = LEFT_SHIFT(DEQUANTIZE(inptr[DCTSIZE * 0],
  ------------------
  |  |   85|  13.3M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  235|  13.3M|                             quantptr[DCTSIZE * 0]), PASS1_BITS);
  236|       |
  237|  13.3M|      wsptr[DCTSIZE * 0] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  238|  13.3M|      wsptr[DCTSIZE * 1] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  239|  13.3M|      wsptr[DCTSIZE * 2] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  240|  13.3M|      wsptr[DCTSIZE * 3] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  241|  13.3M|      wsptr[DCTSIZE * 4] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  242|  13.3M|      wsptr[DCTSIZE * 5] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  243|  13.3M|      wsptr[DCTSIZE * 6] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  244|  13.3M|      wsptr[DCTSIZE * 7] = dcval;
  ------------------
  |  |   66|  13.3M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  245|       |
  246|  13.3M|      inptr++;                  /* advance pointers to next column */
  247|  13.3M|      quantptr++;
  248|  13.3M|      wsptr++;
  249|  13.3M|      continue;
  250|  13.3M|    }
  251|       |
  252|       |    /* Even part: reverse the even part of the forward DCT. */
  253|       |    /* The rotator is sqrt(2)*c(-6). */
  254|       |
  255|  2.39M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 2], quantptr[DCTSIZE * 2]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  256|  2.39M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 6], quantptr[DCTSIZE * 6]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  257|       |
  258|  2.39M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  259|  2.39M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  260|  2.39M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  261|       |
  262|  2.39M|    z2 = DEQUANTIZE(inptr[DCTSIZE * 0], quantptr[DCTSIZE * 0]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  263|  2.39M|    z3 = DEQUANTIZE(inptr[DCTSIZE * 4], quantptr[DCTSIZE * 4]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  264|       |
  265|  2.39M|    tmp0 = LEFT_SHIFT(z2 + z3, CONST_BITS);
  ------------------
  |  |   85|  2.39M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  266|  2.39M|    tmp1 = LEFT_SHIFT(z2 - z3, CONST_BITS);
  ------------------
  |  |   85|  2.39M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  267|       |
  268|  2.39M|    tmp10 = tmp0 + tmp3;
  269|  2.39M|    tmp13 = tmp0 - tmp3;
  270|  2.39M|    tmp11 = tmp1 + tmp2;
  271|  2.39M|    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|  2.39M|    tmp0 = DEQUANTIZE(inptr[DCTSIZE * 7], quantptr[DCTSIZE * 7]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  278|  2.39M|    tmp1 = DEQUANTIZE(inptr[DCTSIZE * 5], quantptr[DCTSIZE * 5]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  279|  2.39M|    tmp2 = DEQUANTIZE(inptr[DCTSIZE * 3], quantptr[DCTSIZE * 3]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  280|  2.39M|    tmp3 = DEQUANTIZE(inptr[DCTSIZE * 1], quantptr[DCTSIZE * 1]);
  ------------------
  |  |  183|  2.39M|#define DEQUANTIZE(coef, quantval)  (((ISLOW_MULT_TYPE)(coef)) * (quantval))
  ------------------
  281|       |
  282|  2.39M|    z1 = tmp0 + tmp3;
  283|  2.39M|    z2 = tmp1 + tmp2;
  284|  2.39M|    z3 = tmp0 + tmp2;
  285|  2.39M|    z4 = tmp1 + tmp3;
  286|  2.39M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  287|       |
  288|  2.39M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  289|  2.39M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  290|  2.39M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  291|  2.39M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  292|  2.39M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  293|  2.39M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  294|  2.39M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  295|  2.39M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|  2.39M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  2.39M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  296|       |
  297|  2.39M|    z3 += z5;
  298|  2.39M|    z4 += z5;
  299|       |
  300|  2.39M|    tmp0 += z1 + z3;
  301|  2.39M|    tmp1 += z2 + z4;
  302|  2.39M|    tmp2 += z2 + z3;
  303|  2.39M|    tmp3 += z1 + z4;
  304|       |
  305|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  306|       |
  307|  2.39M|    wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 0] = (int)DESCALE(tmp10 + tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  308|  2.39M|    wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 7] = (int)DESCALE(tmp10 - tmp3, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  309|  2.39M|    wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 1] = (int)DESCALE(tmp11 + tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  310|  2.39M|    wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 6] = (int)DESCALE(tmp11 - tmp2, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  311|  2.39M|    wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 2] = (int)DESCALE(tmp12 + tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  312|  2.39M|    wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 5] = (int)DESCALE(tmp12 - tmp1, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  313|  2.39M|    wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 3] = (int)DESCALE(tmp13 + tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  314|  2.39M|    wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |   66|  2.39M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
                  wsptr[DCTSIZE * 4] = (int)DESCALE(tmp13 - tmp0, CONST_BITS - PASS1_BITS);
  ------------------
  |  |  216|  2.39M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  2.39M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  315|       |
  316|  2.39M|    inptr++;                    /* advance pointers to next column */
  317|  2.39M|    quantptr++;
  318|  2.39M|    wsptr++;
  319|  2.39M|  }
  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|  1.96M|  wsptr = workspace;
  326|  17.6M|  for (ctr = 0; ctr < DCTSIZE; ctr++) {
  ------------------
  |  |   66|  17.6M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (326:17): [True: 15.7M, False: 1.96M]
  ------------------
  327|  15.7M|    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|  15.7M|#ifndef NO_ZERO_ROW_TEST
  337|  15.7M|    if (wsptr[1] == 0 && wsptr[2] == 0 && wsptr[3] == 0 && wsptr[4] == 0 &&
  ------------------
  |  Branch (337:9): [True: 7.04M, False: 8.68M]
  |  Branch (337:26): [True: 6.46M, False: 585k]
  |  Branch (337:43): [True: 6.28M, False: 175k]
  |  Branch (337:60): [True: 6.24M, False: 43.8k]
  ------------------
  338|  6.24M|        wsptr[5] == 0 && wsptr[6] == 0 && wsptr[7] == 0) {
  ------------------
  |  Branch (338:9): [True: 6.22M, False: 19.5k]
  |  Branch (338:26): [True: 6.22M, False: 527]
  |  Branch (338:43): [True: 6.22M, False: 544]
  ------------------
  339|       |      /* AC terms all zero */
  340|  6.22M|      _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  224|  6.22M|#define _JSAMPLE  JSAMPLE
  ------------------
                    _JSAMPLE dcval = range_limit[(int)DESCALE((JLONG)wsptr[0],
  ------------------
  |  |  216|  6.22M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  6.22M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  341|  6.22M|                                                PASS1_BITS + 3) & RANGE_MASK];
  ------------------
  |  |   97|  6.22M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  6.22M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  6.22M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  342|       |
  343|  6.22M|      outptr[0] = dcval;
  344|  6.22M|      outptr[1] = dcval;
  345|  6.22M|      outptr[2] = dcval;
  346|  6.22M|      outptr[3] = dcval;
  347|  6.22M|      outptr[4] = dcval;
  348|  6.22M|      outptr[5] = dcval;
  349|  6.22M|      outptr[6] = dcval;
  350|  6.22M|      outptr[7] = dcval;
  351|       |
  352|  6.22M|      wsptr += DCTSIZE;         /* advance pointer to next row */
  ------------------
  |  |   66|  6.22M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  353|  6.22M|      continue;
  354|  6.22M|    }
  355|  9.50M|#endif
  356|       |
  357|       |    /* Even part: reverse the even part of the forward DCT. */
  358|       |    /* The rotator is sqrt(2)*c(-6). */
  359|       |
  360|  9.50M|    z2 = (JLONG)wsptr[2];
  361|  9.50M|    z3 = (JLONG)wsptr[6];
  362|       |
  363|  9.50M|    z1 = MULTIPLY(z2 + z3, FIX_0_541196100);
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  364|  9.50M|    tmp2 = z1 + MULTIPLY(z3, -FIX_1_847759065);
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  365|  9.50M|    tmp3 = z1 + MULTIPLY(z2, FIX_0_765366865);
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  366|       |
  367|  9.50M|    tmp0 = LEFT_SHIFT((JLONG)wsptr[0] + (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  9.50M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  368|  9.50M|    tmp1 = LEFT_SHIFT((JLONG)wsptr[0] - (JLONG)wsptr[4], CONST_BITS);
  ------------------
  |  |   85|  9.50M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  369|       |
  370|  9.50M|    tmp10 = tmp0 + tmp3;
  371|  9.50M|    tmp13 = tmp0 - tmp3;
  372|  9.50M|    tmp11 = tmp1 + tmp2;
  373|  9.50M|    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|  9.50M|    tmp0 = (JLONG)wsptr[7];
  380|  9.50M|    tmp1 = (JLONG)wsptr[5];
  381|  9.50M|    tmp2 = (JLONG)wsptr[3];
  382|  9.50M|    tmp3 = (JLONG)wsptr[1];
  383|       |
  384|  9.50M|    z1 = tmp0 + tmp3;
  385|  9.50M|    z2 = tmp1 + tmp2;
  386|  9.50M|    z3 = tmp0 + tmp2;
  387|  9.50M|    z4 = tmp1 + tmp3;
  388|  9.50M|    z5 = MULTIPLY(z3 + z4, FIX_1_175875602); /* sqrt(2) * c3 */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  389|       |
  390|  9.50M|    tmp0 = MULTIPLY(tmp0, FIX_0_298631336); /* sqrt(2) * (-c1+c3+c5-c7) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  391|  9.50M|    tmp1 = MULTIPLY(tmp1, FIX_2_053119869); /* sqrt(2) * ( c1+c3-c5+c7) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  392|  9.50M|    tmp2 = MULTIPLY(tmp2, FIX_3_072711026); /* sqrt(2) * ( c1+c3+c5-c7) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  393|  9.50M|    tmp3 = MULTIPLY(tmp3, FIX_1_501321110); /* sqrt(2) * ( c1+c3-c5-c7) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  394|  9.50M|    z1 = MULTIPLY(z1, -FIX_0_899976223); /* sqrt(2) * ( c7-c3) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  395|  9.50M|    z2 = MULTIPLY(z2, -FIX_2_562915447); /* sqrt(2) * (-c1-c3) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  396|  9.50M|    z3 = MULTIPLY(z3, -FIX_1_961570560); /* sqrt(2) * (-c3-c5) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  397|  9.50M|    z4 = MULTIPLY(z4, -FIX_0_390180644); /* sqrt(2) * ( c5-c3) */
  ------------------
  |  |  154|  9.50M|#define MULTIPLY(var, const)  MULTIPLY16C16(var, const)
  |  |  ------------------
  |  |  |  |  235|  9.50M|#define MULTIPLY16C16(var, const)  ((var) * (const))
  |  |  ------------------
  ------------------
  398|       |
  399|  9.50M|    z3 += z5;
  400|  9.50M|    z4 += z5;
  401|       |
  402|  9.50M|    tmp0 += z1 + z3;
  403|  9.50M|    tmp1 += z2 + z4;
  404|  9.50M|    tmp2 += z2 + z3;
  405|  9.50M|    tmp3 += z1 + z4;
  406|       |
  407|       |    /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */
  408|       |
  409|  9.50M|    outptr[0] = range_limit[(int)DESCALE(tmp10 + tmp3,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  410|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  411|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  412|  9.50M|    outptr[7] = range_limit[(int)DESCALE(tmp10 - tmp3,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  413|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  414|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  415|  9.50M|    outptr[1] = range_limit[(int)DESCALE(tmp11 + tmp2,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  416|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  417|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  418|  9.50M|    outptr[6] = range_limit[(int)DESCALE(tmp11 - tmp2,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  419|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  420|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  421|  9.50M|    outptr[2] = range_limit[(int)DESCALE(tmp12 + tmp1,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  422|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  423|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  424|  9.50M|    outptr[5] = range_limit[(int)DESCALE(tmp12 - tmp1,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  425|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  426|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  427|  9.50M|    outptr[3] = range_limit[(int)DESCALE(tmp13 + tmp0,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  428|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  429|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  430|  9.50M|    outptr[4] = range_limit[(int)DESCALE(tmp13 - tmp0,
  ------------------
  |  |  216|  9.50M|#define DESCALE(x, n)  RIGHT_SHIFT((x) + (ONE << ((n) - 1)), n)
  |  |  ------------------
  |  |  |  |  542|  9.50M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  |  |  ------------------
  ------------------
  431|  9.50M|                                         CONST_BITS + PASS1_BITS + 3) &
  432|  9.50M|                            RANGE_MASK];
  ------------------
  |  |   97|  9.50M|#define RANGE_MASK  (_MAXJSAMPLE * 4 + 3) /* 2 bits wider than legal samples */
  |  |  ------------------
  |  |  |  |  226|  9.50M|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  |  |  ------------------
  |  |  |  |  |  |   52|  9.50M|#define MAXJSAMPLE       255
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|       |
  434|  9.50M|    wsptr += DCTSIZE;           /* advance pointer to next row */
  ------------------
  |  |   66|  9.50M|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  435|  9.50M|  }
  436|  1.96M|}

jmemmgr.c:GETENV_S:
   80|  2.61k|{
   81|  2.61k|  char *env;
   82|       |
   83|  2.61k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 2.61k]
  ------------------
   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|  2.61k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 2.61k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  2.61k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 2.61k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  2.61k|  env = getenv(name);
   97|  2.61k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 2.61k, False: 0]
  ------------------
   98|  2.61k|  {
   99|  2.61k|    *buffer = 0;
  100|  2.61k|    return 0;
  101|  2.61k|  }
  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|  3.90k|{
   81|  3.90k|  char *env;
   82|       |
   83|  3.90k|  if (!buffer) {
  ------------------
  |  Branch (83:7): [True: 0, False: 3.90k]
  ------------------
   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|  3.90k|  if (buffer_size == 0)
  ------------------
  |  Branch (89:7): [True: 0, False: 3.90k]
  ------------------
   90|      0|    return (errno = EINVAL);
   91|  3.90k|  if (!name) {
  ------------------
  |  Branch (91:7): [True: 0, False: 3.90k]
  ------------------
   92|      0|    *buffer = 0;
   93|      0|    return 0;
   94|      0|  }
   95|       |
   96|  3.90k|  env = getenv(name);
   97|  3.90k|  if (!env)
  ------------------
  |  Branch (97:7): [True: 2.60k, False: 1.30k]
  ------------------
   98|  2.60k|  {
   99|  2.60k|    *buffer = 0;
  100|  2.60k|    return 0;
  101|  2.60k|  }
  102|       |
  103|  1.30k|  if (strlen(env) + 1 > buffer_size) {
  ------------------
  |  Branch (103:7): [True: 0, False: 1.30k]
  ------------------
  104|      0|    *buffer = 0;
  105|      0|    return ERANGE;
  106|      0|  }
  107|       |
  108|  1.30k|  strncpy(buffer, env, buffer_size);
  109|       |
  110|  1.30k|  return 0;
  111|  1.30k|}

jinit_memory_mgr:
 1196|  2.61k|{
 1197|  2.61k|  my_mem_ptr mem;
 1198|  2.61k|  long max_to_use;
 1199|  2.61k|  int pool;
 1200|  2.61k|  size_t test_mac;
 1201|       |
 1202|  2.61k|  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|  2.61k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.61k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  2.61k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 2.61k]
  ------------------
 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|  2.61k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.61k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  2.61k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  5.23k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 2.61k]
  ------------------
 1220|  2.61k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  2.61k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  2.61k|#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|  2.61k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  2.61k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  2.61k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 2.61k]
  ------------------
 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|  2.61k|  mem->pub.alloc_small = alloc_small;
 1235|  2.61k|  mem->pub.alloc_large = alloc_large;
 1236|  2.61k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  2.61k|  mem->pub.alloc_barray = alloc_barray;
 1238|  2.61k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  2.61k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  2.61k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  2.61k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  2.61k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  2.61k|  mem->pub.free_pool = free_pool;
 1244|  2.61k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  2.61k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  2.61k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  2.61k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|  7.85k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  2.61k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  7.85k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 5.23k, False: 2.61k]
  ------------------
 1253|  5.23k|    mem->small_list[pool] = NULL;
 1254|  5.23k|    mem->large_list[pool] = NULL;
 1255|  5.23k|  }
 1256|  2.61k|  mem->virt_sarray_list = NULL;
 1257|  2.61k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  2.61k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  2.61k|  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|  2.61k|#ifndef NO_GETENV
 1271|  2.61k|  {
 1272|  2.61k|    char memenv[30] = { 0 };
 1273|       |
 1274|  2.61k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 2.61k, False: 0]
  |  Branch (1274:45): [True: 0, False: 2.61k]
  ------------------
 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|  2.61k|  }
 1288|  2.61k|#endif
 1289|       |
 1290|  2.61k|}
jmemmgr.c:alloc_small:
  269|  52.3k|{
  270|  52.3k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|  52.3k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|  52.3k|  char *data_ptr;
  273|  52.3k|  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|  52.3k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  52.3k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 52.3k]
  ------------------
  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|  52.3k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  52.3k|#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|  52.3k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  52.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 52.3k]
  ------------------
  290|  52.3k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  52.3k|#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|  52.3k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  52.3k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 52.3k]
  |  Branch (294:22): [True: 0, False: 52.3k]
  ------------------
  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|  52.3k|  prev_hdr_ptr = NULL;
  297|  52.3k|  hdr_ptr = mem->small_list[pool_id];
  298|  53.2k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 47.8k, False: 5.47k]
  ------------------
  299|  47.8k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 46.8k, False: 953]
  ------------------
  300|  46.8k|      break;                    /* found pool with enough space */
  301|    953|    prev_hdr_ptr = hdr_ptr;
  302|    953|    hdr_ptr = hdr_ptr->next;
  303|    953|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|  52.3k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 5.47k, False: 46.8k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|  5.47k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  5.47k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|  5.47k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 4.73k, False: 741]
  ------------------
  310|  4.73k|      slop = first_pool_slop[pool_id];
  311|    741|    else
  312|    741|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|  5.47k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  5.47k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 5.47k]
  ------------------
  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|  5.47k|    for (;;) {
  318|  5.47k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|  5.47k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 5.47k, False: 0]
  ------------------
  320|  5.47k|        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|  5.47k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|  5.47k|    hdr_ptr->next = NULL;
  328|  5.47k|    hdr_ptr->bytes_used = 0;
  329|  5.47k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|  5.47k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 4.73k, False: 741]
  ------------------
  331|  4.73k|      mem->small_list[pool_id] = hdr_ptr;
  332|    741|    else
  333|    741|      prev_hdr_ptr->next = hdr_ptr;
  334|  5.47k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|  52.3k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|  52.3k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|  52.3k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  52.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 52.3k, False: 0]
  ------------------
  340|  52.3k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  52.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  52.3k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|  52.3k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|  52.3k|  hdr_ptr->bytes_used += sizeofobject;
  343|  52.3k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|  52.3k|  return (void *)data_ptr;
  346|  52.3k|}
jmemmgr.c:round_up_pow2:
   45|  64.0k|{
   46|  64.0k|  return ((a + b - 1) & (~(b - 1)));
   47|  64.0k|}
jmemmgr.c:alloc_large:
  366|  6.68k|{
  367|  6.68k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|  6.68k|  large_pool_ptr hdr_ptr;
  369|  6.68k|  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|  6.68k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  6.68k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 6.68k]
  ------------------
  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|  6.68k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  6.68k|#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|  6.68k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  6.68k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 6.68k]
  ------------------
  385|  6.68k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  6.68k|#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|  6.68k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  6.68k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 6.68k]
  |  Branch (389:22): [True: 0, False: 6.68k]
  ------------------
  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|  6.68k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|  6.68k|                                           sizeof(large_pool_hdr) +
  394|  6.68k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|  6.68k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|  6.68k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 6.68k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|  6.68k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|  6.68k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|  6.68k|#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|  6.68k|  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|  6.68k|  hdr_ptr->bytes_used = sizeofobject;
  406|  6.68k|  hdr_ptr->bytes_left = 0;
  407|  6.68k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|  6.68k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|  6.68k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|  6.68k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  6.68k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 6.68k, False: 0]
  ------------------
  412|  6.68k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  6.68k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  6.68k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|  6.68k|  return (void *)data_ptr;
  415|  6.68k|}
jmemmgr.c:alloc_sarray:
  438|  5.00k|{
  439|  5.00k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|  5.00k|  JSAMPARRAY result;
  441|  5.00k|  JSAMPROW workspace;
  442|  5.00k|  JDIMENSION rowsperchunk, currow, i;
  443|  5.00k|  long ltemp;
  444|  5.00k|  J12SAMPARRAY result12;
  445|  5.00k|  J12SAMPROW workspace12;
  446|  5.00k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|  5.00k|  J16SAMPARRAY result16;
  448|  5.00k|  J16SAMPROW workspace16;
  449|  5.00k|#endif
  450|  5.00k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 5.00k, False: 0]
  ------------------
  451|  5.00k|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|  5.00k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|  5.00k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 138, False: 4.87k]
  ------------------
  454|  4.87k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 296, False: 4.57k]
  ------------------
  455|    296|                                            sizeof(J12SAMPLE) :
  456|  4.87k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|  5.00k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|  5.00k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 5.00k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|  5.00k|  if (samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  5.00k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 5.00k]
  ------------------
  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|  5.00k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  5.00k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|  5.00k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|  5.00k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  5.00k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|  5.00k|          ((long)samplesperrow * (long)sample_size);
  473|  5.00k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 5.00k]
  ------------------
  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|  5.00k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 5.00k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|  5.00k|  else
  478|  5.00k|    rowsperchunk = numrows;
  479|  5.00k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|  5.00k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 4.57k, False: 434]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|  4.57k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|  4.57k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|  4.57k|    currow = 0;
  488|  9.14k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 4.57k, False: 4.57k]
  ------------------
  489|  4.57k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  4.57k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 4.57k]
  |  |  ------------------
  ------------------
  490|  4.57k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|  4.57k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  37.0k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 32.4k, False: 4.57k]
  ------------------
  493|  32.4k|        result[currow++] = workspace;
  494|  32.4k|        workspace += samplesperrow;
  495|  32.4k|      }
  496|  4.57k|    }
  497|       |
  498|  4.57k|    return result;
  499|  4.57k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 296, False: 138]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|    296|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|    296|                                         (size_t)(numrows *
  503|    296|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|    296|    currow = 0;
  507|    592|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 296, False: 296]
  ------------------
  508|    296|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    296|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 296]
  |  |  ------------------
  ------------------
  509|    296|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|    296|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|  4.03k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 3.73k, False: 296]
  ------------------
  512|  3.73k|        result12[currow++] = workspace12;
  513|  3.73k|        workspace12 += samplesperrow;
  514|  3.73k|      }
  515|    296|    }
  516|       |
  517|    296|    return (JSAMPARRAY)result12;
  518|    296|  } else {
  519|    138|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|    138|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|    138|                                         (size_t)(numrows *
  523|    138|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|    138|    currow = 0;
  527|    276|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 138, False: 138]
  ------------------
  528|    138|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    138|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 138]
  |  |  ------------------
  ------------------
  529|    138|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|    138|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|  3.53k|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 3.39k, False: 138]
  ------------------
  532|  3.39k|        result16[currow++] = workspace16;
  533|  3.39k|        workspace16 += samplesperrow;
  534|  3.39k|      }
  535|    138|    }
  536|       |
  537|    138|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|    138|  }
  543|  5.00k|}
jmemmgr.c:alloc_barray:
  555|    909|{
  556|    909|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|    909|  JBLOCKARRAY result;
  558|    909|  JBLOCKROW workspace;
  559|    909|  JDIMENSION rowsperchunk, currow, i;
  560|    909|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|    909|  if ((sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|    909|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [Folded, False: 909]
  ------------------
  564|      0|    out_of_memory(cinfo, 6);    /* safety check */
  565|       |
  566|       |  /* Calculate max # of rows allowed in one allocation chunk */
  567|    909|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|    909|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|    909|          ((long)blocksperrow * sizeof(JBLOCK));
  569|    909|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 909]
  ------------------
  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|    909|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 0, False: 909]
  ------------------
  572|      0|    rowsperchunk = (JDIMENSION)ltemp;
  573|    909|  else
  574|    909|    rowsperchunk = numrows;
  575|    909|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|    909|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|    909|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|    909|  currow = 0;
  583|  1.81k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 909, False: 909]
  ------------------
  584|    909|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|    909|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 909]
  |  |  ------------------
  ------------------
  585|    909|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|    909|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|    909|                  sizeof(JBLOCK)));
  588|  71.1k|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 70.2k, False: 909]
  ------------------
  589|  70.2k|      result[currow++] = workspace;
  590|  70.2k|      workspace += blocksperrow;
  591|  70.2k|    }
  592|    909|  }
  593|       |
  594|    909|  return result;
  595|    909|}
jmemmgr.c:request_virt_sarray:
  640|     48|{
  641|     48|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  642|     48|  jvirt_sarray_ptr result;
  643|       |
  644|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  645|     48|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (645:7): [True: 0, False: 48]
  ------------------
  646|      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)))
  ------------------
  647|       |
  648|       |  /* get control block */
  649|     48|  result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
  650|     48|                                         sizeof(struct jvirt_sarray_control));
  651|       |
  652|     48|  result->mem_buffer = NULL;    /* marks array not yet realized */
  653|     48|  result->rows_in_array = numrows;
  654|     48|  result->samplesperrow = samplesperrow;
  655|     48|  result->maxaccess = maxaccess;
  656|     48|  result->pre_zero = pre_zero;
  657|     48|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|     48|#define FALSE   0               /* values of boolean */
  ------------------
  658|     48|  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  659|     48|  mem->virt_sarray_list = result;
  660|       |
  661|     48|  return result;
  662|     48|}
jmemmgr.c:request_virt_barray:
  670|    909|{
  671|    909|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|    909|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|    909|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|    909|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 909]
  ------------------
  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|    909|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|    909|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|    909|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|    909|  result->rows_in_array = numrows;
  684|    909|  result->blocksperrow = blocksperrow;
  685|    909|  result->maxaccess = maxaccess;
  686|    909|  result->pre_zero = pre_zero;
  687|    909|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|    909|#define FALSE   0               /* values of boolean */
  ------------------
  688|    909|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|    909|  mem->virt_barray_list = result;
  690|       |
  691|    909|  return result;
  692|    909|}
jmemmgr.c:realize_virt_arrays:
  698|  1.98k|{
  699|  1.98k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  1.98k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  1.98k|  size_t minheights, max_minheights;
  702|  1.98k|  jvirt_sarray_ptr sptr;
  703|  1.98k|  jvirt_barray_ptr bptr;
  704|  1.98k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 1.98k, False: 0]
  ------------------
  705|  1.98k|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  1.98k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  1.98k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 14, False: 1.97k]
  ------------------
  708|  1.97k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 76, False: 1.89k]
  ------------------
  709|     76|                                            sizeof(J12SAMPLE) :
  710|  1.97k|                                            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|  1.98k|  space_per_minheight = 0;
  717|  1.98k|  maximum_space = 0;
  718|  2.03k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 48, False: 1.98k]
  ------------------
  719|     48|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 48, False: 0]
  ------------------
  720|     48|      size_t new_space = (size_t)sptr->rows_in_array *
  721|     48|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|     48|      space_per_minheight += (size_t)sptr->maxaccess *
  724|     48|                             (size_t)sptr->samplesperrow * sample_size;
  725|     48|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 48]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|     48|      maximum_space += new_space;
  728|     48|    }
  729|     48|  }
  730|  2.89k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 909, False: 1.98k]
  ------------------
  731|    909|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 909, False: 0]
  ------------------
  732|    909|      size_t new_space = (size_t)bptr->rows_in_array *
  733|    909|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|    909|      space_per_minheight += (size_t)bptr->maxaccess *
  736|    909|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|    909|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 909]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|    909|      maximum_space += new_space;
  740|    909|    }
  741|    909|  }
  742|       |
  743|  1.98k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 1.10k, False: 879]
  ------------------
  744|  1.10k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|    879|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|    879|                                 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|    879|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 879, False: 0]
  ------------------
  755|    879|    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|    927|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 48, False: 879]
  ------------------
  768|     48|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 48, False: 0]
  ------------------
  769|     48|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|     48|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 48, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|     48|        sptr->rows_in_mem = sptr->rows_in_array;
  773|     48|      } 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|     48|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     48|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|     48|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|     48|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|     48|      sptr->cur_start_row = 0;
  786|     48|      sptr->first_undef_row = 0;
  787|     48|      sptr->dirty = FALSE;
  ------------------
  |  |  207|     48|#define FALSE   0               /* values of boolean */
  ------------------
  788|     48|    }
  789|     48|  }
  790|       |
  791|  1.78k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 909, False: 879]
  ------------------
  792|    909|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 909, False: 0]
  ------------------
  793|    909|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|    909|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 909, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|    909|        bptr->rows_in_mem = bptr->rows_in_array;
  797|    909|      } 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|    909|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    909|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|    909|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|    909|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|    909|      bptr->cur_start_row = 0;
  810|    909|      bptr->first_undef_row = 0;
  811|    909|      bptr->dirty = FALSE;
  ------------------
  |  |  207|    909|#define FALSE   0               /* values of boolean */
  ------------------
  812|    909|    }
  813|    909|  }
  814|    879|}
jmemmgr.c:access_virt_barray:
 1015|  61.0k|{
 1016|  61.0k|  JDIMENSION end_row = start_row + num_rows;
 1017|  61.0k|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|  61.0k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 61.0k]
  |  Branch (1020:39): [True: 0, False: 61.0k]
  ------------------
 1021|  61.0k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 61.0k]
  ------------------
 1022|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1023|       |
 1024|       |  /* Make the desired part of the virtual array accessible */
 1025|  61.0k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 61.0k]
  ------------------
 1026|  61.0k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 61.0k]
  ------------------
 1027|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (1027:9): [True: 0, False: 0]
  ------------------
 1028|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1029|       |    /* Flush old buffer contents if necessary */
 1030|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (1030:9): [True: 0, False: 0]
  ------------------
 1031|      0|      do_barray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
 1032|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1033|      0|    }
 1034|       |    /* Decide what part of virtual array to access.
 1035|       |     * Algorithm: if target address > current window, assume forward scan,
 1036|       |     * load starting at target address.  If target address < current window,
 1037|       |     * assume backward scan, load so that target area is top of window.
 1038|       |     * Note that when switching from forward write to forward read, will have
 1039|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
 1040|       |     */
 1041|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (1041:9): [True: 0, False: 0]
  ------------------
 1042|      0|      ptr->cur_start_row = start_row;
 1043|      0|    } else {
 1044|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
 1045|      0|      long ltemp;
 1046|       |
 1047|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
 1048|      0|      if (ltemp < 0)
  ------------------
  |  Branch (1048:11): [True: 0, False: 0]
  ------------------
 1049|      0|        ltemp = 0;              /* don't fall off front end of file */
 1050|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
 1051|      0|    }
 1052|       |    /* Read in the selected part of the array.
 1053|       |     * During the initial write pass, we will do no actual read
 1054|       |     * because the selected part is all undefined.
 1055|       |     */
 1056|      0|    do_barray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1057|      0|  }
 1058|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
 1059|       |   * To improve locality of access, we only prezero the part of the array
 1060|       |   * that the caller is about to access, not the entire in-memory array.
 1061|       |   */
 1062|  61.0k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 20.3k, False: 40.6k]
  ------------------
 1063|  20.3k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 0, False: 20.3k]
  ------------------
 1064|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1064:11): [True: 0, False: 0]
  ------------------
 1065|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1066|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1067|  20.3k|    } else {
 1068|  20.3k|      undef_row = ptr->first_undef_row;
 1069|  20.3k|    }
 1070|  20.3k|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 20.3k, False: 0]
  ------------------
 1071|  20.3k|      ptr->first_undef_row = end_row;
 1072|  20.3k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 20.3k, False: 0]
  ------------------
 1073|  20.3k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|  20.3k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|  20.3k|      end_row -= ptr->cur_start_row;
 1076|  61.2k|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 40.9k, False: 20.3k]
  ------------------
 1077|  40.9k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|  40.9k|        undef_row++;
 1079|  40.9k|      }
 1080|  20.3k|    } else {
 1081|      0|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (1081:11): [True: 0, False: 0]
  ------------------
 1082|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1083|      0|    }
 1084|  20.3k|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|  61.0k|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 45.0k, False: 15.9k]
  ------------------
 1087|  45.0k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  45.0k|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|  61.0k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|  61.0k|}
jmemmgr.c:free_pool:
 1099|  5.91k|{
 1100|  5.91k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|  5.91k|  small_pool_ptr shdr_ptr;
 1102|  5.91k|  large_pool_ptr lhdr_ptr;
 1103|  5.91k|  size_t space_freed;
 1104|       |
 1105|  5.91k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  5.91k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 5.91k]
  |  Branch (1105:22): [True: 0, False: 5.91k]
  ------------------
 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|  5.91k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|  5.91k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 3.29k, False: 2.61k]
  ------------------
 1115|  3.29k|    jvirt_sarray_ptr sptr;
 1116|  3.29k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|  3.34k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 48, False: 3.29k]
  ------------------
 1119|     48|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 48]
  ------------------
 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|     48|    }
 1124|  3.29k|    mem->virt_sarray_list = NULL;
 1125|  4.20k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 909, False: 3.29k]
  ------------------
 1126|    909|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 909]
  ------------------
 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|    909|    }
 1131|  3.29k|    mem->virt_barray_list = NULL;
 1132|  3.29k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|  5.91k|  lhdr_ptr = mem->large_list[pool_id];
 1136|  5.91k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|  12.5k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 6.68k, False: 5.91k]
  ------------------
 1139|  6.68k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|  6.68k|    space_freed = lhdr_ptr->bytes_used +
 1141|  6.68k|                  lhdr_ptr->bytes_left +
 1142|  6.68k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  6.68k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|  6.68k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|  6.68k|    mem->total_space_allocated -= space_freed;
 1145|  6.68k|    lhdr_ptr = next_lhdr_ptr;
 1146|  6.68k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|  5.91k|  shdr_ptr = mem->small_list[pool_id];
 1150|  5.91k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|  11.3k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 5.47k, False: 5.91k]
  ------------------
 1153|  5.47k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|  5.47k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|  5.47k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  5.47k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|  5.47k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|  5.47k|    mem->total_space_allocated -= space_freed;
 1158|  5.47k|    shdr_ptr = next_shdr_ptr;
 1159|  5.47k|  }
 1160|  5.91k|}
jmemmgr.c:self_destruct:
 1170|  2.61k|{
 1171|  2.61k|  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|  7.85k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  2.61k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  7.85k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 5.23k, False: 2.61k]
  ------------------
 1178|  5.23k|    free_pool(cinfo, pool);
 1179|  5.23k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  2.61k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  2.61k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  2.61k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  2.61k|}

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

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

jdiv_round_up:
   81|  24.1k|{
   82|  24.1k|  return (a + b - 1L) / b;
   83|  24.1k|}
jround_up:
   90|  2.80k|{
   91|  2.80k|  a += b - 1L;
   92|  2.80k|  return a - (a % b);
   93|  2.80k|}
jcopy_sample_rows:
  110|   397k|{
  111|   397k|  register _JSAMPROW inptr, outptr;
  112|   397k|  register size_t count = (size_t)(num_cols * sizeof(_JSAMPLE));
  113|   397k|  register int row;
  114|       |
  115|   397k|  input_array += source_row;
  116|   397k|  output_array += dest_row;
  117|       |
  118|   794k|  for (row = num_rows; row > 0; row--) {
  ------------------
  |  Branch (118:24): [True: 397k, False: 397k]
  ------------------
  119|   397k|    inptr = *input_array++;
  120|   397k|    outptr = *output_array++;
  121|   397k|    memcpy(outptr, inptr, count);
  122|   397k|  }
  123|   397k|}
jcopy_block_row:
  135|  1.01M|{
  136|  1.01M|  memcpy(output_row, input_row, num_blocks * (DCTSIZE2 * sizeof(JCOEF)));
  ------------------
  |  |   67|  1.01M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  137|  1.01M|}
jzero_far:
  144|   716k|{
  145|   716k|  memset(target, 0, bytestozero);
  146|   716k|}

LLVMFuzzerTestOneInput:
   99|  26.8k|{
  100|  26.8k|#ifndef _WIN32
  101|       |    // Used by jpeg library to work around false positives in memory sanitizer.
  102|  26.8k|    setenv("JSIMD_FORCENONE", "1", 1);
  103|  26.8k|#endif
  104|  26.8k|    FuzzHelper f(data, size);
  105|  26.8k|    f.run();
  106|  26.8k|    return 0;
  107|  26.8k|}
_ZN10FuzzHelperC2EPKhm:
   20|  26.8k|        input_buffer(const_cast<unsigned char*>(data), size)
   21|  26.8k|    {
   22|  26.8k|    }
_ZN10FuzzHelper3runEv:
   26|  26.8k|    {
   27|  26.8k|        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|  26.8k|        try {
   33|  26.8k|            info("");
   34|       |            // Write in various ways to exercise QPDFWriter
   35|       |
   36|  26.8k|            auto is = std::make_shared<BufferInputSource>("fuzz input", &input_buffer);
   37|  26.8k|            QPDF qpdf;
   38|  26.8k|            qpdf.processInputSource(is);
   39|  26.8k|            info("processInputSource done");
   40|  26.8k|            QPDFPageDocumentHelper pdh(qpdf);
   41|  26.8k|            QPDFPageLabelDocumentHelper pldh(qpdf);
   42|  26.8k|            QPDFOutlineDocumentHelper odh(qpdf);
   43|  26.8k|            QPDFAcroFormDocumentHelper afdh(qpdf);
   44|  26.8k|            afdh.generateAppearancesIfNeeded();
   45|  26.8k|            info("generateAppearancesIfNeeded done");
   46|  26.8k|            pdh.flattenAnnotations();
   47|  26.8k|            info("flattenAnnotations done");
   48|  26.8k|            int pageno = 0;
   49|  26.8k|            for (auto& page: pdh.getAllPages()) {
  ------------------
  |  Branch (49:28): [True: 19.9k, False: 26.7k]
  ------------------
   50|  19.9k|                ++pageno;
   51|  19.9k|                try {
   52|  19.9k|                    info("start page", pageno);
   53|  19.9k|                    page.coalesceContentStreams();
   54|  19.9k|                    info("coalesceContentStreams done");
   55|  19.9k|                    page.parseContents(nullptr);
   56|  19.9k|                    info("parseContents done");
   57|  19.9k|                    page.getImages();
   58|  19.9k|                    info("getImages done");
   59|  19.9k|                    pldh.getLabelForPage(pageno);
   60|  19.9k|                    info("getLabelForPage done");
   61|  19.9k|                    QPDFObjectHandle page_obj(page.getObjectHandle());
   62|  19.9k|                    page_obj.getJSON(JSON::LATEST, true).unparse();
   63|  19.9k|                    info("getJSON done");
   64|  19.9k|                    odh.getOutlinesForPage(page_obj);
   65|  19.9k|                    info("getOutlinesForPage done");
   66|       |
   67|  19.9k|                    for (auto& aoh: afdh.getWidgetAnnotationsForPage(page)) {
  ------------------
  |  Branch (67:35): [True: 1.83k, False: 19.9k]
  ------------------
   68|  1.83k|                        afdh.getFieldForAnnotation(aoh);
   69|  1.83k|                    }
   70|  19.9k|                } catch (QPDFExc& e) {
   71|  3.14k|                    std::cerr << "page " << pageno << ": " << e.what() << '\n';
   72|  3.14k|                }
   73|  19.9k|            }
   74|  26.8k|        } catch (std::runtime_error const& e) {
   75|  17.5k|            std::cerr << "runtime_error: " << e.what() << '\n';
   76|  17.5k|        }
   77|  26.8k|    }
_ZNK10FuzzHelper4infoERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEi:
   82|   185k|    {
   83|   185k|        const std::chrono::duration<double> elapsed{std::chrono::steady_clock::now() - start};
   84|       |
   85|   185k|        std::cerr << elapsed.count() << " info - " << msg;
   86|   185k|        if (pageno > 0) {
  ------------------
  |  Branch (86:13): [True: 19.9k, False: 165k]
  ------------------
   87|  19.9k|            std::cerr << " page " << pageno;
   88|  19.9k|        }
   89|   185k|        std::cerr << '\n';
   90|   185k|    }

_ZN11InputSourceC2Ev:
   35|   143k|    InputSource() = default;
_ZN11InputSourceD2Ev:
   37|   143k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   43|   132k|        Finder() = default;
_ZN11InputSource6FinderD2Ev:
   45|  55.8k|        virtual ~Finder() = default;

_ZN4JSON10JSON_valueC2ENS_12value_type_eE:
  306|   602k|            type_code(type_code)
  307|   602k|        {
  308|   602k|        }
_ZN4JSON15JSON_dictionaryC2Ev:
  316|  56.5k|            JSON_value(vt_dictionary)
  317|  56.5k|        {
  318|  56.5k|        }
_ZN4JSON9JSON_nullC2Ev:
  350|  76.4k|            JSON_value(vt_null)
  351|  76.4k|        {
  352|  76.4k|        }
_ZN4JSON10JSON_arrayC2Ev:
  396|  56.4k|        JSON_value(vt_array)
  397|  56.4k|    {
  398|  56.4k|    }
_ZN4JSON10JSON_valueD2Ev:
  309|   602k|        virtual ~JSON_value() = default;
_ZN4JSONC2Ev:
   50|  1.74M|    JSON() = default;
_ZN4JSON15JSON_dictionaryD2Ev:
  319|  56.5k|        ~JSON_dictionary() override = default;
_ZN4JSON10JSON_arrayD2Ev:
  399|  56.4k|    ~JSON_array() override = default;
_ZN4JSON11JSON_stringD2Ev:
  327|   193k|        ~JSON_string() override = default;
_ZN4JSON11JSON_numberD2Ev:
  336|   215k|        ~JSON_number() override = default;
_ZN4JSON7MembersD2Ev:
  378|   602k|        ~Members() = default;

_ZN4qpdf10BaseHandleD2Ev:
  131|  44.4M|        ~BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  7.36M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|  12.4M|        BaseHandle(BaseHandle const&) = default;
_ZNK4qpdf10BaseHandleeqERKS0_:
   67|   110k|        {
   68|   110k|            return obj == other.obj;
   69|   110k|        }
_ZNK4qpdf10BaseHandle5emptyEv:
   82|  5.32k|        {
   83|  5.32k|            return size() == 0;
   84|  5.32k|        }
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  9.62M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|  1.72M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|   880k|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  10.1M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|   758k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC9to_offsetImEExRKT_:
  222|  10.6M|    {
  223|  10.6M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  10.6M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  10.6M|        {
  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|  10.6M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  10.6M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 10.6M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  10.6M|            return static_cast<To>(i);
  155|  10.6M|        }
_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|   207k|    {
  275|   207k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 191k, False: 15.9k]
  ------------------
  276|   191k|            return;
  277|   191k|        }
  278|  15.9k|        QIntC::range_check_error<T>(cur, delta);
  279|  15.9k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  15.9k|    {
  258|  15.9k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 15.9k, False: 2]
  |  Branch (258:28): [True: 33, False: 15.9k]
  ------------------
  259|     33|            std::ostringstream msg;
  260|     33|            msg.imbue(std::locale::classic());
  261|     33|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     33|            throw std::range_error(msg.str());
  263|  15.9k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 15.9k]
  |  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|  15.9k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  16.0M|    {
  216|  16.0M|        return IntConverter<T, size_t>::convert(i);
  217|  16.0M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  16.0M|        {
  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|  16.0M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  16.0M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 16.0M]
  |  Branch (124:28): [True: 0, False: 16.0M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  16.0M|            return static_cast<To>(i);
  128|  16.0M|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|  2.77M|    {
  202|  2.77M|        return IntConverter<T, int>::convert(i);
  203|  2.77M|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|  2.77M|        {
  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|  2.77M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  2.77M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 20, False: 2.77M]
  ------------------
  152|     20|                error(i);
  153|     20|            }
  154|  2.77M|            return static_cast<To>(i);
  155|  2.77M|        }
_ZN5QIntC12IntConverterImiLb0ELb1EE5errorEm:
  159|     20|        {
  160|     20|            std::ostringstream msg;
  161|     20|            msg.imbue(std::locale::classic());
  162|     20|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  163|     20|                << "-byte unsigned type to a " << sizeof(To) << "-byte signed type";
  164|     20|            throw std::range_error(msg.str());
  165|     20|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|  85.6k|    {
  216|  85.6k|        return IntConverter<T, size_t>::convert(i);
  217|  85.6k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   275M|        {
  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|   275M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   275M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 275M]
  |  Branch (124:28): [True: 0, False: 275M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   275M|            return static_cast<To>(i);
  128|   275M|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  5.36M|    {
  202|  5.36M|        return IntConverter<T, int>::convert(i);
  203|  5.36M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  5.36M|        {
   95|       |            // From and To are both signed.
   96|  5.36M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 793, False: 5.36M]
  |  Branch (96:57): [True: 718, False: 5.36M]
  ------------------
   97|  1.51k|                error(i);
   98|  1.51k|            }
   99|  5.36M|            return static_cast<To>(i);
  100|  5.36M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.51k|        {
  105|  1.51k|            std::ostringstream msg;
  106|  1.51k|            msg.imbue(std::locale::classic());
  107|  1.51k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.51k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.51k|            throw std::range_error(msg.str());
  110|  1.51k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|    103|    {
  216|    103|        return IntConverter<T, size_t>::convert(i);
  217|    103|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|   198k|        {
   70|       |            // From and To are both unsigned.
   71|   198k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 198k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   198k|            return static_cast<To>(i);
   75|   198k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  27.2k|    {
  209|  27.2k|        return IntConverter<T, unsigned int>::convert(i);
  210|  27.2k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  27.2k|        {
  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|  27.2k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  27.2k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 27.2k]
  |  Branch (124:28): [True: 0, False: 27.2k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  27.2k|            return static_cast<To>(i);
  128|  27.2k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  8.39k|    {
  202|  8.39k|        return IntConverter<T, int>::convert(i);
  203|  8.39k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  8.39k|        {
   95|       |            // From and To are both signed.
   96|  8.39k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 8.39k]
  |  Branch (96:57): [True: 0, False: 8.39k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  8.39k|            return static_cast<To>(i);
  100|  8.39k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  15.3k|    {
  216|  15.3k|        return IntConverter<T, size_t>::convert(i);
  217|  15.3k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  15.3k|        {
   70|       |            // From and To are both unsigned.
   71|  15.3k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 15.3k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  15.3k|            return static_cast<To>(i);
   75|  15.3k|        }
_ZN5QIntC8to_ulongIcEEmRKT_:
  236|  10.3M|    {
  237|  10.3M|        return IntConverter<T, unsigned long>::convert(i);
  238|  10.3M|    }
_ZN5QIntC12IntConverterIcmLb1ELb0EE7convertERKc:
  119|  10.3M|        {
  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|  10.3M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  10.3M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 10.3M]
  |  Branch (124:28): [True: 0, False: 10.3M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  10.3M|            return static_cast<To>(i);
  128|  10.3M|        }
_ZN5QIntC8to_ulongIhEEmRKT_:
  236|   818M|    {
  237|   818M|        return IntConverter<T, unsigned long>::convert(i);
  238|   818M|    }
_ZN5QIntC12IntConverterIhmLb0ELb0EE7convertERKh:
   69|   818M|        {
   70|       |            // From and To are both unsigned.
   71|   818M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 818M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   818M|            return static_cast<To>(i);
   75|   818M|        }
_ZN5QIntC8to_ulongIiEEmRKT_:
  236|   275M|    {
  237|   275M|        return IntConverter<T, unsigned long>::convert(i);
  238|   275M|    }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|  5.94M|    {
  216|  5.94M|        return IntConverter<T, size_t>::convert(i);
  217|  5.94M|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|  5.94M|        {
  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|  5.94M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  5.94M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 5.94M]
  |  Branch (124:28): [True: 0, False: 5.94M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  5.94M|            return static_cast<To>(i);
  128|  5.94M|        }
_ZN5QIntC9to_ushortIiEEtRKT_:
  194|  38.9M|    {
  195|  38.9M|        return IntConverter<T, unsigned short>::convert(i);
  196|  38.9M|    }
_ZN5QIntC12IntConverterIitLb1ELb0EE7convertERKi:
  119|  38.9M|        {
  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|  38.9M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  38.9M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 38.9M]
  |  Branch (124:28): [True: 0, False: 38.9M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  38.9M|            return static_cast<To>(i);
  128|  38.9M|        }
_ZN5QIntC20range_check_subtractIxEEvRKT_S3_:
  302|  1.01k|    {
  303|  1.01k|        if ((delta >= 0) == (cur >= 0)) {
  ------------------
  |  Branch (303:13): [True: 833, False: 186]
  ------------------
  304|    833|            return;
  305|    833|        }
  306|    186|        QIntC::range_check_subtract_error<T>(cur, delta);
  307|    186|    }
_ZN5QIntC26range_check_subtract_errorIxEEvRKT_S3_:
  284|    186|    {
  285|    186|        if ((delta > 0) && ((std::numeric_limits<T>::min() + delta) > cur)) {
  ------------------
  |  Branch (285:13): [True: 0, False: 186]
  |  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|    186|        } else if ((delta < 0) && ((std::numeric_limits<T>::max() + delta) < cur)) {
  ------------------
  |  Branch (291:20): [True: 186, False: 0]
  |  Branch (291:35): [True: 0, False: 186]
  ------------------
  292|      0|            std::ostringstream msg;
  293|      0|            msg.imbue(std::locale::classic());
  294|      0|            msg << "subtracting " << delta << " from " << cur << " would cause an integer overflow";
  295|      0|            throw std::range_error(msg.str());
  296|      0|        }
  297|    186|    }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  21.8k|    {
  216|  21.8k|        return IntConverter<T, size_t>::convert(i);
  217|  21.8k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  21.8k|        {
   70|       |            // From and To are both unsigned.
   71|  21.8k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 21.8k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  21.8k|            return static_cast<To>(i);
   75|  21.8k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|  5.04M|    {
  209|  5.04M|        return IntConverter<T, unsigned int>::convert(i);
  210|  5.04M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|  5.04M|        {
   70|       |            // From and To are both unsigned.
   71|  5.04M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 5.04M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  5.04M|            return static_cast<To>(i);
   75|  5.04M|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|   198k|    {
  237|   198k|        return IntConverter<T, unsigned long>::convert(i);
  238|   198k|    }

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

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

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

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

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

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

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  1.67M|        obj(obj),
   41|  1.67M|        gen(gen)
   42|  1.67M|    {
   43|  1.67M|    }
_ZNK10QPDFObjGenltERKS_:
   46|  69.4M|    {
   47|  69.4M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 38.5M, False: 30.9M]
  |  Branch (47:36): [True: 8.82M, False: 22.0M]
  |  Branch (47:54): [True: 120k, False: 8.70M]
  ------------------
   48|  69.4M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   253k|    {
   52|   253k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 247k, False: 6.12k]
  |  Branch (52:34): [True: 247k, False: 115]
  ------------------
   53|   253k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   233k|    {
   57|   233k|        return !(*this == rhs);
   58|   233k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  1.65M|    {
   62|  1.65M|        return obj;
   63|  1.65M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|  4.41k|    {
   67|  4.41k|        return gen;
   68|  4.41k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|  6.07M|    {
   72|  6.07M|        return obj != 0;
   73|  6.07M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   609k|    {
   77|   609k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   609k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   349k|        {
  112|   349k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 234k, False: 115k]
  ------------------
  113|   234k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 11.5k, False: 222k]
  ------------------
  114|  11.5k|                    return false;
  115|  11.5k|                }
  116|   222k|                emplace(og);
  117|   222k|            }
  118|   338k|            return true;
  119|   349k|        }
_ZN10QPDFObjGenC2Ev:
   38|  16.5M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|  6.07M|        qpdf::BaseHandle(obj)
 1316|  6.07M|    {
 1317|  6.07M|    }
_ZN16QPDFObjectHandleC2ERKS_:
  290|  12.1M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  176|  56.0k|            {
  177|  56.0k|                f->setPipeline(p);
  178|  56.0k|            }
_ZN16QPDFObjectHandle9RectangleC2Ev:
  236|  1.76k|            llx(0.0),
  237|  1.76k|            lly(0.0),
  238|  1.76k|            urx(0.0),
  239|  1.76k|            ury(0.0)
  240|  1.76k|        {
  241|  1.76k|        }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  73.9k|            llx(llx),
  244|  73.9k|            lly(lly),
  245|  73.9k|            urx(urx),
  246|  73.9k|            ury(ury)
  247|  73.9k|        {
  248|  73.9k|        }
_ZN16QPDFObjectHandle6MatrixC2Edddddd:
  272|    332|            a(a),
  273|    332|            b(b),
  274|    332|            c(c),
  275|    332|            d(d),
  276|    332|            e(e),
  277|    332|            f(f)
  278|    332|        {
  279|    332|        }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  8.89M|        qpdf::BaseHandle(std::move(obj))
 1320|  8.89M|    {
 1321|  8.89M|    }
_ZN16QPDFObjectHandle6getObjEv:
 1324|   253k|    {
 1325|   253k|        return obj;
 1326|   253k|    }
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratorneERKS1_:
 1518|   299k|        {
 1519|   299k|            return !operator==(other);
 1520|   299k|        }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|  15.1M|    {
 1560|  15.1M|        return static_cast<bool>(obj);
 1561|  15.1M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   381k|    {
 1566|   381k|        return {obj};
 1567|   381k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|  1.69M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|   809k|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  10.1M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorD2Ev:
 1491|  9.17k|        virtual ~iterator() = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|   719k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  93.1k|        TokenFilter() = default;
_ZN16QPDFObjectHandle11TokenFilterD2Ev:
  164|  28.3k|        virtual ~TokenFilter() = default;

_ZN16QPDFObjectHelper15getObjectHandleEv:
   45|  85.1k|    {
   46|  85.1k|        return {obj};
   47|  85.1k|    }
_ZN16QPDFObjectHelperC2E16QPDFObjectHandle:
   38|   253k|        qpdf::BaseHandle(oh.getObj())
   39|   253k|    {
   40|   253k|    }
_ZNK16QPDFObjectHelper15getObjectHandleEv:
   50|  37.6k|    {
   51|  37.6k|        return {obj};
   52|  37.6k|    }
_ZN16QPDFObjectHelper2ohEv:
   58|   391k|    {
   59|   391k|        return {obj};
   60|   391k|    }

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

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

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

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

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

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

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  5.59M|            type(tt_bad)
   72|  5.59M|        {
   73|  5.59M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  5.59M|            type(type),
   82|  5.59M|            value(value),
   83|  5.59M|            raw_value(raw_value),
   84|  5.59M|            error_message(error_message)
   85|  5.59M|        {
   86|  5.59M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  8.19M|        {
   90|  8.19M|            return this->type;
   91|  8.19M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  4.75M|        {
   95|  4.75M|            return this->value;
   96|  4.75M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   99|   690k|        {
  100|   690k|            return this->raw_value;
  101|   690k|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  3.32M|        {
  117|  3.32M|            return this->type == tt_integer;
  118|  3.32M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  6.11M|        {
  127|  6.11M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 2.61M, False: 3.49M]
  |  Branch (127:45): [True: 780k, False: 1.83M]
  ------------------
  128|  6.11M|        }

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

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

_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|  29.8k|    {
  184|  29.8k|        return std::shared_ptr<T>(new T[n], std::default_delete<T[]>());
  185|  29.8k|    }

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

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

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

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

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

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
   16|  26.8k|    own_memory(own_memory),
   17|  26.8k|    description(description),
   18|  26.8k|    buf(buf),
   19|  26.8k|    cur_offset(0),
   20|  26.8k|    max_offset(buf ? QIntC::to_offset(buf->getSize()) : 0)
  ------------------
  |  Branch (20:16): [True: 26.8k, False: 0]
  ------------------
   21|  26.8k|{
   22|  26.8k|}
_ZN17BufferInputSourceD2Ev:
   35|  26.8k|{
   36|  26.8k|    if (own_memory) {
  ------------------
  |  Branch (36:9): [True: 0, False: 26.8k]
  ------------------
   37|      0|        delete buf;
   38|      0|    }
   39|  26.8k|}
_ZN17BufferInputSource18findAndSkipNextEOLEv:
   43|  2.26M|{
   44|  2.26M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
   45|  2.26M|    qpdf_offset_t end_pos = max_offset;
   46|  2.26M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (46:9): [True: 7.59k, False: 2.25M]
  ------------------
   47|  7.59k|        last_offset = end_pos;
   48|  7.59k|        cur_offset = end_pos;
   49|  7.59k|        return end_pos;
   50|  7.59k|    }
   51|       |
   52|  2.25M|    qpdf_offset_t result = 0;
   53|  2.25M|    unsigned char const* buffer = buf->getBuffer();
   54|  2.25M|    unsigned char const* end = buffer + end_pos;
   55|  2.25M|    unsigned char const* p = buffer + cur_offset;
   56|       |
   57|   262M|    while ((p < end) && !((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (57:12): [True: 262M, False: 17.9k]
  |  Branch (57:27): [True: 538k, False: 262M]
  |  Branch (57:43): [True: 1.70M, False: 260M]
  ------------------
   58|   260M|        ++p;
   59|   260M|    }
   60|  2.25M|    if (p < end) {
  ------------------
  |  Branch (60:9): [True: 2.23M, False: 17.9k]
  ------------------
   61|  2.23M|        result = p - buffer;
   62|  2.23M|        cur_offset = result + 1;
   63|  2.23M|        ++p;
   64|  2.52M|        while ((cur_offset < end_pos) && ((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (64:16): [True: 2.52M, False: 2.64k]
  |  Branch (64:43): [True: 15.9k, False: 2.50M]
  |  Branch (64:59): [True: 272k, False: 2.23M]
  ------------------
   65|   288k|            ++p;
   66|   288k|            ++cur_offset;
   67|   288k|        }
   68|  2.23M|    } else {
   69|  17.9k|        cur_offset = end_pos;
   70|  17.9k|        result = end_pos;
   71|  17.9k|    }
   72|  2.25M|    return result;
   73|  2.26M|}
_ZNK17BufferInputSource7getNameEv:
   77|  1.20M|{
   78|  1.20M|    return description;
   79|  1.20M|}
_ZN17BufferInputSource4tellEv:
   83|  24.3M|{
   84|  24.3M|    return cur_offset;
   85|  24.3M|}
_ZN17BufferInputSource4seekExi:
   89|  16.2M|{
   90|  16.2M|    switch (whence) {
   91|  16.0M|    case SEEK_SET:
  ------------------
  |  Branch (91:5): [True: 16.0M, False: 206k]
  ------------------
   92|  16.0M|        cur_offset = offset;
   93|  16.0M|        break;
   94|       |
   95|  53.2k|    case SEEK_END:
  ------------------
  |  Branch (95:5): [True: 53.2k, False: 16.2M]
  ------------------
   96|  53.2k|        QIntC::range_check(max_offset, offset);
   97|  53.2k|        cur_offset = max_offset + offset;
   98|  53.2k|        break;
   99|       |
  100|   152k|    default:
  ------------------
  |  Branch (100:5): [True: 152k, False: 16.1M]
  ------------------
  101|   152k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  102|   152k|        QIntC::range_check(cur_offset, offset);
  103|   152k|        cur_offset += offset;
  104|  16.2M|    }
  105|       |
  106|  16.2M|    if (cur_offset < 0) {
  ------------------
  |  Branch (106:9): [True: 456, False: 16.2M]
  ------------------
  107|    456|        throw std::runtime_error(description + ": seek before beginning of buffer");
  108|    456|    }
  109|  16.2M|}
_ZN17BufferInputSource4readEPcm:
  119|  3.19M|{
  120|  3.19M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
  121|  3.19M|    qpdf_offset_t end_pos = max_offset;
  122|  3.19M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (122:9): [True: 80.3k, False: 3.11M]
  ------------------
  123|  80.3k|        last_offset = end_pos;
  124|  80.3k|        return 0;
  125|  80.3k|    }
  126|       |
  127|  3.11M|    last_offset = cur_offset;
  128|  3.11M|    size_t len = std::min(QIntC::to_size(end_pos - cur_offset), length);
  129|  3.11M|    memcpy(buffer, buf->getBuffer() + cur_offset, len);
  130|  3.11M|    cur_offset += QIntC::to_offset(len);
  131|  3.11M|    return len;
  132|  3.19M|}
_ZN17BufferInputSource8unreadChEc:
  136|  18.3k|{
  137|  18.3k|    if (cur_offset > 0) {
  ------------------
  |  Branch (137:9): [True: 18.3k, False: 0]
  ------------------
  138|  18.3k|        --cur_offset;
  139|  18.3k|    }
  140|  18.3k|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  24.4M|{
  259|  24.4M|    switch (whence) {
  260|  24.4M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 24.4M, False: 0]
  ------------------
  261|  24.4M|        pos = offset - global_offset;
  262|  24.4M|        break;
  263|       |
  264|      0|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 0, False: 24.4M]
  ------------------
  265|      0|        QIntC::range_check(static_cast<qpdf_offset_t>(view_.size()), offset);
  266|      0|        pos = static_cast<qpdf_offset_t>(view_.size()) + offset;
  267|      0|        break;
  268|       |
  269|      0|    default:
  ------------------
  |  Branch (269:5): [True: 0, False: 24.4M]
  ------------------
  270|      0|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  271|      0|        QIntC::range_check(pos, offset);
  272|      0|        pos += offset;
  273|  24.4M|    }
  274|       |
  275|  24.4M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 0, False: 24.4M]
  ------------------
  276|      0|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|      0|    }
  278|  24.4M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|  5.29M|{
  283|  5.29M|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|  5.29M|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|  5.29M|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 86.5k, False: 5.20M]
  ------------------
  286|  86.5k|        last_offset = end_pos + global_offset;
  287|  86.5k|        return 0;
  288|  86.5k|    }
  289|       |
  290|  5.20M|    last_offset = pos + global_offset;
  291|  5.20M|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|  5.20M|    memcpy(buffer, view_.data() + pos, len);
  293|  5.20M|    pos += QIntC::to_offset(len);
  294|  5.20M|    return len;
  295|  5.29M|}

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

_ZN11InputSource13setLastOffsetEx:
   15|  27.4M|{
   16|  27.4M|    this->last_offset = offset;
   17|  27.4M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  13.0M|{
   22|  13.0M|    return this->last_offset;
   23|  13.0M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  14.2k|{
   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|  14.2k|    read(str, count, at);
   34|  14.2k|    auto eol = str.find_first_of("\n\r"sv);
   35|  14.2k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 11.8k, False: 2.42k]
  ------------------
   36|  11.8k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  11.8k|        str.resize(eol);
   38|  11.8k|        if (eol != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 11.8k, False: 0]
  ------------------
   39|  11.8k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  11.8k|            return eol;
   41|  11.8k|        }
   42|  11.8k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.42k|    seek(last_offset, SEEK_SET);
   45|  2.42k|    findAndSkipNextEOL();
   46|  2.42k|    return eol;
   47|  14.2k|}
_ZN11InputSource8readLineEm:
   51|  14.2k|{
   52|  14.2k|    return read_line(max_line_length);
   53|  14.2k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|   137k|{
   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|   137k|    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|   137k|    size_t size = sizeof(buf) - 1;
   79|   137k|    util::assertion(
   80|   137k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 137k]
  |  Branch (80:38): [True: 0, False: 137k]
  ------------------
   81|   137k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|   137k|    );
   83|       |
   84|   137k|    char* p = nullptr;
   85|   137k|    qpdf_offset_t buf_offset = offset;
   86|   137k|    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|  5.98M|    while (true) {
  ------------------
  |  Branch (91:12): [True: 5.98M, 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|  5.98M|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 137k, False: 5.84M]
  |  Branch (97:31): [True: 345k, False: 5.50M]
  ------------------
   98|   483k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 345k, False: 137k]
  ------------------
   99|   345k|                QTC::TC(
  100|   345k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 329k, False: 15.9k]
  ------------------
  101|   345k|                buf_offset += (p - buf);
  102|   345k|            }
  103|   483k|            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|   483k|            bytes_read = this->read(buf, size);
  108|   483k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 49.6k, False: 433k]
  ------------------
  109|  49.6k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 43.0k, False: 6.65k]
  ------------------
  110|  49.6k|                return false;
  111|  49.6k|            }
  112|   433k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   433k|            p = buf;
  114|   433k|        }
  115|       |
  116|       |        // Search for the first character.
  117|  5.93M|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 5.60M, False: 329k]
  ------------------
  118|       |                 // line-break
  119|  5.93M|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|  5.60M|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 15.8k, False: 5.58M]
  ------------------
  121|  15.8k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  15.8k|            }
  123|       |            // Found first letter.
  124|  5.60M|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 32.9k, False: 5.57M]
  ------------------
  125|       |                // Make sure it's in range.
  126|  32.9k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  32.9k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 3.09k, False: 29.8k]
  ------------------
  128|       |                    // out of range
  129|  3.09k|                    QTC::TC("libtests", "InputSource out of range");
  130|  3.09k|                    return false;
  131|  3.09k|                }
  132|  32.9k|            }
  133|  5.60M|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 9.84k, False: 5.59M]
  ------------------
  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|  9.84k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  9.84k|                continue;
  138|  9.84k|            }
  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|  5.59M|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 2.16M, False: 3.43M]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  2.16M|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  2.16M|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 85.1k, False: 2.07M]
  ------------------
  146|  85.1k|                    return true;
  147|  2.07M|                } else {
  148|  2.07M|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  2.07M|                }
  150|  3.43M|            } else {
  151|  3.43M|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|  3.43M|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|  5.50M|            ++p;
  156|  5.50M|        } else {
  157|       |            // Trigger reading the next block
  158|   329k|            p = buf + bytes_read;
  159|   329k|        }
  160|  5.93M|    }
  161|   137k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  26.8k|{
  166|  26.8k|    bool found = false;
  167|  26.8k|    qpdf_offset_t after_found_offset = 0;
  168|  26.8k|    qpdf_offset_t cur_offset = offset;
  169|  26.8k|    size_t cur_len = len;
  170|  32.5k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.73k, False: 26.8k]
  ------------------
  171|  5.73k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 477, False: 5.25k]
  ------------------
  172|    477|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  5.25k|        } else {
  174|  5.25k|            found = true;
  175|  5.25k|        }
  176|  5.73k|        after_found_offset = this->tell();
  177|  5.73k|        cur_offset = after_found_offset;
  178|  5.73k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.73k|    }
  180|  26.8k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 5.25k, False: 21.5k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  5.25k|    }
  183|  26.8k|    return found;
  184|  26.8k|}
_ZN11InputSource9read_lineEmx:
   57|  14.2k|{
   58|  14.2k|    std::string result(count, '\0');
   59|  14.2k|    read_line(result, count, at);
   60|  14.2k|    return result;
   61|  14.2k|}

_ZN4JSON7MembersC2ENSt3__110unique_ptrINS_10JSON_valueENS1_14default_deleteIS3_EEEE:
   19|   602k|    value(std::move(value))
   20|   602k|{
   21|   602k|}
_ZN4JSONC2ENSt3__110unique_ptrINS_10JSON_valueENS0_14default_deleteIS2_EEEE:
   24|   602k|    m(new Members(std::move(value)))
   25|   602k|{
   26|   602k|}
_ZN4JSON10writeCloseEP8PipelinebmPKc:
   30|   111k|{
   31|   111k|    if (first) {
  ------------------
  |  Branch (31:9): [True: 15.1k, False: 96.0k]
  ------------------
   32|  15.1k|        *p << delimiter;
   33|  96.0k|    } else {
   34|  96.0k|        std::string s{"\n"};
   35|  96.0k|        s.append(2 * depth, ' ');
   36|  96.0k|        *p << s + delimiter;
   37|  96.0k|    }
   38|   111k|}
_ZN4JSON9writeNextEP8PipelineRbm:
   42|   582k|{
   43|   582k|    if (first) {
  ------------------
  |  Branch (43:9): [True: 96.0k, False: 486k]
  ------------------
   44|  96.0k|        first = false;
   45|  96.0k|        std::string s{"\n"};
   46|  96.0k|        s.append(2 * depth, ' ');
   47|  96.0k|        *p << s;
   48|   486k|    } else {
   49|   486k|        std::string s{",\n"};
   50|   486k|        s.append(2 * depth, ' ');
   51|   486k|        *p << s;
   52|   486k|    }
   53|   582k|}
_ZN4JSON19writeDictionaryOpenEP8PipelineRbm:
   57|  56.3k|{
   58|  56.3k|    *p << "{";
   59|  56.3k|    first = true;
   60|  56.3k|}
_ZN4JSON14writeArrayOpenEP8PipelineRbm:
   64|  54.8k|{
   65|  54.8k|    *p << "[";
   66|  54.8k|    first = true;
   67|  54.8k|}
_ZN4JSON20writeDictionaryCloseEP8Pipelinebm:
   71|  56.3k|{
   72|  56.3k|    writeClose(p, first, depth, "}");
   73|  56.3k|}
_ZN4JSON15writeArrayCloseEP8Pipelinebm:
   77|  54.8k|{
   78|  54.8k|    writeClose(p, first, depth, "]");
   79|  54.8k|}
_ZN4JSON18writeDictionaryKeyEP8PipelineRbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
   83|   181k|{
   84|   181k|    writeNext(p, first, depth);
   85|   181k|    *p << std::string("\"") + key + "\": ";
   86|   181k|}
_ZN4JSON19writeDictionaryItemEP8PipelineRbRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKS_m:
   91|   181k|{
   92|   181k|    writeDictionaryKey(p, first, key, depth);
   93|   181k|    value.write(p, depth);
   94|   181k|}
_ZN4JSON14writeArrayItemEP8PipelineRbRKS_m:
   98|   400k|{
   99|   400k|    writeNext(p, first, depth);
  100|   400k|    element.write(p, depth);
  101|   400k|}
_ZNK4JSON15JSON_dictionary5writeEP8Pipelinem:
  105|  56.3k|{
  106|  56.3k|    bool first = true;
  107|  56.3k|    writeDictionaryOpen(p, first, depth);
  108|   181k|    for (auto const& iter: members) {
  ------------------
  |  Branch (108:26): [True: 181k, False: 56.3k]
  ------------------
  109|   181k|        writeDictionaryItem(p, first, iter.first, iter.second, 1 + depth);
  110|   181k|    }
  111|  56.3k|    writeDictionaryClose(p, first, depth);
  112|  56.3k|}
_ZNK4JSON10JSON_array5writeEP8Pipelinem:
  116|  54.8k|{
  117|  54.8k|    bool first = true;
  118|  54.8k|    writeArrayOpen(p, first, depth);
  119|   400k|    for (auto const& element: elements) {
  ------------------
  |  Branch (119:29): [True: 400k, False: 54.8k]
  ------------------
  120|   400k|        writeArrayItem(p, first, element, 1 + depth);
  121|   400k|    }
  122|  54.8k|    writeArrayClose(p, first, depth);
  123|  54.8k|}
_ZN4JSON11JSON_stringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|   193k|    JSON_value(vt_string),
  127|   193k|    utf8(utf8)
  128|   193k|{
  129|   193k|}
_ZNK4JSON11JSON_string5writeEP8Pipelinem:
  133|   192k|{
  134|   192k|    *p << std::string("\"") + Writer::encode_string(utf8) + "\"";
  135|   192k|}
_ZN4JSON11JSON_numberC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  150|   215k|    JSON_value(vt_number),
  151|   215k|    encoded(value)
  152|   215k|{
  153|   215k|}
_ZNK4JSON11JSON_number5writeEP8Pipelinem:
  157|   215k|{
  158|   215k|    *p << encoded;
  159|   215k|}
_ZN4JSON9JSON_boolC2Eb:
  162|  4.10k|    JSON_value(vt_bool),
  163|  4.10k|    value(val)
  164|  4.10k|{
  165|  4.10k|}
_ZNK4JSON9JSON_bool5writeEP8Pipelinem:
  169|  4.10k|{
  170|  4.10k|    *p << (value ? "true" : "false");
  ------------------
  |  Branch (170:12): [True: 3.62k, False: 482]
  ------------------
  171|  4.10k|}
_ZNK4JSON9JSON_null5writeEP8Pipelinem:
  175|  76.3k|{
  176|  76.3k|    *p << "null";
  177|  76.3k|}
_ZNK4JSON5writeEP8Pipelinem:
  198|   599k|{
  199|   599k|    if (!m) {
  ------------------
  |  Branch (199:9): [True: 0, False: 599k]
  ------------------
  200|      0|        *p << "null";
  201|   599k|    } else {
  202|   599k|        m->value->write(p, depth);
  203|   599k|    }
  204|   599k|}
_ZNK4JSON7unparseEv:
  208|  17.1k|{
  209|  17.1k|    if (!m) {
  ------------------
  |  Branch (209:9): [True: 0, False: 17.1k]
  ------------------
  210|      0|        return "null";
  211|      0|    }
  212|  17.1k|    std::string s;
  213|  17.1k|    Pl_String p("unparse", nullptr, s);
  214|  17.1k|    write(&p, 0);
  215|  17.1k|    return s;
  216|  17.1k|}
_ZN4JSON6Writer13encode_stringERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  220|   417k|{
  221|   417k|    static auto constexpr hexchars = "0123456789abcdef";
  222|       |
  223|   417k|    auto begin = str.cbegin();
  224|   417k|    auto end = str.cend();
  225|   417k|    auto iter = begin;
  226|   137M|    while (iter != end) {
  ------------------
  |  Branch (226:12): [True: 137M, False: 372k]
  ------------------
  227|   137M|        auto c = static_cast<unsigned char>(*iter);
  228|   137M|        if ((c > 34 && c != '\\') || c == ' ' || c == 33) {
  ------------------
  |  Branch (228:14): [True: 137M, False: 150k]
  |  Branch (228:24): [True: 137M, False: 17.2k]
  |  Branch (228:38): [True: 119k, False: 47.9k]
  |  Branch (228:50): [True: 2.44k, False: 45.4k]
  ------------------
  229|       |            // Optimistically check that no char in str requires escaping. Hopefully we can just
  230|       |            // return the input str.
  231|   137M|            ++iter;
  232|   137M|        } 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|  45.4k|            std::string result{begin, iter};
  236|       |
  237|  79.2M|            for (; iter != end; ++iter) {
  ------------------
  |  Branch (237:20): [True: 79.2M, False: 45.4k]
  ------------------
  238|  79.2M|                auto ch = static_cast<unsigned char>(*iter);
  239|  79.2M|                if ((ch > 34 && ch != '\\') || ch == ' ' || ch == 33) {
  ------------------
  |  Branch (239:22): [True: 41.0M, False: 38.1M]
  |  Branch (239:33): [True: 40.9M, False: 136k]
  |  Branch (239:48): [True: 293k, False: 38.0M]
  |  Branch (239:61): [True: 1.51k, False: 38.0M]
  ------------------
  240|       |                    // Check for most common case first.
  241|  41.2M|                    result += *iter;
  242|  41.2M|                } else {
  243|  38.0M|                    switch (ch) {
  244|   136k|                    case '\\':
  ------------------
  |  Branch (244:21): [True: 136k, False: 37.8M]
  ------------------
  245|   136k|                        result += "\\\\";
  246|   136k|                        break;
  247|  9.95k|                    case '\"':
  ------------------
  |  Branch (247:21): [True: 9.95k, False: 38.0M]
  ------------------
  248|  9.95k|                        result += "\\\"";
  249|  9.95k|                        break;
  250|  11.1k|                    case '\b':
  ------------------
  |  Branch (250:21): [True: 11.1k, False: 38.0M]
  ------------------
  251|  11.1k|                        result += "\\b";
  252|  11.1k|                        break;
  253|  73.7k|                    case '\f':
  ------------------
  |  Branch (253:21): [True: 73.7k, False: 37.9M]
  ------------------
  254|  73.7k|                        result += "\\f";
  255|  73.7k|                        break;
  256|   121k|                    case '\n':
  ------------------
  |  Branch (256:21): [True: 121k, False: 37.9M]
  ------------------
  257|   121k|                        result += "\\n";
  258|   121k|                        break;
  259|  3.40k|                    case '\r':
  ------------------
  |  Branch (259:21): [True: 3.40k, False: 38.0M]
  ------------------
  260|  3.40k|                        result += "\\r";
  261|  3.40k|                        break;
  262|  8.18M|                    case '\t':
  ------------------
  |  Branch (262:21): [True: 8.18M, False: 29.8M]
  ------------------
  263|  8.18M|                        result += "\\t";
  264|  8.18M|                        break;
  265|  29.4M|                    default:
  ------------------
  |  Branch (265:21): [True: 29.4M, False: 8.53M]
  ------------------
  266|  29.4M|                        result += ch < 16 ? "\\u000" : "\\u001";
  ------------------
  |  Branch (266:35): [True: 1.93M, False: 27.5M]
  ------------------
  267|  29.4M|                        result += hexchars[ch % 16];
  268|  38.0M|                    }
  269|  38.0M|                }
  270|  79.2M|            }
  271|  45.4k|            return result;
  272|  45.4k|        }
  273|   137M|    }
  274|   372k|    return str;
  275|   417k|}
_ZN4JSON14makeDictionaryEv:
  279|  56.5k|{
  280|  56.5k|    return {std::make_unique<JSON_dictionary>()};
  281|  56.5k|}
_ZN4JSON19addDictionaryMemberERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  285|   182k|{
  286|   182k|    if (auto* obj = m ? dynamic_cast<JSON_dictionary*>(m->value.get()) : nullptr) {
  ------------------
  |  Branch (286:15): [True: 182k, False: 0]
  ------------------
  287|   182k|        return obj->members[Writer::encode_string(key)] = val.m ? val : makeNull();
  ------------------
  |  Branch (287:59): [True: 182k, False: 0]
  ------------------
  288|   182k|    } else {
  289|      0|        throw std::runtime_error("JSON::addDictionaryMember called on non-dictionary");
  290|      0|    }
  291|   182k|}
_ZN4JSON9makeArrayEv:
  295|  56.4k|{
  296|  56.4k|    return {std::make_unique<JSON_array>()};
  297|  56.4k|}
_ZN4JSON15addArrayElementERKS_:
  301|   403k|{
  302|   403k|    if (auto* arr = m ? dynamic_cast<JSON_array*>(m->value.get()) : nullptr) {
  ------------------
  |  Branch (302:15): [True: 403k, False: 0]
  ------------------
  303|   403k|        if (val.m) {
  ------------------
  |  Branch (303:13): [True: 403k, False: 0]
  ------------------
  304|   403k|            arr->elements.push_back(val);
  305|   403k|        } else {
  306|      0|            arr->elements.push_back(makeNull());
  307|      0|        }
  308|   403k|        return arr->elements.back();
  309|   403k|    }
  310|      0|    throw std::runtime_error("JSON::addArrayElement called on non-array");
  311|      0|    return {}; // unreachable
  312|   403k|}
_ZN4JSON10makeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  316|   193k|{
  317|   193k|    return {std::make_unique<JSON_string>(utf8)};
  318|   193k|}
_ZN4JSON10makeNumberERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  334|   215k|{
  335|   215k|    return {std::make_unique<JSON_number>(encoded)};
  336|   215k|}
_ZN4JSON8makeBoolEb:
  340|  4.10k|{
  341|  4.10k|    return {std::make_unique<JSON_bool>(value)};
  342|  4.10k|}
_ZN4JSON8makeNullEv:
  346|  76.4k|{
  347|  76.4k|    return {std::make_unique<JSON_null>()};
  348|  76.4k|}
_ZNK4JSON7isArrayEv:
  358|   602k|{
  359|   602k|    return m ? m->value->type_code == vt_array : false;
  ------------------
  |  Branch (359:12): [True: 602k, False: 0]
  ------------------
  360|   602k|}
_ZNK4JSON12isDictionaryEv:
  364|   732k|{
  365|   732k|    return m && m->value->type_code == vt_dictionary;
  ------------------
  |  Branch (365:12): [True: 732k, False: 0]
  |  Branch (365:17): [True: 130k, False: 602k]
  ------------------
  366|   732k|}
_ZN4JSON5parseERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1342|  17.2k|{
 1343|  17.2k|    is::OffsetBuffer bis("json input", s);
 1344|  17.2k|    JSONParser jp(bis, nullptr);
 1345|  17.2k|    return jp.parse();
 1346|  17.2k|}
_ZN4JSON8setStartEx:
 1350|   602k|{
 1351|   602k|    if (m) {
  ------------------
  |  Branch (1351:9): [True: 602k, False: 0]
  ------------------
 1352|   602k|        m->start = start;
 1353|   602k|    }
 1354|   602k|}
_ZN4JSON6setEndEx:
 1358|   714k|{
 1359|   714k|    if (m) {
  ------------------
  |  Branch (1359:9): [True: 714k, False: 0]
  ------------------
 1360|   714k|        m->end = end;
 1361|   714k|    }
 1362|   714k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParserC2ER11InputSourcePN4JSON7ReactorE:
  577|  17.2k|            is(is),
  578|  17.2k|            reactor(reactor),
  579|  17.2k|            p(buf)
  580|  17.2k|        {
  581|  17.2k|        }
JSON.cc:_ZN12_GLOBAL__N_110JSONParser5parseEv:
 1317|  17.2k|{
 1318|  1.60M|    while (!done) {
  ------------------
  |  Branch (1318:12): [True: 1.58M, False: 17.2k]
  ------------------
 1319|  1.58M|        getToken();
 1320|  1.58M|        handleToken();
 1321|  1.58M|    }
 1322|  17.2k|    if (parser_state != ps_done) {
  ------------------
  |  Branch (1322:9): [True: 0, False: 17.2k]
  ------------------
 1323|      0|        QTC::TC("libtests", "JSON parse premature EOF");
 1324|      0|        throw std::runtime_error("JSON: premature end of input");
 1325|      0|    }
 1326|  17.2k|    auto const& tos = stack.back().item;
 1327|  17.2k|    if (reactor && !(tos.isArray() || tos.isDictionary())) {
  ------------------
  |  Branch (1327:9): [True: 0, False: 17.2k]
  |  Branch (1327:22): [True: 0, False: 0]
  |  Branch (1327:39): [True: 0, False: 0]
  ------------------
 1328|      0|        reactor->topLevelScalar();
 1329|      0|    }
 1330|  17.2k|    return tos;
 1331|  17.2k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser8getTokenEv:
  807|  1.58M|{
  808|  1.58M|    token.clear();
  809|       |
  810|       |    // Keep track of UTF-16 surrogate pairs.
  811|  1.58M|    unsigned long high_surrogate = 0;
  812|  1.58M|    qpdf_offset_t high_offset = 0;
  813|       |
  814|   218M|    while (true) {
  ------------------
  |  Branch (814:12): [True: 218M, Folded]
  ------------------
  815|   218M|        if (p == (buf + bytes)) {
  ------------------
  |  Branch (815:13): [True: 46.9k, False: 218M]
  ------------------
  816|  46.9k|            p = buf;
  817|  46.9k|            bytes = is.read(buf, sizeof(buf));
  818|  46.9k|            if (bytes == 0) {
  ------------------
  |  Branch (818:17): [True: 17.1k, False: 29.8k]
  ------------------
  819|  17.1k|                done = true;
  820|  17.1k|                break;
  821|  17.1k|            }
  822|  46.9k|        }
  823|       |
  824|   218M|        if ((*p < 32 && *p >= 0)) {
  ------------------
  |  Branch (824:14): [True: 6.95M, False: 211M]
  |  Branch (824:25): [True: 711k, False: 6.23M]
  ------------------
  825|   711k|            if (*p == '\t' || *p == '\n' || *p == '\r') {
  ------------------
  |  Branch (825:17): [True: 0, False: 711k]
  |  Branch (825:31): [True: 711k, 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|   711k|                if (lex_state == ls_top) {
  ------------------
  |  Branch (828:21): [True: 682k, False: 28.7k]
  ------------------
  829|   682k|                    ignore();
  830|   682k|                } else {
  831|  28.7k|                    break;
  832|  28.7k|                }
  833|       |
  834|   711k|            } 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|   217M|        } else if (*p == ',') {
  ------------------
  |  Branch (839:20): [True: 759k, False: 216M]
  ------------------
  840|   759k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (840:17): [True: 487k, False: 271k]
  ------------------
  841|   487k|                ignore(ls_comma);
  842|   487k|                return;
  843|   487k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (843:24): [True: 4.20k, False: 267k]
  ------------------
  844|  4.20k|                append();
  845|   267k|            } else {
  846|   267k|                break;
  847|   267k|            }
  848|   216M|        } else if (*p == ':') {
  ------------------
  |  Branch (848:20): [True: 236k, False: 216M]
  ------------------
  849|   236k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (849:17): [True: 182k, False: 54.0k]
  ------------------
  850|   182k|                ignore(ls_colon);
  851|   182k|                return;
  852|   182k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (852:24): [True: 54.0k, False: 0]
  ------------------
  853|  54.0k|                append();
  854|  54.0k|            } else {
  855|      0|                break;
  856|      0|            }
  857|   216M|        } else if (*p == ' ') {
  ------------------
  |  Branch (857:20): [True: 16.9M, False: 199M]
  ------------------
  858|  16.9M|            if (lex_state == ls_top) {
  ------------------
  |  Branch (858:17): [True: 16.6M, False: 263k]
  ------------------
  859|  16.6M|                ignore();
  860|  16.6M|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (860:24): [True: 263k, False: 0]
  ------------------
  861|   263k|                append();
  862|   263k|            } else {
  863|      0|                break;
  864|      0|            }
  865|   199M|        } else if (*p == '{') {
  ------------------
  |  Branch (865:20): [True: 57.5k, False: 199M]
  ------------------
  866|  57.5k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (866:17): [True: 56.5k, False: 1.06k]
  ------------------
  867|  56.5k|                token_start = offset;
  868|  56.5k|                ignore(ls_begin_dict);
  869|  56.5k|                return;
  870|  56.5k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (870:24): [True: 1.06k, False: 0]
  ------------------
  871|  1.06k|                append();
  872|  1.06k|            } else {
  873|      0|                break;
  874|      0|            }
  875|   199M|        } else if (*p == '}') {
  ------------------
  |  Branch (875:20): [True: 57.0k, False: 199M]
  ------------------
  876|  57.0k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (876:17): [True: 56.3k, False: 678]
  ------------------
  877|  56.3k|                ignore(ls_end_dict);
  878|  56.3k|                return;
  879|  56.3k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (879:24): [True: 678, False: 0]
  ------------------
  880|    678|                append();
  881|    678|            } else {
  882|      0|                break;
  883|      0|            }
  884|   199M|        } else if (*p == '[') {
  ------------------
  |  Branch (884:20): [True: 64.3k, False: 199M]
  ------------------
  885|  64.3k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (885:17): [True: 56.4k, False: 7.86k]
  ------------------
  886|  56.4k|                token_start = offset;
  887|  56.4k|                ignore(ls_begin_array);
  888|  56.4k|                return;
  889|  56.4k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (889:24): [True: 7.86k, False: 0]
  ------------------
  890|  7.86k|                append();
  891|  7.86k|            } else {
  892|      0|                break;
  893|      0|            }
  894|   199M|        } else if (*p == ']') {
  ------------------
  |  Branch (894:20): [True: 60.4k, False: 199M]
  ------------------
  895|  60.4k|            if (lex_state == ls_top) {
  ------------------
  |  Branch (895:17): [True: 55.7k, False: 4.66k]
  ------------------
  896|  55.7k|                ignore(ls_end_array);
  897|  55.7k|                return;
  898|  55.7k|            } else if (lex_state == ls_string) {
  ------------------
  |  Branch (898:24): [True: 4.66k, False: 0]
  ------------------
  899|  4.66k|                append();
  900|  4.66k|            } else {
  901|      0|                break;
  902|      0|            }
  903|   199M|        } else {
  904|   199M|            switch (lex_state) {
  905|   672k|            case ls_top:
  ------------------
  |  Branch (905:13): [True: 672k, False: 198M]
  ------------------
  906|   672k|                token_start = offset;
  907|   672k|                if (*p == '"') {
  ------------------
  |  Branch (907:21): [True: 375k, False: 296k]
  ------------------
  908|   375k|                    ignore(ls_string);
  909|   375k|                } else if ((*p >= 'a') && (*p <= 'z')) {
  ------------------
  |  Branch (909:28): [True: 80.5k, False: 215k]
  |  Branch (909:43): [True: 80.5k, False: 0]
  ------------------
  910|  80.5k|                    append(ls_alpha);
  911|   215k|                } else if (*p == '-') {
  ------------------
  |  Branch (911:28): [True: 5.91k, False: 209k]
  ------------------
  912|  5.91k|                    append(ls_number_minus);
  913|   209k|                } else if ((*p >= '1') && (*p <= '9')) {
  ------------------
  |  Branch (913:28): [True: 159k, False: 50.2k]
  |  Branch (913:43): [True: 159k, False: 0]
  ------------------
  914|   159k|                    append(ls_number_before_point);
  915|   159k|                } else if (*p == '0') {
  ------------------
  |  Branch (915:28): [True: 50.1k, False: 37]
  ------------------
  916|  50.1k|                    append(ls_number_leading_zero);
  917|  50.1k|                } else {
  918|     37|                    QTC::TC("libtests", "JSON parse bad character");
  919|     37|                    throw std::runtime_error(
  920|     37|                        "JSON: offset " + std::to_string(offset) + ": unexpected character " +
  921|     37|                        std::string(p, 1));
  922|     37|                }
  923|   671k|                break;
  924|       |
  925|   671k|            case ls_number_minus:
  ------------------
  |  Branch (925:13): [True: 5.91k, False: 199M]
  ------------------
  926|  5.91k|                if ((*p >= '1') && (*p <= '9')) {
  ------------------
  |  Branch (926:21): [True: 3.78k, False: 2.13k]
  |  Branch (926:36): [True: 3.78k, False: 0]
  ------------------
  927|  3.78k|                    append(ls_number_before_point);
  928|  3.78k|                } else if (*p == '0') {
  ------------------
  |  Branch (928:28): [True: 2.13k, False: 0]
  ------------------
  929|  2.13k|                    append(ls_number_leading_zero);
  930|  2.13k|                } 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|  5.91k|                break;
  937|       |
  938|  5.91k|            case ls_number_leading_zero:
  ------------------
  |  Branch (938:13): [True: 4.04k, False: 199M]
  ------------------
  939|  4.04k|                if (*p == '.') {
  ------------------
  |  Branch (939:21): [True: 4.00k, False: 48]
  ------------------
  940|  4.00k|                    append(ls_number_point);
  941|  4.00k|                } else if (*p == 'e' || *p == 'E') {
  ------------------
  |  Branch (941:28): [True: 0, False: 48]
  |  Branch (941:41): [True: 0, False: 48]
  ------------------
  942|      0|                    append(ls_number_e);
  943|     48|                } else {
  944|     48|                    QTC::TC("libtests", "JSON parse leading zero");
  945|     48|                    throw std::runtime_error(
  946|     48|                        "JSON: offset " + std::to_string(offset) + ": number with leading zero");
  947|     48|                }
  948|  4.00k|                break;
  949|       |
  950|   319k|            case ls_number_before_point:
  ------------------
  |  Branch (950:13): [True: 319k, False: 199M]
  ------------------
  951|   319k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (951:21): [True: 306k, False: 12.2k]
  |  Branch (951:36): [True: 306k, False: 0]
  ------------------
  952|   306k|                    append();
  953|   306k|                } else if (*p == '.') {
  ------------------
  |  Branch (953:28): [True: 12.2k, False: 0]
  ------------------
  954|  12.2k|                    append(ls_number_point);
  955|  12.2k|                } 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|   319k|                break;
  961|       |
  962|  16.2k|            case ls_number_point:
  ------------------
  |  Branch (962:13): [True: 16.2k, False: 199M]
  ------------------
  963|  16.2k|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (963:21): [True: 16.2k, False: 0]
  |  Branch (963:36): [True: 16.2k, False: 0]
  ------------------
  964|  16.2k|                    append(ls_number_after_point);
  965|  16.2k|                } else {
  966|      0|                    tokenError();
  967|      0|                }
  968|  16.2k|                break;
  969|       |
  970|  2.76M|            case ls_number_after_point:
  ------------------
  |  Branch (970:13): [True: 2.76M, False: 196M]
  ------------------
  971|  2.76M|                if ((*p >= '0') && (*p <= '9')) {
  ------------------
  |  Branch (971:21): [True: 2.76M, False: 0]
  |  Branch (971:36): [True: 2.76M, False: 0]
  ------------------
  972|  2.76M|                    append();
  973|  2.76M|                } 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|  2.76M|                break;
  979|       |
  980|      0|            case ls_number_e:
  ------------------
  |  Branch (980:13): [True: 0, False: 199M]
  ------------------
  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: 199M]
  ------------------
  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: 199M]
  ------------------
  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|   242k|            case ls_alpha:
  ------------------
  |  Branch (1007:13): [True: 242k, False: 199M]
  ------------------
 1008|   242k|                if ((*p >= 'a') && (*p <= 'z')) {
  ------------------
  |  Branch (1008:21): [True: 242k, False: 0]
  |  Branch (1008:36): [True: 242k, False: 0]
  ------------------
 1009|   242k|                    append();
 1010|   242k|                } else {
 1011|      0|                    tokenError();
 1012|      0|                }
 1013|   242k|                break;
 1014|       |
 1015|   117M|            case ls_string:
  ------------------
  |  Branch (1015:13): [True: 117M, False: 82.0M]
  ------------------
 1016|   117M|                if (*p == '"') {
  ------------------
  |  Branch (1016:21): [True: 375k, False: 117M]
  ------------------
 1017|   375k|                    if (high_offset) {
  ------------------
  |  Branch (1017:25): [True: 0, False: 375k]
  ------------------
 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|   375k|                    ignore(ls_after_string);
 1024|   375k|                    return;
 1025|   117M|                } else if (*p == '\\') {
  ------------------
  |  Branch (1025:28): [True: 19.0M, False: 98.0M]
  ------------------
 1026|  19.0M|                    ignore(ls_backslash);
 1027|  98.0M|                } else {
 1028|  98.0M|                    append();
 1029|  98.0M|                }
 1030|   117M|                break;
 1031|       |
 1032|   117M|            case ls_backslash:
  ------------------
  |  Branch (1032:13): [True: 19.0M, False: 180M]
  ------------------
 1033|  19.0M|                lex_state = ls_string;
 1034|  19.0M|                switch (*p) {
 1035|  68.3k|                case '\\':
  ------------------
  |  Branch (1035:17): [True: 68.3k, False: 18.9M]
  ------------------
 1036|  73.3k|                case '\"':
  ------------------
  |  Branch (1036:17): [True: 4.97k, False: 19.0M]
  ------------------
 1037|  73.3k|                case '/':
  ------------------
  |  Branch (1037:17): [True: 0, False: 19.0M]
  ------------------
 1038|       |                    // \/ is allowed in json input, but so is /, so we don't map / to \/ in output.
 1039|  73.3k|                    token += *p;
 1040|  73.3k|                    break;
 1041|  5.56k|                case 'b':
  ------------------
  |  Branch (1041:17): [True: 5.56k, False: 19.0M]
  ------------------
 1042|  5.56k|                    token += '\b';
 1043|  5.56k|                    break;
 1044|  36.8k|                case 'f':
  ------------------
  |  Branch (1044:17): [True: 36.8k, False: 18.9M]
  ------------------
 1045|  36.8k|                    token += '\f';
 1046|  36.8k|                    break;
 1047|  60.8k|                case 'n':
  ------------------
  |  Branch (1047:17): [True: 60.8k, False: 18.9M]
  ------------------
 1048|  60.8k|                    token += '\n';
 1049|  60.8k|                    break;
 1050|  1.70k|                case 'r':
  ------------------
  |  Branch (1050:17): [True: 1.70k, False: 19.0M]
  ------------------
 1051|  1.70k|                    token += '\r';
 1052|  1.70k|                    break;
 1053|  4.09M|                case 't':
  ------------------
  |  Branch (1053:17): [True: 4.09M, False: 14.9M]
  ------------------
 1054|  4.09M|                    token += '\t';
 1055|  4.09M|                    break;
 1056|  14.7M|                case 'u':
  ------------------
  |  Branch (1056:17): [True: 14.7M, False: 4.26M]
  ------------------
 1057|  14.7M|                    lex_state = ls_u4;
 1058|  14.7M|                    u_count = 0;
 1059|  14.7M|                    u_value = 0;
 1060|  14.7M|                    break;
 1061|      0|                default:
  ------------------
  |  Branch (1061:17): [True: 0, False: 19.0M]
  ------------------
 1062|      0|                    lex_state = ls_backslash;
 1063|      0|                    tokenError();
 1064|  19.0M|                }
 1065|  19.0M|                ignore();
 1066|  19.0M|                break;
 1067|       |
 1068|  58.9M|            case ls_u4:
  ------------------
  |  Branch (1068:13): [True: 58.9M, False: 140M]
  ------------------
 1069|  58.9M|                using ui = unsigned int;
 1070|  58.9M|                if (ui val = ui(util::hex_decode_char(*p)); val < 16) {
  ------------------
  |  Branch (1070:61): [True: 58.9M, False: 0]
  ------------------
 1071|  58.9M|                    u_value = 16 * u_value + val;
 1072|  58.9M|                } else {
 1073|      0|                    tokenError();
 1074|      0|                }
 1075|  58.9M|                if (++u_count == 4) {
  ------------------
  |  Branch (1075:21): [True: 14.7M, False: 44.2M]
  ------------------
 1076|  14.7M|                    handle_u_code(u_value, offset - 5, high_surrogate, high_offset, token);
 1077|  14.7M|                    lex_state = ls_string;
 1078|  14.7M|                }
 1079|  58.9M|                ignore();
 1080|  58.9M|                break;
 1081|       |
 1082|      0|            default:
  ------------------
  |  Branch (1082:13): [True: 0, False: 199M]
  ------------------
 1083|      0|                throw std::logic_error("JSONParser::getToken : trying to handle delimiter state");
 1084|   199M|            }
 1085|   199M|        }
 1086|   218M|    }
 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|   313k|    if (!token.empty()) {
  ------------------
  |  Branch (1091:9): [True: 296k, False: 17.1k]
  ------------------
 1092|   296k|        switch (lex_state) {
 1093|      0|        case ls_top:
  ------------------
  |  Branch (1093:9): [True: 0, False: 296k]
  ------------------
 1094|       |            // Can't happen
 1095|      0|            throw std::logic_error("tok_start set in ls_top while parsing");
 1096|      0|            break;
 1097|       |
 1098|  48.2k|        case ls_number_leading_zero:
  ------------------
  |  Branch (1098:9): [True: 48.2k, False: 247k]
  ------------------
 1099|   199k|        case ls_number_before_point:
  ------------------
  |  Branch (1099:9): [True: 151k, False: 145k]
  ------------------
 1100|   215k|        case ls_number_after_point:
  ------------------
  |  Branch (1100:9): [True: 16.2k, False: 279k]
  ------------------
 1101|   215k|            lex_state = ls_number;
 1102|   215k|            break;
 1103|       |
 1104|      0|        case ls_number:
  ------------------
  |  Branch (1104:9): [True: 0, False: 296k]
  ------------------
 1105|  80.5k|        case ls_alpha:
  ------------------
  |  Branch (1105:9): [True: 80.5k, False: 215k]
  ------------------
 1106|       |            // terminal state
 1107|  80.5k|            break;
 1108|       |
 1109|      0|        default:
  ------------------
  |  Branch (1109:9): [True: 0, False: 296k]
  ------------------
 1110|      0|            tokenError();
 1111|   296k|        }
 1112|   296k|    }
 1113|   313k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6ignoreEv:
  790|  95.3M|{
  791|  95.3M|    ++p;
  792|  95.3M|    ++offset;
  793|  95.3M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6ignoreENS0_11lex_state_eE:
  799|  20.6M|{
  800|  20.6M|    lex_state = next;
  801|  20.6M|    ++p;
  802|  20.6M|    ++offset;
  803|  20.6M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6appendEv:
  770|   101M|{
  771|   101M|    token += *p;
  772|   101M|    ++p;
  773|   101M|    ++offset;
  774|   101M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser6appendENS0_11lex_state_eE:
  780|   334k|{
  781|   334k|    lex_state = next;
  782|   334k|    token += *p;
  783|   334k|    ++p;
  784|   334k|    ++offset;
  785|   334k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser13handle_u_codeEmxRmRxRNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  674|  14.7M|{
  675|  14.7M|    if ((codepoint & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (675:9): [True: 0, False: 14.7M]
  ------------------
  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|  14.7M|    } else if ((codepoint & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (687:16): [True: 0, False: 14.7M]
  ------------------
  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|  14.7M|    } else {
  699|  14.7M|        result += QUtil::toUTF8(codepoint);
  700|  14.7M|    }
  701|  14.7M|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser11handleTokenEv:
 1117|  1.58M|{
 1118|  1.58M|    if (lex_state == ls_top) {
  ------------------
  |  Branch (1118:9): [True: 17.1k, False: 1.56M]
  ------------------
 1119|  17.1k|        return;
 1120|  17.1k|    }
 1121|       |
 1122|  1.56M|    if (parser_state == ps_done) {
  ------------------
  |  Branch (1122:9): [True: 0, False: 1.56M]
  ------------------
 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|  1.56M|    const static JSON null_item = JSON::makeNull();
 1130|  1.56M|    JSON item;
 1131|  1.56M|    auto tos = stack.empty() ? null_item : stack.back().item;
  ------------------
  |  Branch (1131:16): [True: 17.2k, False: 1.54M]
  ------------------
 1132|  1.56M|    auto ls = lex_state;
 1133|  1.56M|    lex_state = ls_top;
 1134|       |
 1135|  1.56M|    switch (ls) {
 1136|  56.5k|    case ls_begin_dict:
  ------------------
  |  Branch (1136:5): [True: 56.5k, False: 1.51M]
  ------------------
 1137|  56.5k|        item = JSON::makeDictionary();
 1138|  56.5k|        break;
 1139|       |
 1140|  56.4k|    case ls_begin_array:
  ------------------
  |  Branch (1140:5): [True: 56.4k, False: 1.51M]
  ------------------
 1141|  56.4k|        item = JSON::makeArray();
 1142|  56.4k|        break;
 1143|       |
 1144|   182k|    case ls_colon:
  ------------------
  |  Branch (1144:5): [True: 182k, False: 1.38M]
  ------------------
 1145|   182k|        if (parser_state != ps_dict_after_key) {
  ------------------
  |  Branch (1145:13): [True: 0, False: 182k]
  ------------------
 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|   182k|        parser_state = ps_dict_after_colon;
 1151|   182k|        return;
 1152|       |
 1153|   487k|    case ls_comma:
  ------------------
  |  Branch (1153:5): [True: 487k, False: 1.07M]
  ------------------
 1154|   487k|        if (!((parser_state == ps_dict_after_item) || (parser_state == ps_array_after_item))) {
  ------------------
  |  Branch (1154:15): [True: 139k, False: 348k]
  |  Branch (1154:55): [True: 348k, 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|   487k|        if (parser_state == ps_dict_after_item) {
  ------------------
  |  Branch (1159:13): [True: 139k, False: 348k]
  ------------------
 1160|   139k|            parser_state = ps_dict_after_comma;
 1161|   348k|        } else if (parser_state == ps_array_after_item) {
  ------------------
  |  Branch (1161:20): [True: 348k, False: 0]
  ------------------
 1162|   348k|            parser_state = ps_array_after_comma;
 1163|   348k|        } else {
 1164|      0|            throw std::logic_error("JSONParser::handleToken: unexpected parser state for comma");
 1165|      0|        }
 1166|   487k|        return;
 1167|       |
 1168|   487k|    case ls_end_array:
  ------------------
  |  Branch (1168:5): [True: 55.7k, False: 1.51M]
  ------------------
 1169|  55.7k|        if (!(parser_state == ps_array_begin || parser_state == ps_array_after_item)) {
  ------------------
  |  Branch (1169:15): [True: 1.83k, False: 53.9k]
  |  Branch (1169:49): [True: 53.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|  55.7k|        parser_state = stack.back().state;
 1175|  55.7k|        tos.setEnd(offset);
 1176|  55.7k|        if (reactor) {
  ------------------
  |  Branch (1176:13): [True: 0, False: 55.7k]
  ------------------
 1177|      0|            reactor->containerEnd(tos);
 1178|      0|        }
 1179|  55.7k|        if (parser_state != ps_done) {
  ------------------
  |  Branch (1179:13): [True: 55.7k, False: 0]
  ------------------
 1180|  55.7k|            stack.pop_back();
 1181|  55.7k|        }
 1182|  55.7k|        return;
 1183|       |
 1184|  56.3k|    case ls_end_dict:
  ------------------
  |  Branch (1184:5): [True: 56.3k, False: 1.51M]
  ------------------
 1185|  56.3k|        if (!((parser_state == ps_dict_begin) || (parser_state == ps_dict_after_item))) {
  ------------------
  |  Branch (1185:15): [True: 13.3k, False: 43.0k]
  |  Branch (1185:50): [True: 43.0k, 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|  56.3k|        parser_state = stack.back().state;
 1191|  56.3k|        tos.setEnd(offset);
 1192|  56.3k|        if (reactor) {
  ------------------
  |  Branch (1192:13): [True: 0, False: 56.3k]
  ------------------
 1193|      0|            reactor->containerEnd(tos);
 1194|      0|        }
 1195|  56.3k|        if (parser_state != ps_done) {
  ------------------
  |  Branch (1195:13): [True: 39.2k, False: 17.1k]
  ------------------
 1196|  39.2k|            stack.pop_back();
 1197|  39.2k|        }
 1198|  56.3k|        return;
 1199|       |
 1200|   215k|    case ls_number:
  ------------------
  |  Branch (1200:5): [True: 215k, False: 1.35M]
  ------------------
 1201|   215k|        item = JSON::makeNumber(token);
 1202|   215k|        break;
 1203|       |
 1204|  80.5k|    case ls_alpha:
  ------------------
  |  Branch (1204:5): [True: 80.5k, False: 1.48M]
  ------------------
 1205|  80.5k|        if (token == "true") {
  ------------------
  |  Branch (1205:13): [True: 3.62k, False: 76.9k]
  ------------------
 1206|  3.62k|            item = JSON::makeBool(true);
 1207|  76.9k|        } else if (token == "false") {
  ------------------
  |  Branch (1207:20): [True: 482, False: 76.4k]
  ------------------
 1208|    482|            item = JSON::makeBool(false);
 1209|  76.4k|        } else if (token == "null") {
  ------------------
  |  Branch (1209:20): [True: 76.4k, False: 0]
  ------------------
 1210|  76.4k|            item = JSON::makeNull();
 1211|  76.4k|        } 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|  80.5k|        break;
 1217|       |
 1218|   375k|    case ls_after_string:
  ------------------
  |  Branch (1218:5): [True: 375k, False: 1.19M]
  ------------------
 1219|   375k|        if (parser_state == ps_dict_begin || parser_state == ps_dict_after_comma) {
  ------------------
  |  Branch (1219:13): [True: 43.1k, False: 332k]
  |  Branch (1219:46): [True: 139k, False: 193k]
  ------------------
 1220|   182k|            dict_key = token;
 1221|   182k|            dict_key_offset = token_start;
 1222|   182k|            parser_state = ps_dict_after_key;
 1223|   182k|            return;
 1224|   193k|        } else {
 1225|   193k|            item = JSON::makeString(token);
 1226|   193k|        }
 1227|   193k|        break;
 1228|       |
 1229|   193k|    default:
  ------------------
  |  Branch (1229:5): [True: 0, False: 1.56M]
  ------------------
 1230|      0|        throw std::runtime_error(
 1231|      0|            "JSON: offset " + std::to_string(offset) + ": premature end of input");
 1232|      0|        break;
 1233|  1.56M|    }
 1234|       |
 1235|   602k|    item.setStart(token_start);
 1236|   602k|    item.setEnd(offset);
 1237|       |
 1238|   602k|    switch (parser_state) {
  ------------------
  |  Branch (1238:13): [True: 602k, False: 0]
  ------------------
 1239|      0|    case ps_dict_begin:
  ------------------
  |  Branch (1239:5): [True: 0, False: 602k]
  ------------------
 1240|      0|    case ps_dict_after_comma:
  ------------------
  |  Branch (1240:5): [True: 0, False: 602k]
  ------------------
 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|   182k|    case ps_dict_after_colon:
  ------------------
  |  Branch (1246:5): [True: 182k, False: 420k]
  ------------------
 1247|   182k|        if (!reactor || !reactor->dictionaryItem(dict_key, item)) {
  ------------------
  |  Branch (1247:13): [True: 182k, False: 0]
  |  Branch (1247:25): [True: 0, False: 0]
  ------------------
 1248|   182k|            tos.addDictionaryMember(dict_key, item);
 1249|   182k|        }
 1250|   182k|        parser_state = ps_dict_after_item;
 1251|   182k|        break;
 1252|       |
 1253|  54.5k|    case ps_array_begin:
  ------------------
  |  Branch (1253:5): [True: 54.5k, False: 548k]
  ------------------
 1254|   403k|    case ps_array_after_comma:
  ------------------
  |  Branch (1254:5): [True: 348k, False: 254k]
  ------------------
 1255|   403k|        if (!reactor || !reactor->arrayItem(item)) {
  ------------------
  |  Branch (1255:13): [True: 403k, False: 0]
  |  Branch (1255:25): [True: 0, False: 0]
  ------------------
 1256|   403k|            tos.addArrayElement(item);
 1257|   403k|        }
 1258|   403k|        parser_state = ps_array_after_item;
 1259|   403k|        break;
 1260|       |
 1261|  17.2k|    case ps_top:
  ------------------
  |  Branch (1261:5): [True: 17.2k, False: 585k]
  ------------------
 1262|  17.2k|        if (!(item.isDictionary() || item.isArray())) {
  ------------------
  |  Branch (1262:15): [True: 17.2k, 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|  17.2k|        parser_state = ps_done;
 1268|  17.2k|        break;
 1269|       |
 1270|      0|    case ps_dict_after_key:
  ------------------
  |  Branch (1270:5): [True: 0, False: 602k]
  ------------------
 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: 602k]
  ------------------
 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: 602k]
  ------------------
 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: 602k]
  ------------------
 1288|      0|        throw std::logic_error("JSONParser::handleToken: unexpected parser state");
 1289|   602k|    }
 1290|       |
 1291|   602k|    if (item.isDictionary() || item.isArray()) {
  ------------------
  |  Branch (1291:9): [True: 56.5k, False: 546k]
  |  Branch (1291:32): [True: 56.4k, False: 489k]
  ------------------
 1292|   112k|        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|   112k|        if (item.isDictionary()) {
  ------------------
  |  Branch (1296:13): [True: 56.5k, False: 56.4k]
  ------------------
 1297|  56.5k|            if (reactor) {
  ------------------
  |  Branch (1297:17): [True: 0, False: 56.5k]
  ------------------
 1298|      0|                reactor->dictionaryStart();
 1299|      0|            }
 1300|  56.5k|            parser_state = ps_dict_begin;
 1301|  56.5k|        } else if (item.isArray()) {
  ------------------
  |  Branch (1301:20): [True: 56.4k, False: 0]
  ------------------
 1302|  56.4k|            if (reactor) {
  ------------------
  |  Branch (1302:17): [True: 0, False: 56.4k]
  ------------------
 1303|      0|                reactor->arrayStart();
 1304|      0|            }
 1305|  56.4k|            parser_state = ps_array_begin;
 1306|  56.4k|        }
 1307|       |
 1308|   112k|        if (stack.size() > 500) {
  ------------------
  |  Branch (1308:13): [True: 1, False: 112k]
  ------------------
 1309|      1|            throw std::runtime_error(
 1310|      1|                "JSON: offset " + std::to_string(offset) + ": maximum object depth exceeded");
 1311|      1|        }
 1312|   112k|    }
 1313|   602k|}
JSON.cc:_ZN12_GLOBAL__N_110JSONParser10StackFrameC2ENS0_14parser_state_eER4JSON:
  625|   112k|                state(state),
  626|   112k|                item(item)
  627|   112k|            {
  628|   112k|            }

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

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

_ZN10NNTreeImpl4warnERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   32|  6.77k|{
   33|  6.77k|    qpdf.warn(qpdf_e_damaged_pdf, get_description(node), 0, msg);
   34|  6.77k|    if (++error_count > 5 && qpdf.doc().reconstructed_xref()) {
  ------------------
  |  Branch (34:9): [True: 3.15k, False: 3.62k]
  |  Branch (34:30): [True: 2.71k, False: 440]
  ------------------
   35|  2.71k|        error(node, "too many errors - giving up");
   36|  2.71k|    }
   37|  6.77k|}
_ZNK10NNTreeImpl5errorERK16QPDFObjectHandleRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   41|  4.16k|{
   42|  4.16k|    throw QPDFExc(qpdf_e_damaged_pdf, qpdf.getFilename(), get_description(node), 0, msg);
   43|  4.16k|}
_ZN14NNTreeIterator12updateIValueEb:
   47|  57.9k|{
   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|  57.9k|    Array items = node[impl.itemsKey()];
   62|  57.9k|    ivalue.first = items[item_number];
   63|  57.9k|    ivalue.second = items[item_number + 1];
   64|  57.9k|    if (ivalue.second) {
  ------------------
  |  Branch (64:9): [True: 55.1k, False: 2.77k]
  ------------------
   65|  55.1k|        return;
   66|  55.1k|    }
   67|       |
   68|  2.77k|    if (item_number < 0 || !node) {
  ------------------
  |  Branch (68:9): [True: 2.74k, False: 32]
  |  Branch (68:28): [True: 0, False: 32]
  ------------------
   69|  2.74k|        util::assertion(
   70|  2.74k|            allow_invalid, "attempt made to dereference an invalid name/number tree iterator");
   71|  2.74k|        return;
   72|  2.74k|    }
   73|     32|    impl.error(node, "update ivalue: items array is too short");
   74|     32|}
_ZN14NNTreeIterator10getNextKidERNS_11PathElementEb:
   78|  1.75k|{
   79|  2.34k|    while (true) {
  ------------------
  |  Branch (79:12): [True: 2.25k, Folded]
  ------------------
   80|  2.25k|        pe.kid_number += backward ? -1 : 1;
  ------------------
  |  Branch (80:26): [True: 0, False: 2.25k]
  ------------------
   81|  2.25k|        Dictionary result = pe.node["/Kids"][pe.kid_number];
   82|  2.25k|        if (result.contains("/Kids") || result.contains(impl.itemsKey())) {
  ------------------
  |  Branch (82:13): [True: 226, False: 2.03k]
  |  Branch (82:13): [True: 1.06k, False: 1.19k]
  |  Branch (82:41): [True: 836, False: 1.19k]
  ------------------
   83|  1.06k|            return result;
   84|  1.06k|        }
   85|  1.19k|        if (pe.kid_number < 0 || std::cmp_greater_equal(pe.kid_number, pe.node["/Kids"].size())) {
  ------------------
  |  Branch (85:13): [True: 0, False: 1.19k]
  |  Branch (85:13): [True: 608, False: 589]
  |  Branch (85:34): [True: 608, False: 589]
  ------------------
   86|    608|            return {};
   87|    608|        }
   88|    589|        impl.warn(pe.node, "skipping over invalid kid at index " + std::to_string(pe.kid_number));
   89|    589|    }
   90|  1.75k|}
_ZN14NNTreeIterator9incrementEb:
   93|  16.5k|{
   94|  16.5k|    if (item_number < 0) {
  ------------------
  |  Branch (94:9): [True: 0, False: 16.5k]
  ------------------
   95|      0|        deepen(impl.tree_root, !backward, true);
   96|      0|        return;
   97|      0|    }
   98|       |
   99|  18.9k|    while (valid()) {
  ------------------
  |  Branch (99:12): [True: 17.9k, False: 980]
  ------------------
  100|  17.9k|        item_number += backward ? -2 : 2;
  ------------------
  |  Branch (100:24): [True: 0, False: 17.9k]
  ------------------
  101|  17.9k|        Array items = node[impl.itemsKey()];
  102|  17.9k|        if (item_number < 0 || std::cmp_greater_equal(item_number, items.size())) {
  ------------------
  |  Branch (102:13): [True: 0, False: 17.9k]
  |  Branch (102:32): [True: 1.82k, False: 16.1k]
  ------------------
  103|  1.82k|            setItemNumber(QPDFObjectHandle(), -1);
  104|  2.61k|            while (!path.empty()) {
  ------------------
  |  Branch (104:20): [True: 1.75k, False: 855]
  ------------------
  105|  1.75k|                auto& element = path.back();
  106|  1.75k|                if (auto pe_node = getNextKid(element, backward)) {
  ------------------
  |  Branch (106:26): [True: 1.06k, False: 696]
  ------------------
  107|  1.06k|                    if (deepen(pe_node, !backward, false)) {
  ------------------
  |  Branch (107:25): [True: 971, False: 91]
  ------------------
  108|    971|                        break;
  109|    971|                    }
  110|  1.06k|                } else {
  111|    696|                    path.pop_back();
  112|    696|                }
  113|  1.75k|            }
  114|  1.82k|        }
  115|  17.9k|        if (item_number >= 0) {
  ------------------
  |  Branch (115:13): [True: 17.1k, False: 855]
  ------------------
  116|  17.1k|            items = node[impl.itemsKey()];
  117|  17.1k|            if (std::cmp_greater_equal(item_number + 1, items.size())) {
  ------------------
  |  Branch (117:17): [True: 292, False: 16.8k]
  ------------------
  118|    292|                impl.warn(node, "items array doesn't have enough elements");
  119|  16.8k|            } else if (!impl.keyValid(items[item_number])) {
  ------------------
  |  Branch (119:24): [True: 768, False: 16.0k]
  ------------------
  120|    768|                impl.warn(node, ("item " + std::to_string(item_number) + " has the wrong type"));
  121|  16.0k|            } else if (!impl.value_valid(items[item_number + 1])) {
  ------------------
  |  Branch (121:24): [True: 549, False: 15.5k]
  ------------------
  122|    549|                impl.warn(node, "item " + std::to_string(item_number + 1) + " is invalid");
  123|  15.5k|            } else {
  124|  15.5k|                return;
  125|  15.5k|            }
  126|  17.1k|        }
  127|  17.9k|    }
  128|  16.5k|}
_ZN14NNTreeIterator11resetLimitsEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  132|  4.16k|{
  133|  4.16k|    while (true) {
  ------------------
  |  Branch (133:12): [True: 4.16k, Folded]
  ------------------
  134|  4.16k|        if (parent == path.end()) {
  ------------------
  |  Branch (134:13): [True: 2.97k, False: 1.18k]
  ------------------
  135|  2.97k|            a_node.erase("/Limits");
  136|  2.97k|            return;
  137|  2.97k|        }
  138|       |
  139|  1.18k|        QPDFObjectHandle first;
  140|  1.18k|        QPDFObjectHandle last;
  141|  1.18k|        Array items = a_node[impl.itemsKey()];
  142|  1.18k|        size_t nitems = items.size();
  143|  1.18k|        if (nitems >= 2) {
  ------------------
  |  Branch (143:13): [True: 1.13k, False: 48]
  ------------------
  144|  1.13k|            first = items[0];
  145|  1.13k|            last = items[(nitems - 1u) & ~1u];
  146|  1.13k|        } else {
  147|     48|            Array kids = a_node["/Kids"];
  148|     48|            size_t nkids = kids.size();
  149|     48|            if (nkids > 0) {
  ------------------
  |  Branch (149:17): [True: 48, False: 0]
  ------------------
  150|     48|                Array first_limits = kids[0]["/Limits"];
  151|     48|                if (first_limits.size() >= 2) {
  ------------------
  |  Branch (151:21): [True: 48, False: 0]
  ------------------
  152|     48|                    first = first_limits[0];
  153|     48|                    last = kids[nkids - 1u]["/Limits"][1];
  154|     48|                }
  155|     48|            }
  156|     48|        }
  157|  1.18k|        if (!(first && last)) {
  ------------------
  |  Branch (157:15): [True: 1.18k, False: 0]
  |  Branch (157:24): [True: 1.18k, False: 0]
  ------------------
  158|      0|            impl.warn(a_node, "unable to determine limits");
  159|  1.18k|        } else {
  160|  1.18k|            Array olimits = a_node["/Limits"];
  161|  1.18k|            if (olimits.size() == 2) {
  ------------------
  |  Branch (161:17): [True: 1.01k, False: 164]
  ------------------
  162|  1.01k|                auto ofirst = olimits[0];
  163|  1.01k|                auto olast = olimits[1];
  164|  1.01k|                if (impl.keyValid(ofirst) && impl.keyValid(olast) &&
  ------------------
  |  Branch (164:21): [True: 1.01k, False: 0]
  |  Branch (164:21): [True: 0, False: 1.01k]
  |  Branch (164:46): [True: 1.01k, False: 0]
  ------------------
  165|  1.01k|                    impl.compareKeys(first, ofirst) == 0 && impl.compareKeys(last, olast) == 0) {
  ------------------
  |  Branch (165:21): [True: 1.01k, False: 0]
  |  Branch (165:61): [True: 0, False: 1.01k]
  ------------------
  166|      0|                    return;
  167|      0|                }
  168|  1.01k|            }
  169|  1.18k|            if (a_node != path.begin()->node) {
  ------------------
  |  Branch (169:17): [True: 1.13k, False: 48]
  ------------------
  170|  1.13k|                a_node.replace("/Limits", Array({first, last}));
  171|  1.13k|            }
  172|  1.18k|        }
  173|       |
  174|  1.18k|        if (parent == path.begin()) {
  ------------------
  |  Branch (174:13): [True: 1.18k, False: 0]
  ------------------
  175|  1.18k|            return;
  176|  1.18k|        }
  177|      0|        a_node = parent->node;
  178|      0|        --parent;
  179|      0|    }
  180|  4.16k|}
_ZN14NNTreeIterator5splitEN4qpdf10DictionaryENSt3__115__list_iteratorINS_11PathElementEPvEE:
  184|  3.99k|{
  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|  3.99k|    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|  3.99k|    Array kids = to_split["/Kids"];
  216|  3.99k|    size_t nkids = kids.size();
  217|  3.99k|    Array items = to_split[impl.itemsKey()];
  218|  3.99k|    size_t nitems = items.size();
  219|       |
  220|  3.99k|    Array first_half;
  221|  3.99k|    size_t n = 0;
  222|  3.99k|    std::string key;
  223|  3.99k|    size_t threshold = static_cast<size_t>(impl.split_threshold);
  224|  3.99k|    if (nkids > 0) {
  ------------------
  |  Branch (224:9): [True: 48, False: 3.94k]
  ------------------
  225|     48|        first_half = kids;
  226|     48|        n = nkids;
  227|     48|        key = "/Kids";
  228|  3.94k|    } else {
  229|  3.94k|        util::assertion(nitems > 0, "NNTreeIterator::split called on invalid node");
  230|  3.94k|        first_half = items;
  231|  3.94k|        n = nitems;
  232|  3.94k|        threshold *= 2;
  233|  3.94k|        key = impl.itemsKey();
  234|  3.94k|    }
  235|       |
  236|  3.99k|    if (n <= threshold) {
  ------------------
  |  Branch (236:9): [True: 3.91k, False: 82]
  ------------------
  237|  3.91k|        return;
  238|  3.91k|    }
  239|       |
  240|     82|    bool is_root = parent == path.end();
  241|     82|    bool is_leaf = nitems > 0;
  242|       |
  243|       |    // CURRENT STATE: tree is in original state; iterator is valid and unchanged.
  244|       |
  245|     82|    if (is_root) {
  ------------------
  |  Branch (245:9): [True: 34, False: 48]
  ------------------
  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|     34|        Dictionary first_node = impl.qpdf.makeIndirectObject(Dictionary({{key, first_half}}));
  261|     34|        auto new_kids = Array::empty();
  262|     34|        new_kids.push_back(first_node);
  263|     34|        to_split.erase("/Limits"); // already shouldn't be there for root
  264|     34|        to_split.erase(impl.itemsKey());
  265|     34|        to_split.replace("/Kids", new_kids);
  266|     34|        if (is_leaf) {
  ------------------
  |  Branch (266:13): [True: 34, False: 0]
  ------------------
  267|     34|            node = first_node;
  268|     34|        } else {
  269|      0|            auto next = path.begin();
  270|      0|            next->node = first_node;
  271|      0|        }
  272|     34|        this->path.emplace_front(to_split, 0);
  273|     34|        parent = path.begin();
  274|     34|        to_split = first_node;
  275|     34|    }
  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|     82|    auto second_half = Array::empty();
  283|     82|    auto start_idx = static_cast<int>((n / 2) & ~1u);
  284|  2.87k|    while (std::cmp_greater(first_half.size(), start_idx)) {
  ------------------
  |  Branch (284:12): [True: 2.78k, False: 82]
  ------------------
  285|  2.78k|        second_half.push_back(first_half[start_idx]);
  286|  2.78k|        first_half.erase(start_idx);
  287|  2.78k|    }
  288|     82|    resetLimits(to_split, parent);
  289|       |
  290|       |    // Create a new node to contain the second half
  291|     82|    Dictionary second_node = impl.qpdf.makeIndirectObject(Dictionary({{key, second_half}}));
  292|     82|    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|     82|    Array parent_kids = parent->node["/Kids"];
  303|     82|    if (!parent_kids) {
  ------------------
  |  Branch (303:9): [True: 0, False: 82]
  ------------------
  304|      0|        impl.error(parent->node, "parent node has no /Kids array");
  305|      0|    }
  306|     82|    parent_kids.insert(parent->kid_number + 1, second_node);
  307|     82|    auto cur_elem = parent;
  308|     82|    ++cur_elem; // points to end() for leaf nodes
  309|     82|    int old_idx = (is_leaf ? item_number : cur_elem->kid_number);
  ------------------
  |  Branch (309:20): [True: 82, False: 0]
  ------------------
  310|     82|    if (old_idx >= start_idx) {
  ------------------
  |  Branch (310:9): [True: 82, False: 0]
  ------------------
  311|     82|        ++parent->kid_number;
  312|     82|        if (is_leaf) {
  ------------------
  |  Branch (312:13): [True: 82, False: 0]
  ------------------
  313|     82|            setItemNumber(second_node, item_number - start_idx);
  314|     82|        } else {
  315|      0|            cur_elem->node = second_node;
  316|      0|            cur_elem->kid_number -= start_idx;
  317|      0|        }
  318|     82|    }
  319|     82|    if (!is_root) {
  ------------------
  |  Branch (319:9): [True: 48, False: 34]
  ------------------
  320|     48|        auto next = parent->node;
  321|     48|        resetLimits(next, parent);
  322|     48|        --parent;
  323|     48|        split(next, parent);
  324|     48|    }
  325|     82|}
_ZN14NNTreeIterator15lastPathElementEv:
  329|  7.89k|{
  330|  7.89k|    return path.empty() ? path.end() : std::prev(path.end());
  ------------------
  |  Branch (330:12): [True: 5.95k, False: 1.94k]
  ------------------
  331|  7.89k|}
_ZN14NNTreeIterator11insertAfterERK16QPDFObjectHandleS2_:
  335|  3.53k|{
  336|  3.53k|    if (!valid()) {
  ------------------
  |  Branch (336:9): [True: 0, False: 3.53k]
  ------------------
  337|      0|        impl.insertFirst(key, value);
  338|      0|        deepen(impl.tree_root, true, false);
  339|      0|        return;
  340|      0|    }
  341|       |
  342|  3.53k|    Array items = node[impl.itemsKey()];
  343|  3.53k|    if (!items) {
  ------------------
  |  Branch (343:9): [True: 0, False: 3.53k]
  ------------------
  344|      0|        impl.error(node, "node contains no items array");
  345|      0|    }
  346|       |
  347|  3.53k|    if (std::cmp_less(items.size(), item_number + 2)) {
  ------------------
  |  Branch (347:9): [True: 0, False: 3.53k]
  ------------------
  348|      0|        impl.error(node, "insert: items array is too short");
  349|      0|    }
  350|  3.53k|    if (!(key && value)) {
  ------------------
  |  Branch (350:11): [True: 3.53k, False: 0]
  |  Branch (350:18): [True: 3.53k, False: 0]
  ------------------
  351|      0|        impl.error(node, "insert: key or value is null");
  352|      0|    }
  353|  3.53k|    if (!impl.value_valid(value)) {
  ------------------
  |  Branch (353:9): [True: 0, False: 3.53k]
  ------------------
  354|      0|        impl.error(node, "insert: value is invalid");
  355|      0|    }
  356|  3.53k|    items.insert(item_number + 2, key);
  357|  3.53k|    items.insert(item_number + 3, value);
  358|  3.53k|    resetLimits(node, lastPathElement());
  359|  3.53k|    split(node, lastPathElement());
  360|  3.53k|    increment(false);
  361|  3.53k|}
_ZNK14NNTreeIteratoreqERKS_:
  455|  17.2k|{
  456|  17.2k|    if (item_number == -1 && other.item_number == -1) {
  ------------------
  |  Branch (456:9): [True: 2.64k, False: 14.6k]
  |  Branch (456:30): [True: 2.64k, False: 0]
  ------------------
  457|  2.64k|        return true;
  458|  2.64k|    }
  459|  14.6k|    if (path.size() != other.path.size()) {
  ------------------
  |  Branch (459:9): [True: 10.7k, False: 3.86k]
  ------------------
  460|  10.7k|        return false;
  461|  10.7k|    }
  462|  3.86k|    auto tpi = path.begin();
  463|  3.86k|    auto opi = other.path.begin();
  464|  3.86k|    while (tpi != path.end()) {
  ------------------
  |  Branch (464:12): [True: 0, False: 3.86k]
  ------------------
  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|  3.86k|    return item_number == other.item_number;
  472|  3.86k|}
_ZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbb:
  476|  11.7k|{
  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|  11.7k|    auto opath = path;
  481|       |
  482|  11.7k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  11.7k|        impl.warn(failed_node, msg);
  484|  11.7k|        path = opath;
  485|  11.7k|        return false;
  486|  11.7k|    };
  487|       |
  488|  11.7k|    QPDFObjGen::set seen;
  489|  11.7k|    for (auto const& i: path) {
  ------------------
  |  Branch (489:23): [True: 2.33k, False: 11.7k]
  ------------------
  490|  2.33k|        seen.add(i.node);
  491|  2.33k|    }
  492|  16.8k|    while (true) {
  ------------------
  |  Branch (492:12): [True: 16.8k, Folded]
  ------------------
  493|  16.8k|        if (!seen.add(a_node)) {
  ------------------
  |  Branch (493:13): [True: 245, False: 16.6k]
  ------------------
  494|    245|            return fail(a_node, "loop detected while traversing name/number tree");
  495|    245|        }
  496|       |
  497|  16.6k|        if (!a_node) {
  ------------------
  |  Branch (497:13): [True: 0, False: 16.6k]
  ------------------
  498|      0|            return fail(a_node, "non-dictionary node while traversing name/number tree");
  499|      0|        }
  500|       |
  501|  16.6k|        Array items = a_node[impl.itemsKey()];
  502|  16.6k|        int nitems = static_cast<int>(items.size());
  503|  16.6k|        if (nitems > 1) {
  ------------------
  |  Branch (503:13): [True: 8.57k, False: 8.05k]
  ------------------
  504|  8.57k|            setItemNumber(a_node, first ? 0 : nitems - 2);
  ------------------
  |  Branch (504:35): [True: 8.57k, False: 0]
  ------------------
  505|  8.57k|            return true;
  506|  8.57k|        }
  507|       |
  508|  8.05k|        Array kids = a_node["/Kids"];
  509|  8.05k|        int nkids = static_cast<int>(kids.size());
  510|  8.05k|        if (nkids == 0) {
  ------------------
  |  Branch (510:13): [True: 2.27k, False: 5.78k]
  ------------------
  511|  2.27k|            if (allow_empty && items) {
  ------------------
  |  Branch (511:17): [True: 2.23k, False: 41]
  |  Branch (511:32): [True: 974, False: 1.25k]
  ------------------
  512|    974|                setItemNumber(a_node, -1);
  513|    974|                return true;
  514|    974|            }
  515|  1.29k|            return fail(
  516|  1.29k|                a_node,
  517|  1.29k|                "name/number tree node has neither non-empty " + impl.itemsKey() + " nor /Kids");
  518|  2.27k|        }
  519|       |
  520|  5.78k|        int kid_number = first ? 0 : nkids - 1;
  ------------------
  |  Branch (520:26): [True: 5.78k, False: 0]
  ------------------
  521|  5.78k|        addPathElement(a_node, kid_number);
  522|  5.78k|        Dictionary next = kids[kid_number];
  523|  5.78k|        if (!next) {
  ------------------
  |  Branch (523:13): [True: 662, False: 5.12k]
  ------------------
  524|    662|            return fail(a_node, "kid number " + std::to_string(kid_number) + " is invalid");
  525|    662|        }
  526|  5.12k|        if (!next.indirect()) {
  ------------------
  |  Branch (526:13): [True: 70, False: 5.05k]
  ------------------
  527|     70|            if (impl.auto_repair) {
  ------------------
  |  Branch (527:17): [True: 70, False: 0]
  ------------------
  528|     70|                impl.warn(
  529|     70|                    a_node,
  530|     70|                    "converting kid number " + std::to_string(kid_number) +
  531|     70|                        " to an indirect object");
  532|     70|                next = impl.qpdf.makeIndirectObject(next);
  533|     70|                kids.set(kid_number, next);
  534|     70|            } 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|     70|        }
  540|       |
  541|  5.12k|        a_node = next;
  542|  5.12k|    }
  543|  11.7k|}
_ZN10NNTreeImpl5beginEv:
  547|  10.6k|{
  548|  10.6k|    iterator result(*this);
  549|  10.6k|    result.deepen(tree_root, true, true);
  550|  10.6k|    return result;
  551|  10.6k|}
_ZNK10NNTreeImpl11compareKeysE16QPDFObjectHandleS0_:
  563|  30.8k|{
  564|       |    // We don't call this without calling keyValid first
  565|  30.8k|    qpdf_assert_debug(keyValid(a));
  ------------------
  |  |   11|  30.8k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (565:5): [True: 30.8k, False: 0]
  ------------------
  566|  30.8k|    qpdf_assert_debug(keyValid(b));
  ------------------
  |  |   11|  30.8k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (566:5): [True: 30.8k, False: 0]
  ------------------
  567|  30.8k|    if (key_type == ::ot_string) {
  ------------------
  |  Branch (567:9): [True: 22.2k, False: 8.54k]
  ------------------
  568|  22.2k|        auto as = a.getUTF8Value();
  569|  22.2k|        auto bs = b.getUTF8Value();
  570|  22.2k|        return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (570:16): [True: 1.00k, False: 21.2k]
  |  Branch (570:32): [True: 19.9k, False: 1.27k]
  ------------------
  571|  22.2k|    }
  572|  8.54k|    auto as = a.getIntValue();
  573|  8.54k|    auto bs = b.getIntValue();
  574|  8.54k|    return as < bs ? -1 : (as > bs ? 1 : 0);
  ------------------
  |  Branch (574:12): [True: 2.52k, False: 6.01k]
  |  Branch (574:28): [True: 5.73k, False: 285]
  ------------------
  575|  30.8k|}
_ZNK10NNTreeImpl12binarySearchERK16QPDFObjectHandleRKN4qpdf5ArrayEmbb:
  584|  7.22k|{
  585|  7.22k|    size_t max_idx = std::bit_ceil(num_items);
  586|       |
  587|  7.22k|    int step = static_cast<int>(max_idx / 2);
  588|  7.22k|    int checks = static_cast<int>(std::bit_width(max_idx)); // AppImage gcc version returns size_t
  589|  7.22k|    int idx = step;
  590|  7.22k|    int found_idx = -1;
  591|       |
  592|  31.2k|    for (int i = 0; i < checks; ++i) {
  ------------------
  |  Branch (592:21): [True: 24.8k, False: 6.38k]
  ------------------
  593|  24.8k|        int status = -1;
  594|  24.8k|        if (std::cmp_less(idx, num_items)) {
  ------------------
  |  Branch (594:13): [True: 16.5k, False: 8.25k]
  ------------------
  595|  16.5k|            status = search_kids ? compareKeyKid(key, items, idx) : compareKeyItem(key, items, idx);
  ------------------
  |  Branch (595:22): [True: 3.17k, False: 13.4k]
  ------------------
  596|  16.5k|            if (status == 0) {
  ------------------
  |  Branch (596:17): [True: 841, False: 15.7k]
  ------------------
  597|    841|                return idx;
  598|    841|            }
  599|  15.7k|            if (status > 0) {
  ------------------
  |  Branch (599:17): [True: 13.1k, False: 2.65k]
  ------------------
  600|  13.1k|                found_idx = idx;
  601|  13.1k|            }
  602|  15.7k|        }
  603|  24.0k|        step = std::max(step / 2, 1);
  604|  24.0k|        idx += status * step;
  605|  24.0k|    }
  606|  6.38k|    return return_prev_if_not_found ? found_idx : -1;
  ------------------
  |  Branch (606:12): [True: 5.62k, False: 764]
  ------------------
  607|  7.22k|}
_ZNK10NNTreeImpl14compareKeyItemERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  611|  13.4k|{
  612|  13.4k|    if (!keyValid(items[2 * idx])) {
  ------------------
  |  Branch (612:9): [True: 140, False: 13.2k]
  ------------------
  613|    140|        error(tree_root, ("item at index " + std::to_string(2 * idx) + " is not the right type"));
  614|    140|    }
  615|  13.4k|    return compareKeys(key, items[2 * idx]);
  616|  13.4k|}
_ZNK10NNTreeImpl13compareKeyKidERK16QPDFObjectHandleRKN4qpdf5ArrayEi:
  620|  3.17k|{
  621|  3.17k|    Dictionary kid = kids[idx];
  622|  3.17k|    if (!kid) {
  ------------------
  |  Branch (622:9): [True: 141, False: 3.03k]
  ------------------
  623|    141|        error(tree_root, "invalid kid at index " + std::to_string(idx));
  624|    141|    }
  625|  3.17k|    Array limits = kid["/Limits"];
  626|  3.17k|    if (!(keyValid(limits[0]) && keyValid(limits[1]))) {
  ------------------
  |  Branch (626:9): [True: 175, False: 3.00k]
  |  Branch (626:11): [True: 2.91k, False: 260]
  |  Branch (626:34): [True: 2.86k, False: 56]
  ------------------
  627|    175|        error(kids[idx], "node is missing /Limits");
  628|    175|    }
  629|  3.17k|    if (compareKeys(key, limits[0]) < 0) {
  ------------------
  |  Branch (629:9): [True: 496, False: 2.68k]
  ------------------
  630|    496|        return -1;
  631|    496|    }
  632|  2.68k|    if (compareKeys(key, limits[1]) > 0) {
  ------------------
  |  Branch (632:9): [True: 1.85k, False: 823]
  ------------------
  633|  1.85k|        return 1;
  634|  1.85k|    }
  635|    823|    return 0;
  636|  2.68k|}
_ZN10NNTreeImpl6repairEv:
  657|    650|{
  658|    650|    auto new_node = Dictionary({{itemsKey(), Array::empty()}});
  659|    650|    NNTreeImpl repl(qpdf, new_node, key_type, value_valid, false);
  660|    650|    std::map<QPDFObjectHandle, QPDFObjectHandle, Cmp> items;
  661|  11.7k|    for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (661:34): [True: 11.7k, False: 650]
  ------------------
  662|  11.7k|        if (key && value && repl.keyValid(key) && repl.value_valid(value)) {
  ------------------
  |  Branch (662:13): [True: 11.7k, False: 8]
  |  Branch (662:13): [True: 11.4k, False: 269]
  |  Branch (662:20): [True: 11.7k, False: 0]
  |  Branch (662:29): [True: 11.5k, False: 178]
  |  Branch (662:51): [True: 11.4k, False: 83]
  ------------------
  663|  11.4k|            items.insert_or_assign(key, value);
  664|  11.4k|        }
  665|  11.7k|    }
  666|  3.94k|    for (auto const& [key, value]: items) {
  ------------------
  |  Branch (666:34): [True: 3.94k, False: 650]
  ------------------
  667|  3.94k|        repl.insert(key, value);
  668|  3.94k|    }
  669|    650|    tree_root.replace("/Kids", new_node["/Kids"]);
  670|    650|    tree_root.replace(itemsKey(), new_node[itemsKey()]);
  671|    650|}
_ZN10NNTreeImpl4findERK16QPDFObjectHandleb:
  675|  8.39k|{
  676|  8.39k|    try {
  677|  8.39k|        return findInternal(key, return_prev_if_not_found);
  678|  8.39k|    } catch (QPDFExc& e) {
  679|  1.76k|        if (auto_repair) {
  ------------------
  |  Branch (679:13): [True: 1.76k, False: 0]
  ------------------
  680|  1.76k|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  681|  1.76k|            repair();
  682|  1.76k|            return findInternal(key, return_prev_if_not_found);
  683|  1.76k|        } else {
  684|      0|            throw;
  685|      0|        }
  686|  1.76k|    }
  687|  8.39k|}
_ZN10NNTreeImpl12findInternalERK16QPDFObjectHandleb:
  691|  8.45k|{
  692|  8.45k|    auto first_item = begin();
  693|  8.45k|    if (!first_item.valid()) {
  ------------------
  |  Branch (693:9): [True: 1.51k, False: 6.93k]
  ------------------
  694|  1.51k|        return end();
  695|  1.51k|    }
  696|  6.93k|    if (!keyValid(first_item->first)) {
  ------------------
  |  Branch (696:9): [True: 99, False: 6.83k]
  ------------------
  697|     99|        error(tree_root, "encountered invalid key in find");
  698|     99|    }
  699|  6.93k|    if (!value_valid(first_item->second)) {
  ------------------
  |  Branch (699:9): [True: 174, False: 6.76k]
  ------------------
  700|    174|        error(tree_root, "encountered invalid value in find");
  701|    174|    }
  702|  6.93k|    if (compareKeys(key, first_item->first) < 0) {
  ------------------
  |  Branch (702:9): [True: 138, False: 6.79k]
  ------------------
  703|       |        // Before the first key
  704|    138|        return end();
  705|    138|    }
  706|       |
  707|  6.79k|    QPDFObjGen::set seen;
  708|  6.79k|    auto node = tree_root;
  709|  6.79k|    iterator result(*this);
  710|       |
  711|  8.92k|    while (true) {
  ------------------
  |  Branch (711:12): [True: 7.33k, Folded]
  ------------------
  712|  7.33k|        if (!seen.add(node)) {
  ------------------
  |  Branch (712:13): [True: 48, False: 7.29k]
  ------------------
  713|     48|            error(node, "loop detected in find");
  714|     48|        }
  715|       |
  716|  7.33k|        Array items = node[itemsKey()];
  717|  7.33k|        size_t nitems = items.size();
  718|  7.33k|        if (nitems > 1) {
  ------------------
  |  Branch (718:13): [True: 5.21k, False: 2.12k]
  ------------------
  719|  5.21k|            int idx = binarySearch(key, items, nitems / 2, return_prev_if_not_found, false);
  720|  5.21k|            if (idx >= 0) {
  ------------------
  |  Branch (720:17): [True: 4.75k, False: 460]
  ------------------
  721|  4.75k|                result.setItemNumber(node, 2 * idx);
  722|  4.75k|                if (!result.impl.keyValid(result.ivalue.first)) {
  ------------------
  |  Branch (722:21): [True: 0, False: 4.75k]
  ------------------
  723|      0|                    error(node, "encountered invalid key in find");
  724|      0|                }
  725|  4.75k|                if (!result.impl.value_valid(result.ivalue.second)) {
  ------------------
  |  Branch (725:21): [True: 41, False: 4.71k]
  ------------------
  726|     41|                    error(tree_root, "encountered invalid value in find");
  727|     41|                }
  728|  4.75k|            }
  729|  5.21k|            return result;
  730|  5.21k|        }
  731|       |
  732|  2.12k|        Array kids = node["/Kids"];
  733|  2.12k|        size_t nkids = kids.size();
  734|  2.12k|        if (nkids == 0) {
  ------------------
  |  Branch (734:13): [True: 63, False: 2.06k]
  ------------------
  735|     63|            error(node, "bad node during find");
  736|     63|        }
  737|  2.12k|        int idx = binarySearch(key, kids, nkids, true, true);
  738|  2.12k|        if (idx == -1) {
  ------------------
  |  Branch (738:13): [True: 41, False: 2.08k]
  ------------------
  739|     41|            error(node, "unexpected -1 from binary search of kids; limits may by wrong");
  740|     41|        }
  741|  2.12k|        result.addPathElement(node, idx);
  742|  2.12k|        node = kids[idx];
  743|  2.12k|    }
  744|  6.79k|}
_ZN10NNTreeImpl11insertFirstERK16QPDFObjectHandleS2_:
  748|    409|{
  749|    409|    auto iter = begin();
  750|    409|    Array items = iter.node[items_key];
  751|    409|    if (!items) {
  ------------------
  |  Branch (751:9): [True: 0, False: 409]
  ------------------
  752|      0|        error(tree_root, "unable to find a valid items node");
  753|      0|    }
  754|    409|    if (!(key && value)) {
  ------------------
  |  Branch (754:11): [True: 409, False: 0]
  |  Branch (754:18): [True: 409, False: 0]
  ------------------
  755|      0|        error(tree_root, "unable to insert null key or value");
  756|      0|    }
  757|    409|    if (!value_valid(value)) {
  ------------------
  |  Branch (757:9): [True: 0, False: 409]
  ------------------
  758|      0|        error(tree_root, "attempting to insert an invalid value");
  759|      0|    }
  760|    409|    items.insert(0, key);
  761|    409|    items.insert(1, value);
  762|    409|    iter.setItemNumber(iter.node, 0);
  763|    409|    iter.resetLimits(iter.node, iter.lastPathElement());
  764|    409|    iter.split(iter.node, iter.lastPathElement());
  765|    409|    return iter;
  766|    409|}
_ZN10NNTreeImpl6insertERK16QPDFObjectHandleS2_:
  770|  3.94k|{
  771|  3.94k|    auto iter = find(key, true);
  772|  3.94k|    if (!iter.valid()) {
  ------------------
  |  Branch (772:9): [True: 409, False: 3.53k]
  ------------------
  773|    409|        return insertFirst(key, value);
  774|  3.53k|    } else if (compareKeys(key, iter->first) == 0) {
  ------------------
  |  Branch (774:16): [True: 0, False: 3.53k]
  ------------------
  775|      0|        Array items = iter.node[itemsKey()];
  776|      0|        items.set(iter.item_number + 1, value);
  777|      0|        iter.updateIValue();
  778|  3.53k|    } else {
  779|  3.53k|        iter.insertAfter(key, value);
  780|  3.53k|    }
  781|  3.53k|    return iter;
  782|  3.94k|}
_ZN10NNTreeImpl8validateEb:
  800|  1.18k|{
  801|  1.18k|    bool first = true;
  802|  1.18k|    QPDFObjectHandle last_key;
  803|  1.18k|    try {
  804|  1.75k|        for (auto const& [key, value]: *this) {
  ------------------
  |  Branch (804:38): [True: 1.75k, False: 1.18k]
  ------------------
  805|  1.75k|            if (!keyValid(key)) {
  ------------------
  |  Branch (805:17): [True: 186, False: 1.56k]
  ------------------
  806|    186|                error(tree_root, "invalid key in validate");
  807|    186|            }
  808|  1.75k|            if (!value_valid(value)) {
  ------------------
  |  Branch (808:17): [True: 83, False: 1.66k]
  ------------------
  809|     83|                error(tree_root, "invalid value in validate");
  810|     83|            }
  811|  1.75k|            if (first) {
  ------------------
  |  Branch (811:17): [True: 577, False: 1.17k]
  ------------------
  812|    577|                first = false;
  813|  1.17k|            } else if (last_key && compareKeys(last_key, key) != -1) {
  ------------------
  |  Branch (813:24): [True: 906, False: 269]
  |  Branch (813:24): [True: 231, False: 944]
  |  Branch (813:36): [True: 231, False: 675]
  ------------------
  814|    231|                error(tree_root, "keys are not sorted in validate");
  815|    231|            }
  816|  1.75k|            last_key = key;
  817|  1.75k|        }
  818|  1.18k|    } catch (QPDFExc& e) {
  819|    540|        if (a_repair) {
  ------------------
  |  Branch (819:13): [True: 540, False: 0]
  ------------------
  820|    540|            warn(tree_root, std::string("attempting to repair after error: ") + e.what());
  821|    540|            repair();
  822|    540|        }
  823|    540|        return false;
  824|    540|    }
  825|    642|    return true;
  826|  1.18k|}
_ZN24QPDFNameTreeObjectHelperD2Ev:
  847|    543|QPDFNameTreeObjectHelper::~QPDFNameTreeObjectHelper() = default;
_ZN24QPDFNameTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
  860|    543|    QPDFObjectHelper(oh),
  861|    543|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
  862|    543|{
  863|    543|}
_ZN24QPDFNameTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
  872|  1.67k|    impl(i)
  873|  1.67k|{
  874|  1.67k|}
_ZN24QPDFNameTreeObjectHelper8iterator12updateIValueEv:
  900|    153|{
  901|    153|    if (impl->valid()) {
  ------------------
  |  Branch (901:9): [True: 153, False: 0]
  ------------------
  902|    153|        auto p = *impl;
  903|    153|        ivalue.first = p->first.getUTF8Value();
  904|    153|        ivalue.second = p->second;
  905|    153|    } else {
  906|      0|        ivalue.first = "";
  907|      0|        ivalue.second = QPDFObjectHandle();
  908|      0|    }
  909|    153|}
_ZN24QPDFNameTreeObjectHelper8iteratorptEv:
  920|    153|{
  921|    153|    updateIValue();
  922|    153|    return &ivalue;
  923|    153|}
_ZNK24QPDFNameTreeObjectHelper8iteratoreqERKS0_:
  927|    836|{
  928|    836|    return *(impl) == *(other.impl);
  929|    836|}
_ZNK24QPDFNameTreeObjectHelper3endEv:
  953|    836|{
  954|    836|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
  955|    836|}
_ZN24QPDFNameTreeObjectHelper4findERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  965|  1.16k|{
  966|  1.16k|    auto i = m->impl.find(QPDFObjectHandle::newUnicodeString(key), return_prev_if_not_found);
  967|  1.16k|    return {std::make_shared<NNTreeIterator>(i)};
  968|  1.16k|}
_ZN24QPDFNameTreeObjectHelper10findObjectERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEER16QPDFObjectHandle:
  992|  1.16k|{
  993|  1.16k|    auto i = find(name);
  994|  1.16k|    if (i == end()) {
  ------------------
  |  Branch (994:9): [True: 683, False: 482]
  ------------------
  995|    683|        return false;
  996|    683|    }
  997|    482|    oh = i->second;
  998|    482|    return true;
  999|  1.16k|}
_ZN24QPDFNameTreeObjectHelper8validateEb:
 1017|    543|{
 1018|    543|    return m->impl.validate(repair);
 1019|    543|}
_ZN26QPDFNumberTreeObjectHelperD2Ev:
 1042|    640|QPDFNumberTreeObjectHelper::~QPDFNumberTreeObjectHelper() = default;
_ZN26QPDFNumberTreeObjectHelperC2E16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS0_EEEb:
 1056|    640|    QPDFObjectHelper(oh),
 1057|    640|    m(std::make_shared<Members>(oh, q, value_validator, auto_repair))
 1058|    640|{
 1059|    640|}
_ZN26QPDFNumberTreeObjectHelper8iteratorC2ERKNSt3__110shared_ptrI14NNTreeIteratorEE:
 1068|  3.80k|    impl(i)
 1069|  3.80k|{
 1070|  3.80k|}
_ZN26QPDFNumberTreeObjectHelper8iterator12updateIValueEv:
 1096|  3.05k|{
 1097|  3.05k|    if (impl->valid()) {
  ------------------
  |  Branch (1097:9): [True: 3.05k, False: 0]
  ------------------
 1098|  3.05k|        auto p = *impl;
 1099|  3.05k|        this->ivalue.first = p->first.getIntValue();
 1100|  3.05k|        this->ivalue.second = p->second;
 1101|  3.05k|    } else {
 1102|      0|        this->ivalue.first = 0;
 1103|      0|        this->ivalue.second = QPDFObjectHandle();
 1104|      0|    }
 1105|  3.05k|}
_ZN26QPDFNumberTreeObjectHelper8iteratorptEv:
 1116|  3.05k|{
 1117|  3.05k|    updateIValue();
 1118|  3.05k|    return &this->ivalue;
 1119|  3.05k|}
_ZNK26QPDFNumberTreeObjectHelper8iteratoreqERKS0_:
 1123|  1.90k|{
 1124|  1.90k|    return *(impl) == *(other.impl);
 1125|  1.90k|}
_ZNK26QPDFNumberTreeObjectHelper3endEv:
 1149|  1.90k|{
 1150|  1.90k|    return {std::make_shared<NNTreeIterator>(m->impl.end())};
 1151|  1.90k|}
_ZN26QPDFNumberTreeObjectHelper4findExb:
 1161|  3.28k|{
 1162|  3.28k|    auto i = m->impl.find(QPDFObjectHandle::newInteger(key), return_prev_if_not_found);
 1163|  3.28k|    return {std::make_shared<NNTreeIterator>(i)};
 1164|  3.28k|}
_ZN26QPDFNumberTreeObjectHelper19findObjectAtOrBelowExR16QPDFObjectHandleRx:
 1220|  3.28k|{
 1221|  3.28k|    auto i = find(idx, true);
 1222|  3.28k|    if (i == end()) {
  ------------------
  |  Branch (1222:9): [True: 882, False: 2.39k]
  ------------------
 1223|    882|        return false;
 1224|    882|    }
 1225|  2.39k|    oh = i->second;
 1226|  2.39k|    QIntC::range_check_subtract(idx, i->first);
 1227|  2.39k|    offset = idx - i->first;
 1228|  2.39k|    return true;
 1229|  3.28k|}
_ZN26QPDFNumberTreeObjectHelper8validateEb:
 1247|    640|{
 1248|    640|    return m->impl.validate(repair);
 1249|    640|}
NNTree.cc:_ZL15get_descriptionRK16QPDFObjectHandle:
   22|  10.9k|{
   23|  10.9k|    std::string result("Name/Number tree node");
   24|  10.9k|    if (node.indirect()) {
  ------------------
  |  Branch (24:9): [True: 9.07k, False: 1.87k]
  ------------------
   25|  9.07k|        result += " (object " + std::to_string(node.getObjectID()) + ")";
   26|  9.07k|    }
   27|  10.9k|    return result;
   28|  10.9k|}
NNTree.cc:_ZZN14NNTreeIterator6deepenEN4qpdf10DictionaryEbbENK3$_0clERKS1_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  482|  2.20k|    auto fail = [this, &opath](Dictionary const& failed_node, std::string const& msg) {
  483|  2.20k|        impl.warn(failed_node, msg);
  484|  2.20k|        path = opath;
  485|  2.20k|        return false;
  486|  2.20k|    };
NNTree.cc:_ZNK12_GLOBAL__N_13CmpclERK16QPDFObjectHandleS3_:
  644|  65.4k|        {
  645|  65.4k|            Integer l = lhs;
  646|  65.4k|            Integer r = rhs;
  647|  65.4k|            if (l && r) {
  ------------------
  |  Branch (647:17): [True: 9.46k, False: 55.9k]
  |  Branch (647:22): [True: 9.46k, False: 0]
  ------------------
  648|  9.46k|                return l.value() < r.value();
  649|  9.46k|            }
  650|  55.9k|            return lhs.getUTF8Value() < rhs.getUTF8Value();
  651|  65.4k|        }
_ZN24QPDFNameTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
  836|    543|        impl(q, oh, ::ot_string, value_validator, auto_repair)
  837|    543|    {
  838|    543|    }
_ZN24QPDFNameTreeObjectHelper7MembersD2Ev:
  840|    543|    ~Members() = default;
_ZN26QPDFNumberTreeObjectHelper7MembersC2ER16QPDFObjectHandleR4QPDFNSt3__18functionIFbRKS1_EEEb:
 1031|    640|        impl(q, oh, ::ot_integer, value_validator, auto_repair)
 1032|    640|    {
 1033|    640|    }
_ZN26QPDFNumberTreeObjectHelper7MembersD2Ev:
 1035|    640|    ~Members() = default;

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

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

_ZN10Pl_AES_PDFC2EPKcP8PipelinebNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   16|   162k|    Pipeline(identifier, next),
   17|   162k|    key(key),
   18|   162k|    crypto(QPDFCryptoProvider::getImpl()),
   19|   162k|    encrypt(encrypt)
   20|   162k|{
   21|   162k|    util::assertion(next, "Attempt to create Pl_AES_PDF with nullptr as next");
   22|   162k|    util::no_ci_rt_error_if(!(key.size() == 32 || key.size() == 16), "unsupported key length");
  ------------------
  |  Branch (22:31): [True: 5.22k, False: 157k]
  |  Branch (22:51): [True: 157k, False: 0]
  ------------------
   23|   162k|    std::memset(this->inbuf, 0, this->buf_size);
   24|   162k|    std::memset(this->outbuf, 0, this->buf_size);
   25|   162k|    std::memset(this->cbc_block, 0, this->buf_size);
   26|   162k|}
_ZN10Pl_AES_PDF9useZeroIVEv:
   30|    392|{
   31|    392|    use_zero_iv = true;
   32|    392|}
_ZN10Pl_AES_PDF14disablePaddingEv:
   36|  97.1k|{
   37|  97.1k|    disable_padding = true;
   38|  97.1k|}
_ZN10Pl_AES_PDF5setIVEPKhm:
   42|  96.7k|{
   43|  96.7k|    util::assertion(
   44|  96.7k|        bytes == buf_size,
   45|  96.7k|        "Pl_AES_PDF: specified initialization vector size in bytes must be " +
   46|  96.7k|            std::to_string(bytes));
   47|  96.7k|    use_specified_iv = true;
   48|  96.7k|    memcpy(specified_iv, iv, bytes);
   49|  96.7k|}
_ZN10Pl_AES_PDF5writeEPKhm:
   65|  6.25M|{
   66|  6.25M|    size_t bytes_left = len;
   67|  6.25M|    unsigned char const* p = data;
   68|       |
   69|  32.9M|    while (bytes_left > 0) {
  ------------------
  |  Branch (69:12): [True: 26.6M, False: 6.25M]
  ------------------
   70|  26.6M|        if (offset == buf_size) {
  ------------------
  |  Branch (70:13): [True: 26.5M, False: 161k]
  ------------------
   71|  26.5M|            flush(false);
   72|  26.5M|        }
   73|       |
   74|  26.6M|        size_t available = buf_size - offset;
   75|  26.6M|        size_t bytes = (bytes_left < available ? bytes_left : available);
  ------------------
  |  Branch (75:25): [True: 63.3k, False: 26.6M]
  ------------------
   76|  26.6M|        bytes_left -= bytes;
   77|  26.6M|        std::memcpy(inbuf + offset, p, bytes);
   78|  26.6M|        offset += bytes;
   79|  26.6M|        p += bytes;
   80|  26.6M|    }
   81|  6.25M|}
_ZN10Pl_AES_PDF6finishEv:
   85|   162k|{
   86|   162k|    if (encrypt) {
  ------------------
  |  Branch (86:9): [True: 96.7k, False: 65.5k]
  ------------------
   87|  96.7k|        if (offset == buf_size) {
  ------------------
  |  Branch (87:13): [True: 96.7k, False: 0]
  ------------------
   88|  96.7k|            flush(false);
   89|  96.7k|        }
   90|  96.7k|        if (!disable_padding) {
  ------------------
  |  Branch (90:13): [True: 0, False: 96.7k]
  ------------------
   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|  96.7k|    } else {
   99|  65.5k|        if (offset != buf_size) {
  ------------------
  |  Branch (99:13): [True: 64.2k, False: 1.30k]
  ------------------
  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|  64.2k|            util::assertion(offset < buf_size, "buffer overflow in AES encryption pipeline");
  104|  64.2k|            std::memset(inbuf + offset, 0, buf_size - offset);
  105|  64.2k|            offset = buf_size;
  106|  64.2k|        }
  107|  65.5k|        flush(!disable_padding);
  108|  65.5k|    }
  109|   162k|    crypto->rijndael_finalize();
  110|   162k|    next()->finish();
  111|   162k|}
_ZN10Pl_AES_PDF16initializeVectorEv:
  115|  97.1k|{
  116|  97.1k|    if (use_zero_iv) {
  ------------------
  |  Branch (116:9): [True: 392, False: 96.7k]
  ------------------
  117|  6.66k|        for (unsigned int i = 0; i < buf_size; ++i) {
  ------------------
  |  Branch (117:34): [True: 6.27k, False: 392]
  ------------------
  118|  6.27k|            cbc_block[i] = 0;
  119|  6.27k|        }
  120|  96.7k|    } else if (use_specified_iv) {
  ------------------
  |  Branch (120:16): [True: 96.7k, False: 0]
  ------------------
  121|  96.7k|        std::memcpy(cbc_block, specified_iv, buf_size);
  122|  96.7k|    } 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|  97.1k|}
_ZN10Pl_AES_PDF5flushEb:
  133|  26.6M|{
  134|  26.6M|    util::assertion(offset == buf_size, "AES pipeline: flush called when buffer was not full");
  135|       |
  136|  26.6M|    if (first) {
  ------------------
  |  Branch (136:9): [True: 162k, False: 26.5M]
  ------------------
  137|   162k|        first = false;
  138|   162k|        bool return_after_init = false;
  139|   162k|        if (cbc_mode) {
  ------------------
  |  Branch (139:13): [True: 162k, False: 0]
  ------------------
  140|   162k|            if (encrypt) {
  ------------------
  |  Branch (140:17): [True: 96.7k, False: 65.5k]
  ------------------
  141|       |                // Set cbc_block to the initialization vector, and if not zero, write it to the
  142|       |                // output stream.
  143|  96.7k|                initializeVector();
  144|  96.7k|                if (!(use_zero_iv || use_specified_iv)) {
  ------------------
  |  Branch (144:23): [True: 0, False: 96.7k]
  |  Branch (144:38): [True: 96.7k, False: 0]
  ------------------
  145|      0|                    next()->write(cbc_block, buf_size);
  146|      0|                }
  147|  96.7k|            } else if (use_zero_iv || use_specified_iv) {
  ------------------
  |  Branch (147:24): [True: 392, False: 65.2k]
  |  Branch (147:39): [True: 0, False: 65.2k]
  ------------------
  148|       |                // Initialize vector with zeroes; zero vector was not written to the beginning of
  149|       |                // the input file.
  150|    392|                initializeVector();
  151|  65.2k|            } else {
  152|       |                // Take the first block of input as the initialization vector.  There's nothing to
  153|       |                // write at this time.
  154|  65.2k|                memcpy(cbc_block, inbuf, buf_size);
  155|  65.2k|                offset = 0;
  156|  65.2k|                return_after_init = true;
  157|  65.2k|            }
  158|   162k|        }
  159|   162k|        crypto->rijndael_init(
  160|   162k|            encrypt,
  161|   162k|            reinterpret_cast<const unsigned char*>(key.data()),
  162|   162k|            key.size(),
  163|   162k|            cbc_mode,
  164|   162k|            cbc_block);
  165|   162k|        if (return_after_init) {
  ------------------
  |  Branch (165:13): [True: 65.2k, False: 97.1k]
  ------------------
  166|  65.2k|            return;
  167|  65.2k|        }
  168|   162k|    }
  169|       |
  170|  26.6M|    crypto->rijndael_process(inbuf, outbuf);
  171|  26.6M|    unsigned int bytes = buf_size;
  172|  26.6M|    if (strip_padding) {
  ------------------
  |  Branch (172:9): [True: 53.2k, False: 26.5M]
  ------------------
  173|  53.2k|        unsigned char last = outbuf[buf_size - 1];
  174|  53.2k|        if (last <= buf_size) {
  ------------------
  |  Branch (174:13): [True: 7.91k, False: 45.2k]
  ------------------
  175|  7.91k|            bool strip = true;
  176|  17.0k|            for (unsigned int i = 1; i <= last; ++i) {
  ------------------
  |  Branch (176:38): [True: 16.4k, False: 543]
  ------------------
  177|  16.4k|                if (outbuf[buf_size - i] != last) {
  ------------------
  |  Branch (177:21): [True: 7.37k, False: 9.09k]
  ------------------
  178|  7.37k|                    strip = false;
  179|  7.37k|                    break;
  180|  7.37k|                }
  181|  16.4k|            }
  182|  7.91k|            if (strip) {
  ------------------
  |  Branch (182:17): [True: 543, False: 7.37k]
  ------------------
  183|    543|                bytes -= last;
  184|    543|            }
  185|  7.91k|        }
  186|  53.2k|    }
  187|  26.6M|    offset = 0;
  188|  26.6M|    next()->write(outbuf, bytes);
  189|  26.6M|}

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|  4.68k|    Pipeline(identifier, next)
   13|  4.68k|{
   14|  4.68k|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|  4.68k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|  4.90k|{
   20|  4.90k|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 198, False: 4.70k]
  ------------------
   21|    198|        return;
   22|    198|    }
   23|   837k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 833k, False: 3.87k]
  ------------------
   24|   833k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 18.3k, False: 815k]
  ------------------
   25|  7.65k|        case ' ':
  ------------------
  |  Branch (25:9): [True: 7.65k, False: 826k]
  ------------------
   26|  7.90k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 246, False: 833k]
  ------------------
   27|  8.24k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 337, False: 833k]
  ------------------
   28|  8.55k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 312, False: 833k]
  ------------------
   29|  14.8k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 6.30k, False: 827k]
  ------------------
   30|  18.3k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 3.48k, False: 830k]
  ------------------
   31|  18.3k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  18.3k|            continue;
   34|   833k|        }
   35|   815k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 503, False: 815k]
  ------------------
   36|    503|            break;
   37|   815k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 1.57k, False: 813k]
  ------------------
   38|  1.57k|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|  1.57k|            flush();
   40|  1.57k|            eod = 2;
   41|   813k|        } else {
   42|   813k|            switch (buf[i]) {
   43|  1.57k|            case '~':
  ------------------
  |  Branch (43:13): [True: 1.57k, False: 811k]
  ------------------
   44|  1.57k|                eod = 1;
   45|  1.57k|                break;
   46|       |
   47|  2.79k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 2.79k, False: 810k]
  ------------------
   48|  2.79k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 30, False: 2.76k]
  ------------------
   49|     30|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     30|                }
   51|  2.76k|                unsigned char zeroes[4];
   52|  2.76k|                memset(zeroes, '\0', 4);
   53|  2.76k|                next()->write(zeroes, 4);
   54|  2.76k|                break;
   55|       |
   56|   809k|            default:
  ------------------
  |  Branch (56:13): [True: 809k, False: 4.36k]
  ------------------
   57|   809k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 47, False: 809k]
  |  Branch (57:36): [True: 188, False: 808k]
  ------------------
   58|    235|                    error = true;
   59|    235|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   808k|                } else {
   61|   808k|                    this->inbuf[this->pos++] = buf[i];
   62|   808k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 159k, False: 649k]
  ------------------
   63|   159k|                        flush();
   64|   159k|                    }
   65|   808k|                }
   66|   808k|                break;
   67|   813k|            }
   68|   813k|        }
   69|   815k|    }
   70|  4.70k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|   165k|{
   75|   165k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 2.26k, False: 163k]
  ------------------
   76|  2.26k|        return;
   77|  2.26k|    }
   78|   163k|    unsigned long lval = 0;
   79|   981k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 817k, False: 163k]
  ------------------
   80|   817k|        lval *= 85;
   81|   817k|        lval += (this->inbuf[i] - 33U);
   82|   817k|    }
   83|       |
   84|   163k|    unsigned char outbuf[4];
   85|   163k|    memset(outbuf, 0, 4);
   86|   817k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 654k, False: 163k]
  ------------------
   87|   654k|        outbuf[i] = lval & 0xff;
   88|   654k|        lval >>= 8;
   89|   654k|    }
   90|       |
   91|   163k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 159k, False: 3.72k]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|   163k|    auto t = this->pos - 1;
   94|   163k|    this->pos = 0;
   95|   163k|    memset(this->inbuf, 117, 5);
   96|       |
   97|   163k|    next()->write(outbuf, t);
   98|   163k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|  4.66k|{
  103|  4.66k|    if (error) {
  ------------------
  |  Branch (103:9): [True: 199, False: 4.46k]
  ------------------
  104|    199|        return;
  105|    199|    }
  106|  4.46k|    flush();
  107|  4.46k|    next()->finish();
  108|  4.46k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|    617|    Pipeline(identifier, next)
   14|    617|{
   15|    617|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|    617|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|  1.07k|{
   21|  1.07k|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 277, False: 801]
  ------------------
   22|    277|        return;
   23|    277|    }
   24|  6.69k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 6.13k, False: 558]
  ------------------
   25|  6.13k|        char ch = static_cast<char>(toupper(buf[i]));
   26|  6.13k|        switch (ch) {
   27|    417|        case ' ':
  ------------------
  |  Branch (27:9): [True: 417, False: 5.71k]
  ------------------
   28|    628|        case '\f':
  ------------------
  |  Branch (28:9): [True: 211, False: 5.92k]
  ------------------
   29|    833|        case '\v':
  ------------------
  |  Branch (29:9): [True: 205, False: 5.93k]
  ------------------
   30|  1.04k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 210, False: 5.92k]
  ------------------
   31|  1.27k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 231, False: 5.90k]
  ------------------
   32|  1.56k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 287, False: 5.84k]
  ------------------
   33|  1.56k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  1.56k|            break;
   36|       |
   37|     74|        case '>':
  ------------------
  |  Branch (37:9): [True: 74, False: 6.06k]
  ------------------
   38|     74|            eod = true;
   39|     74|            flush();
   40|     74|            break;
   41|       |
   42|  4.50k|        default:
  ------------------
  |  Branch (42:9): [True: 4.50k, False: 1.63k]
  ------------------
   43|  4.50k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 4.38k, False: 114]
  |  Branch (43:31): [True: 2.74k, False: 1.63k]
  |  Branch (43:46): [True: 1.62k, False: 129]
  |  Branch (43:59): [True: 1.58k, False: 37]
  ------------------
   44|  4.33k|                inbuf[pos++] = ch;
   45|  4.33k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 2.09k, False: 2.24k]
  ------------------
   46|  2.09k|                    flush();
   47|  2.09k|                }
   48|  4.33k|            } else {
   49|    166|                char t[2];
   50|    166|                t[0] = ch;
   51|    166|                t[1] = 0;
   52|    166|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|    166|            }
   54|  4.33k|            break;
   55|  6.13k|        }
   56|  5.96k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 74, False: 5.89k]
  ------------------
   57|     74|            break;
   58|     74|        }
   59|  5.96k|    }
   60|    801|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|  2.72k|{
   65|  2.72k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 495, False: 2.22k]
  ------------------
   66|    495|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|    495|        return;
   68|    495|    }
   69|  2.22k|    int b[2];
   70|  6.68k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 4.45k, False: 2.22k]
  ------------------
   71|  4.45k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 1.57k, False: 2.88k]
  ------------------
   72|  1.57k|            b[i] = inbuf[i] - 'A' + 10;
   73|  2.88k|        } else {
   74|  2.88k|            b[i] = inbuf[i] - '0';
   75|  2.88k|        }
   76|  4.45k|    }
   77|  2.22k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|  2.22k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 2.09k, False: 138]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|  2.22k|    pos = 0;
   82|  2.22k|    inbuf[0] = '0';
   83|  2.22k|    inbuf[1] = '0';
   84|  2.22k|    inbuf[2] = '\0';
   85|       |
   86|  2.22k|    next()->write(&ch, 1);
   87|  2.22k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|    559|{
   92|    559|    flush();
   93|    559|    next()->finish();
   94|    559|}

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

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

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

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

_ZN8Pl_Flate7MembersC2EmNS_8action_eE:
   27|  21.8k|    out_bufsize(out_bufsize),
   28|  21.8k|    action(action),
   29|  21.8k|    initialized(false),
   30|  21.8k|    zdata(nullptr)
   31|  21.8k|{
   32|  21.8k|    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|  21.8k|    zdata = new z_stream;
   37|       |
   38|  21.8k|    util::no_ci_rt_error_if(
   39|  21.8k|        out_bufsize > UINT_MAX,
   40|  21.8k|        "Pl_Flate: zlib doesn't support buffer sizes larger than unsigned int");
   41|       |
   42|  21.8k|    z_stream& zstream = *(static_cast<z_stream*>(this->zdata));
   43|  21.8k|    zstream.zalloc = nullptr;
   44|  21.8k|    zstream.zfree = nullptr;
   45|  21.8k|    zstream.opaque = nullptr;
   46|  21.8k|    zstream.next_in = nullptr;
   47|  21.8k|    zstream.avail_in = 0;
   48|  21.8k|    zstream.next_out = this->outbuf.get();
   49|  21.8k|    zstream.avail_out = QIntC::to_uint(out_bufsize);
   50|       |
   51|  21.8k|    if (action == a_deflate && Pl_Flate::zopfli_enabled()) {
  ------------------
  |  Branch (51:9): [True: 0, False: 21.8k]
  |  Branch (51:32): [True: 0, False: 0]
  ------------------
   52|      0|        zopfli_buf = std::make_unique<std::string>();
   53|      0|    }
   54|  21.8k|}
_ZN8Pl_Flate7MembersD2Ev:
   57|  21.8k|{
   58|  21.8k|    if (initialized) {
  ------------------
  |  Branch (58:9): [True: 1.54k, False: 20.3k]
  ------------------
   59|  1.54k|        z_stream& zstream = *(static_cast<z_stream*>(zdata));
   60|  1.54k|        if (action == a_deflate) {
  ------------------
  |  Branch (60:13): [True: 0, False: 1.54k]
  ------------------
   61|      0|            deflateEnd(&zstream);
   62|  1.54k|        } else {
   63|  1.54k|            inflateEnd(&zstream);
   64|  1.54k|        }
   65|  1.54k|    }
   66|       |
   67|  21.8k|    delete static_cast<z_stream*>(this->zdata);
   68|  21.8k|    zdata = nullptr;
   69|  21.8k|}
_ZN8Pl_FlateC2EPKcP8PipelineNS_8action_eEj:
   73|  21.8k|    Pipeline(identifier, next),
   74|  21.8k|    m(std::make_unique<Members>(QIntC::to_size(out_bufsize_int), action))
   75|  21.8k|{
   76|  21.8k|    util::assertion(next, "Attempt to create Pl_Flate with nullptr as next");
   77|  21.8k|}
_ZN8Pl_FlateD2Ev:
   80|  21.8k|Pl_Flate::~Pl_Flate() = default;
_ZN8Pl_Flate12memory_limitEv:
   84|  8.08k|{
   85|  8.08k|    return ::memory_limit;
   86|  8.08k|}
_ZN8Pl_Flate15setWarnCallbackENSt3__18functionIFvPKciEEE:
   96|  21.9k|{
   97|  21.9k|    m->callback = callback;
   98|  21.9k|}
_ZN8Pl_Flate4warnEPKci:
  102|  13.3k|{
  103|  13.3k|    if (m->callback) {
  ------------------
  |  Branch (103:9): [True: 13.3k, False: 0]
  ------------------
  104|  13.3k|        m->callback(msg, code);
  105|  13.3k|    }
  106|  13.3k|}
_ZN8Pl_Flate5writeEPKhm:
  110|   193k|{
  111|   193k|    util::assertion(
  112|   193k|        m->outbuf.get(), identifier + ": Pl_Flate: write() called after finish() called");
  113|   193k|    if (m->zopfli_buf) {
  ------------------
  |  Branch (113:9): [True: 0, False: 193k]
  ------------------
  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|   193k|    static size_t const max_bytes = 1 << 30;
  120|   193k|    size_t bytes_left = len;
  121|   193k|    unsigned char const* buf = data;
  122|   386k|    while (bytes_left > 0) {
  ------------------
  |  Branch (122:12): [True: 192k, False: 193k]
  ------------------
  123|   192k|        size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (123:25): [True: 0, False: 192k]
  ------------------
  124|   192k|        handleData(buf, bytes, (m->action == a_inflate ? Z_SYNC_FLUSH : Z_NO_FLUSH));
  ------------------
  |  Branch (124:33): [True: 192k, False: 0]
  ------------------
  125|   192k|        bytes_left -= bytes;
  126|   192k|        buf += bytes;
  127|   192k|    }
  128|   193k|}
_ZN8Pl_Flate10handleDataEPKhmi:
  132|   212k|{
  133|   212k|    util::no_ci_rt_error_if(
  134|   212k|        len > UINT_MAX, "Pl_Flate: zlib doesn't support data blocks larger than int");
  135|   212k|    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|   212k|    zstream.next_in = const_cast<unsigned char*>(data);
  139|   212k|    zstream.avail_in = QIntC::to_uint(len);
  140|       |
  141|   212k|    if (!m->initialized) {
  ------------------
  |  Branch (141:9): [True: 19.6k, False: 192k]
  ------------------
  142|  19.6k|        int err = Z_OK;
  143|       |
  144|       |        // deflateInit and inflateInit are macros that use old-style casts.
  145|  19.6k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  146|  19.6k|# pragma GCC diagnostic push
  147|  19.6k|# pragma GCC diagnostic ignored "-Wold-style-cast"
  148|  19.6k|#endif
  149|  19.6k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (149:13): [True: 0, False: 19.6k]
  ------------------
  150|      0|            err = deflateInit(&zstream, compression_level);
  151|  19.6k|        } else {
  152|  19.6k|            err = inflateInit(&zstream);
  153|  19.6k|        }
  154|  19.6k|#if ((defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__))
  155|  19.6k|# pragma GCC diagnostic pop
  156|  19.6k|#endif
  157|       |
  158|  19.6k|        checkError("Init", err);
  159|  19.6k|        m->initialized = true;
  160|  19.6k|    }
  161|       |
  162|   212k|    int err = Z_OK;
  163|       |
  164|   212k|    bool done = false;
  165|   424k|    while (!done) {
  ------------------
  |  Branch (165:12): [True: 214k, False: 209k]
  ------------------
  166|   214k|        if (m->action == a_deflate) {
  ------------------
  |  Branch (166:13): [True: 0, False: 214k]
  ------------------
  167|      0|            err = deflate(&zstream, flush);
  168|   214k|        } else {
  169|   214k|            err = inflate(&zstream, flush);
  170|   214k|        }
  171|   214k|        if ((m->action == a_inflate) && (err != Z_OK) && zstream.msg &&
  ------------------
  |  Branch (171:13): [True: 214k, False: 0]
  |  Branch (171:41): [True: 26.6k, False: 188k]
  |  Branch (171:58): [True: 7.11k, False: 19.5k]
  ------------------
  172|  7.11k|            (strcmp(zstream.msg, "incorrect data check") == 0)) {
  ------------------
  |  Branch (172:13): [True: 4.54k, False: 2.56k]
  ------------------
  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|  4.54k|            err = Z_STREAM_END;
  176|  4.54k|        }
  177|   214k|        switch (err) {
  178|  13.3k|        case Z_BUF_ERROR:
  ------------------
  |  Branch (178:9): [True: 13.3k, False: 201k]
  ------------------
  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|  13.3k|            warn("input stream is complete but output may still be valid", err);
  186|  13.3k|            done = true;
  187|  13.3k|            break;
  188|       |
  189|  10.6k|        case Z_STREAM_END:
  ------------------
  |  Branch (189:9): [True: 10.6k, False: 204k]
  ------------------
  190|  10.6k|            done = true;
  191|       |            // fall through
  192|       |
  193|   198k|        case Z_OK:
  ------------------
  |  Branch (193:9): [True: 188k, False: 26.6k]
  ------------------
  194|   198k|            {
  195|   198k|                if ((zstream.avail_in == 0) && (zstream.avail_out > 0)) {
  ------------------
  |  Branch (195:21): [True: 193k, False: 4.95k]
  |  Branch (195:48): [True: 193k, False: 26]
  ------------------
  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|   193k|                    done = true;
  199|   193k|                }
  200|   198k|                uLong ready = QIntC::to_ulong(m->out_bufsize - zstream.avail_out);
  201|   198k|                if (ready > 0) {
  ------------------
  |  Branch (201:21): [True: 158k, False: 40.3k]
  ------------------
  202|   158k|                    if (::memory_limit && m->action != a_deflate) {
  ------------------
  |  Branch (202:25): [True: 158k, False: 0]
  |  Branch (202:43): [True: 158k, False: 0]
  ------------------
  203|   158k|                        m->written += ready;
  204|   158k|                        if (m->written > ::memory_limit) {
  ------------------
  |  Branch (204:29): [True: 51, False: 158k]
  ------------------
  205|     51|                            throw std::runtime_error("PL_Flate memory limit exceeded");
  206|     51|                        }
  207|   158k|                    }
  208|   158k|                    next()->write(m->outbuf.get(), ready);
  209|   158k|                    zstream.next_out = m->outbuf.get();
  210|   158k|                    zstream.avail_out = QIntC::to_uint(m->out_bufsize);
  211|   158k|                }
  212|   198k|            }
  213|   198k|            break;
  214|       |
  215|   198k|        default:
  ------------------
  |  Branch (215:9): [True: 2.59k, False: 212k]
  ------------------
  216|  2.59k|            checkError("data", err);
  217|   214k|        }
  218|   214k|    }
  219|   212k|}
_ZN8Pl_Flate6finishEv:
  223|  21.4k|{
  224|  21.4k|    if (m->written > ::memory_limit) {
  ------------------
  |  Branch (224:9): [True: 51, False: 21.3k]
  ------------------
  225|     51|        throw std::runtime_error("PL_Flate memory limit exceeded");
  226|     51|    }
  227|  21.3k|    try {
  228|  21.3k|        if (m->zopfli_buf) {
  ------------------
  |  Branch (228:13): [True: 0, False: 21.3k]
  ------------------
  229|      0|            finish_zopfli();
  230|  21.3k|        } else if (m->outbuf.get()) {
  ------------------
  |  Branch (230:20): [True: 21.3k, False: 0]
  ------------------
  231|  21.3k|            if (m->initialized) {
  ------------------
  |  Branch (231:17): [True: 19.2k, False: 2.11k]
  ------------------
  232|  19.2k|                z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  233|  19.2k|                unsigned char buf[1];
  234|  19.2k|                buf[0] = '\0';
  235|  19.2k|                handleData(buf, 0, Z_FINISH);
  236|  19.2k|                int err = Z_OK;
  237|  19.2k|                if (m->action == a_deflate) {
  ------------------
  |  Branch (237:21): [True: 0, False: 19.2k]
  ------------------
  238|      0|                    err = deflateEnd(&zstream);
  239|  19.2k|                } else {
  240|  19.2k|                    err = inflateEnd(&zstream);
  241|  19.2k|                }
  242|  19.2k|                m->initialized = false;
  243|  19.2k|                checkError("End", err);
  244|  19.2k|            }
  245|       |
  246|  21.3k|            m->outbuf = nullptr;
  247|  21.3k|        }
  248|  21.3k|    } catch (std::exception& e) {
  249|  1.14k|        try {
  250|  1.14k|            next()->finish();
  251|  1.14k|        } catch (...) {
  252|       |            // ignore secondary exception
  253|      8|        }
  254|  1.14k|        throw std::runtime_error(e.what());
  255|  1.14k|    }
  256|  20.2k|    next()->finish();
  257|  20.2k|}
_ZN8Pl_Flate10checkErrorEPKci:
  267|  40.3k|{
  268|  40.3k|    z_stream& zstream = *(static_cast<z_stream*>(m->zdata));
  269|  40.3k|    if (error_code != Z_OK) {
  ------------------
  |  Branch (269:9): [True: 2.59k, False: 37.7k]
  ------------------
  270|  2.59k|        char const* action_str = (m->action == a_deflate ? "deflate" : "inflate");
  ------------------
  |  Branch (270:35): [True: 0, False: 2.59k]
  ------------------
  271|  2.59k|        std::string msg = identifier + ": " + action_str + ": " + prefix + ": ";
  272|       |
  273|  2.59k|        if (zstream.msg) {
  ------------------
  |  Branch (273:13): [True: 2.56k, False: 24]
  ------------------
  274|  2.56k|            msg += zstream.msg;
  275|  2.56k|        } else {
  276|     24|            switch (error_code) {
  277|      0|            case Z_ERRNO:
  ------------------
  |  Branch (277:13): [True: 0, False: 24]
  ------------------
  278|      0|                msg += "zlib system error";
  279|      0|                break;
  280|       |
  281|      0|            case Z_STREAM_ERROR:
  ------------------
  |  Branch (281:13): [True: 0, False: 24]
  ------------------
  282|      0|                msg += "zlib stream error";
  283|      0|                break;
  284|       |
  285|      0|            case Z_DATA_ERROR:
  ------------------
  |  Branch (285:13): [True: 0, False: 24]
  ------------------
  286|      0|                msg += "zlib data error";
  287|      0|                break;
  288|       |
  289|      0|            case Z_MEM_ERROR:
  ------------------
  |  Branch (289:13): [True: 0, False: 24]
  ------------------
  290|      0|                msg += "zlib memory error";
  291|      0|                break;
  292|       |
  293|      0|            case Z_BUF_ERROR:
  ------------------
  |  Branch (293:13): [True: 0, False: 24]
  ------------------
  294|      0|                msg += "zlib buffer error";
  295|      0|                break;
  296|       |
  297|      0|            case Z_VERSION_ERROR:
  ------------------
  |  Branch (297:13): [True: 0, False: 24]
  ------------------
  298|      0|                msg += "zlib version error";
  299|      0|                break;
  300|       |
  301|     24|            default:
  ------------------
  |  Branch (301:13): [True: 24, False: 0]
  ------------------
  302|     24|                msg += std::string("zlib unknown error (") + std::to_string(error_code) + ")";
  303|     24|                break;
  304|     24|            }
  305|     24|        }
  306|       |
  307|  2.59k|        throw std::runtime_error(msg);
  308|  2.59k|    }
  309|  40.3k|}

_ZN13Pl_LZWDecoderC2EPKcP8Pipelineb:
   12|  8.35k|    Pipeline(identifier, next),
   13|  8.35k|    code_change_delta(early_code_change)
   14|  8.35k|{
   15|  8.35k|    util::assertion(next, "Attempt to create Pl_LZWDecoder with nullptr as next");
   16|  8.35k|}
_ZN13Pl_LZWDecoder5writeEPKhm:
   20|  4.02M|{
   21|  10.8M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (21:24): [True: 6.82M, False: 4.02M]
  ------------------
   22|  6.82M|        buf[next_char_++] = bytes[i];
   23|  6.82M|        if (next_char_ == 3) {
  ------------------
  |  Branch (23:13): [True: 2.27M, False: 4.55M]
  ------------------
   24|  2.27M|            next_char_ = 0;
   25|  2.27M|        }
   26|  6.82M|        bits_available += 8;
   27|  6.82M|        if (bits_available >= code_size) {
  ------------------
  |  Branch (27:13): [True: 5.79M, False: 1.03M]
  ------------------
   28|  5.79M|            sendNextCode();
   29|  5.79M|        }
   30|  6.82M|    }
   31|  4.02M|}
_ZN13Pl_LZWDecoder6finishEv:
   35|  8.18k|{
   36|  8.18k|    next()->finish();
   37|  8.18k|}
_ZN13Pl_LZWDecoder12sendNextCodeEv:
   41|  5.79M|{
   42|  5.79M|    unsigned int high = byte_pos;
   43|  5.79M|    unsigned int med = (byte_pos + 1) % 3;
   44|  5.79M|    unsigned int low = (byte_pos + 2) % 3;
   45|       |
   46|  5.79M|    unsigned int bits_from_high = 8 - bit_pos;
   47|  5.79M|    unsigned int bits_from_med = code_size - bits_from_high;
   48|  5.79M|    unsigned int bits_from_low = 0;
   49|  5.79M|    if (bits_from_med > 8) {
  ------------------
  |  Branch (49:9): [True: 363k, False: 5.43M]
  ------------------
   50|   363k|        bits_from_low = bits_from_med - 8;
   51|   363k|        bits_from_med = 8;
   52|   363k|    }
   53|  5.79M|    unsigned int high_mask = (1U << bits_from_high) - 1U;
   54|  5.79M|    unsigned int med_mask = 0xff - ((1U << (8 - bits_from_med)) - 1U);
   55|  5.79M|    unsigned int low_mask = 0xff - ((1U << (8 - bits_from_low)) - 1U);
   56|  5.79M|    unsigned int code = 0;
   57|  5.79M|    code += (buf[high] & high_mask) << bits_from_med;
   58|  5.79M|    code += ((buf[med] & med_mask) >> (8 - bits_from_med));
   59|  5.79M|    if (bits_from_low) {
  ------------------
  |  Branch (59:9): [True: 363k, False: 5.43M]
  ------------------
   60|   363k|        code <<= bits_from_low;
   61|   363k|        code += ((buf[low] & low_mask) >> (8 - bits_from_low));
   62|   363k|        byte_pos = low;
   63|   363k|        bit_pos = bits_from_low;
   64|  5.43M|    } else {
   65|  5.43M|        byte_pos = med;
   66|  5.43M|        bit_pos = bits_from_med;
   67|  5.43M|    }
   68|  5.79M|    if (bit_pos == 8) {
  ------------------
  |  Branch (68:9): [True: 667k, False: 5.12M]
  ------------------
   69|   667k|        bit_pos = 0;
   70|   667k|        ++byte_pos;
   71|   667k|        byte_pos %= 3;
   72|   667k|    }
   73|  5.79M|    bits_available -= code_size;
   74|       |
   75|  5.79M|    handleCode(code);
   76|  5.79M|}
_ZN13Pl_LZWDecoder12getFirstCharEj:
   80|  82.3k|{
   81|  82.3k|    if (code < 256) {
  ------------------
  |  Branch (81:9): [True: 10.6k, False: 71.7k]
  ------------------
   82|  10.6k|        return static_cast<unsigned char>(code);
   83|  10.6k|    }
   84|  71.7k|    util::no_ci_rt_error_if(
   85|  71.7k|        code <= 257,
   86|  71.7k|        "Pl_LZWDecoder::getFirstChar called with invalid code (" + std::to_string(code) + ")");
   87|       |
   88|  71.7k|    unsigned int idx = code - 258;
   89|  71.7k|    util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::getFirstChar: table overflow");
   90|  71.7k|    Buffer& b = table.at(idx);
   91|  71.7k|    return b.getBuffer()[0];
   92|  82.3k|}
_ZN13Pl_LZWDecoder10addToTableEh:
   96|  4.56M|{
   97|  4.56M|    unsigned int last_size = 0;
   98|  4.56M|    unsigned char const* last_data = nullptr;
   99|  4.56M|    unsigned char tmp[1];
  100|       |
  101|  4.56M|    if (last_code < 256) {
  ------------------
  |  Branch (101:9): [True: 4.48M, False: 82.0k]
  ------------------
  102|  4.48M|        tmp[0] = static_cast<unsigned char>(last_code);
  103|  4.48M|        last_data = tmp;
  104|  4.48M|        last_size = 1;
  105|  4.48M|    } else {
  106|  82.0k|        util::no_ci_rt_error_if(
  107|  82.0k|            last_code <= 257,
  108|  82.0k|            "Pl_LZWDecoder::addToTable called with invalid code (" + std::to_string(last_code) +
  109|  82.0k|                ")");
  110|  82.0k|        unsigned int idx = last_code - 258;
  111|  82.0k|        util::no_ci_rt_error_if(idx >= table.size(), "Pl_LZWDecoder::addToTable: table overflow");
  112|  82.0k|        Buffer& b = table.at(idx);
  113|  82.0k|        last_data = b.getBuffer();
  114|  82.0k|        last_size = QIntC::to_uint(b.getSize());
  115|  82.0k|    }
  116|       |
  117|  4.56M|    Buffer entry(1 + last_size);
  118|  4.56M|    unsigned char* new_data = entry.getBuffer();
  119|  4.56M|    memcpy(new_data, last_data, last_size);
  120|  4.56M|    new_data[last_size] = c;
  121|  4.56M|    table.push_back(std::move(entry));
  122|  4.56M|}
_ZN13Pl_LZWDecoder10handleCodeEj:
  126|  5.79M|{
  127|  5.79M|    if (eod) {
  ------------------
  |  Branch (127:9): [True: 699k, False: 5.09M]
  ------------------
  128|   699k|        return;
  129|   699k|    }
  130|       |
  131|  5.09M|    if (code == 256) {
  ------------------
  |  Branch (131:9): [True: 282k, False: 4.81M]
  ------------------
  132|   282k|        if (!table.empty()) {
  ------------------
  |  Branch (132:13): [True: 224k, False: 58.0k]
  ------------------
  133|   224k|            QTC::TC("libtests", "Pl_LZWDecoder intermediate reset");
  134|   224k|        }
  135|   282k|        table.clear();
  136|   282k|        code_size = 9;
  137|  4.81M|    } else if (code == 257) {
  ------------------
  |  Branch (137:16): [True: 56, False: 4.81M]
  ------------------
  138|     56|        eod = true;
  139|  4.81M|    } else {
  140|  4.81M|        if (last_code != 256) {
  ------------------
  |  Branch (140:13): [True: 4.56M, False: 244k]
  ------------------
  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|  4.56M|            unsigned char next_c = '\0';
  144|  4.56M|            unsigned int table_size = QIntC::to_uint(table.size());
  145|  4.56M|            if (code < 256) {
  ------------------
  |  Branch (145:17): [True: 4.48M, False: 82.7k]
  ------------------
  146|       |                // just read < 256; last time's next_c was code
  147|  4.48M|                next_c = static_cast<unsigned char>(code);
  148|  4.48M|            } else if (code > 257) {
  ------------------
  |  Branch (148:24): [True: 82.7k, False: 0]
  ------------------
  149|  82.7k|                size_t idx = code - 258;
  150|  82.7k|                if (idx > table_size) {
  ------------------
  |  Branch (150:21): [True: 407, False: 82.3k]
  ------------------
  151|    407|                    throw std::runtime_error("LZWDecoder: bad code received");
  152|  82.3k|                } else if (idx == table_size) {
  ------------------
  |  Branch (152:28): [True: 10.6k, False: 71.7k]
  ------------------
  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|  10.6k|                    next_c = getFirstChar(last_code);
  156|  71.7k|                } else {
  157|  71.7k|                    next_c = getFirstChar(code);
  158|  71.7k|                }
  159|  82.7k|            }
  160|  4.56M|            unsigned int new_idx = 258 + table_size;
  161|  4.56M|            util::no_ci_rt_error_if(new_idx == 4096, "LZWDecoder: table full");
  162|  4.56M|            addToTable(next_c);
  163|  4.56M|            unsigned int change_idx = new_idx + code_change_delta;
  164|  4.56M|            if (change_idx == 511 || change_idx == 1023 || change_idx == 2047) {
  ------------------
  |  Branch (164:17): [True: 950, False: 4.56M]
  |  Branch (164:38): [True: 729, False: 4.56M]
  |  Branch (164:60): [True: 367, False: 4.56M]
  ------------------
  165|  2.03k|                ++code_size;
  166|  2.03k|            }
  167|  4.56M|        }
  168|       |
  169|  4.81M|        if (code < 256) {
  ------------------
  |  Branch (169:13): [True: 4.73M, False: 82.4k]
  ------------------
  170|  4.73M|            auto ch = static_cast<unsigned char>(code);
  171|  4.73M|            next()->write(&ch, 1);
  172|  4.73M|        } else {
  173|  82.4k|            unsigned int idx = code - 258;
  174|  82.4k|            if (idx >= table.size()) {
  ------------------
  |  Branch (174:17): [True: 44, False: 82.3k]
  ------------------
  175|     44|                throw std::runtime_error("Pl_LZWDecoder::handleCode: table overflow");
  176|     44|            }
  177|  82.3k|            Buffer& b = table.at(idx);
  178|  82.3k|            next()->write(b.getBuffer(), b.getSize());
  179|  82.3k|        }
  180|  4.81M|    }
  181|       |
  182|  5.09M|    last_code = code;
  183|  5.09M|}

_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.86M|{
   30|  3.86M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  3.86M|}
_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|  3.87k|    Pipeline(identifier, next),
   31|  3.87k|    action(action)
   32|  3.87k|{
   33|  3.87k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  3.87k|    util::no_ci_rt_error_if(
   35|  3.87k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  3.87k|    util::no_ci_rt_error_if(
   37|  3.87k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 72, False: 3.80k]
  |  Branch (37:35): [True: 70, False: 3.73k]
  |  Branch (37:59): [True: 69, False: 3.66k]
  ------------------
   38|  3.66k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 3.64k, False: 21]
  |  Branch (38:35): [True: 0, False: 21]
  ------------------
   39|  3.87k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  3.87k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  3.87k|    util::no_ci_rt_error_if(
   42|  3.87k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  3.87k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  3.87k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   45|  3.87k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   46|  3.87k|    util::no_ci_rt_error_if(
   47|  3.87k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (47:9): [True: 25, False: 3.84k]
  |  Branch (47:21): [True: 3, False: 3.84k]
  ------------------
   48|  3.87k|    util::no_ci_rt_error_if(
   49|  3.87k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (49:9): [True: 3.84k, False: 28]
  |  Branch (49:29): [True: 6, False: 3.83k]
  ------------------
   50|  3.87k|    bytes_per_row = static_cast<uint32_t>(bpr);
   51|  3.87k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   52|  3.87k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   53|  3.87k|    memset(buf1.get(), 0, bytes_per_row + 1);
   54|  3.87k|    memset(buf2.get(), 0, bytes_per_row + 1);
   55|  3.87k|    cur_row = buf1.get();
   56|  3.87k|    prev_row = buf2.get();
   57|       |
   58|       |    // number of bytes per incoming row
   59|  3.87k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (59:17): [True: 0, False: 3.87k]
  ------------------
   60|  3.87k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   70|  83.0k|{
   71|  83.0k|    size_t left = incoming - pos;
   72|  83.0k|    size_t offset = 0;
   73|   879k|    while (len >= left) {
  ------------------
  |  Branch (73:12): [True: 796k, False: 83.0k]
  ------------------
   74|       |        // finish off current row
   75|   796k|        memcpy(cur_row + pos, data + offset, left);
   76|   796k|        offset += left;
   77|   796k|        len -= left;
   78|       |
   79|   796k|        processRow();
   80|       |
   81|       |        // Swap rows
   82|   796k|        unsigned char* t = prev_row;
   83|   796k|        prev_row = cur_row;
   84|   796k|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (84:19): [True: 796k, False: 6]
  ------------------
   85|   796k|        memset(cur_row, 0, bytes_per_row + 1);
   86|   796k|        left = incoming;
   87|   796k|        pos = 0;
   88|   796k|    }
   89|  83.0k|    if (len) {
  ------------------
  |  Branch (89:9): [True: 78.1k, False: 4.89k]
  ------------------
   90|  78.1k|        memcpy(cur_row + pos, data + offset, len);
   91|  78.1k|    }
   92|  83.0k|    pos += len;
   93|  83.0k|}
_ZN12Pl_PNGFilter10processRowEv:
   97|   797k|{
   98|   797k|    if (action == a_encode) {
  ------------------
  |  Branch (98:9): [True: 0, False: 797k]
  ------------------
   99|      0|        encodeRow();
  100|   797k|    } else {
  101|   797k|        decodeRow();
  102|   797k|    }
  103|   797k|}
_ZN12Pl_PNGFilter9decodeRowEv:
  107|   797k|{
  108|   797k|    int filter = cur_row[0];
  109|   797k|    if (prev_row) {
  ------------------
  |  Branch (109:9): [True: 797k, False: 0]
  ------------------
  110|   797k|        switch (filter) {
  111|   208k|        case 0:
  ------------------
  |  Branch (111:9): [True: 208k, False: 588k]
  ------------------
  112|   208k|            break;
  113|   115k|        case 1:
  ------------------
  |  Branch (113:9): [True: 115k, False: 681k]
  ------------------
  114|   115k|            decodeSub();
  115|   115k|            break;
  116|   412k|        case 2:
  ------------------
  |  Branch (116:9): [True: 412k, False: 385k]
  ------------------
  117|   412k|            decodeUp();
  118|   412k|            break;
  119|    433|        case 3:
  ------------------
  |  Branch (119:9): [True: 433, False: 797k]
  ------------------
  120|    433|            decodeAverage();
  121|    433|            break;
  122|    982|        case 4:
  ------------------
  |  Branch (122:9): [True: 982, False: 796k]
  ------------------
  123|    982|            decodePaeth();
  124|    982|            break;
  125|  59.0k|        default:
  ------------------
  |  Branch (125:9): [True: 59.0k, False: 738k]
  ------------------
  126|       |            // ignore
  127|  59.0k|            break;
  128|   797k|        }
  129|   797k|    }
  130|       |
  131|   797k|    next()->write(cur_row + 1, bytes_per_row);
  132|   797k|}
_ZN12Pl_PNGFilter9decodeSubEv:
  136|   115k|{
  137|   115k|    unsigned char* buffer = cur_row + 1;
  138|   115k|    unsigned int bpp = bytes_per_pixel;
  139|       |
  140|  1.24M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (140:30): [True: 1.13M, False: 115k]
  ------------------
  141|  1.13M|        unsigned char left = 0;
  142|       |
  143|  1.13M|        if (i >= bpp) {
  ------------------
  |  Branch (143:13): [True: 994k, False: 138k]
  ------------------
  144|   994k|            left = buffer[i - bpp];
  145|   994k|        }
  146|       |
  147|  1.13M|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  148|  1.13M|    }
  149|   115k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  153|   412k|{
  154|   412k|    unsigned char* buffer = cur_row + 1;
  155|   412k|    unsigned char* above_buffer = prev_row + 1;
  156|       |
  157|  2.47M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (157:30): [True: 2.05M, False: 412k]
  ------------------
  158|  2.05M|        unsigned char up = above_buffer[i];
  159|  2.05M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  160|  2.05M|    }
  161|   412k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  165|    433|{
  166|    433|    unsigned char* buffer = cur_row + 1;
  167|    433|    unsigned char* above_buffer = prev_row + 1;
  168|    433|    auto bpp = bytes_per_pixel;
  169|       |
  170|   673k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (170:30): [True: 673k, False: 433]
  ------------------
  171|   673k|        int left = 0;
  172|   673k|        int up = 0;
  173|       |
  174|   673k|        if (i >= bpp) {
  ------------------
  |  Branch (174:13): [True: 672k, False: 433]
  ------------------
  175|   672k|            left = buffer[i - bpp];
  176|   672k|        }
  177|       |
  178|   673k|        up = above_buffer[i];
  179|   673k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  180|   673k|    }
  181|    433|}
_ZN12Pl_PNGFilter11decodePaethEv:
  185|    982|{
  186|    982|    unsigned char* buffer = cur_row + 1;
  187|    982|    unsigned char* above_buffer = prev_row + 1;
  188|    982|    auto bpp = bytes_per_pixel;
  189|       |
  190|   821k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (190:30): [True: 820k, False: 982]
  ------------------
  191|   820k|        int left = 0;
  192|   820k|        int up = above_buffer[i];
  193|   820k|        int upper_left = 0;
  194|       |
  195|   820k|        if (i >= bpp) {
  ------------------
  |  Branch (195:13): [True: 819k, False: 982]
  ------------------
  196|   819k|            left = buffer[i - bpp];
  197|   819k|            upper_left = above_buffer[i - bpp];
  198|   819k|        }
  199|       |
  200|   820k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  201|   820k|    }
  202|    982|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  206|   820k|{
  207|   820k|    int p = a + b - c;
  208|   820k|    int pa = abs_diff(p, a);
  209|   820k|    int pb = abs_diff(p, b);
  210|   820k|    int pc = abs_diff(p, c);
  211|       |
  212|   820k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (212:9): [True: 818k, False: 2.05k]
  |  Branch (212:21): [True: 817k, False: 293]
  ------------------
  213|   817k|        return a;
  214|   817k|    }
  215|  2.34k|    if (pb <= pc) {
  ------------------
  |  Branch (215:9): [True: 2.01k, False: 333]
  ------------------
  216|  2.01k|        return b;
  217|  2.01k|    }
  218|    333|    return c;
  219|  2.34k|}
_ZN12Pl_PNGFilter6finishEv:
  239|  3.80k|{
  240|  3.80k|    if (pos) {
  ------------------
  |  Branch (240:9): [True: 1.49k, False: 2.30k]
  ------------------
  241|       |        // write partial row
  242|  1.49k|        processRow();
  243|  1.49k|    }
  244|  3.80k|    prev_row = nullptr;
  245|  3.80k|    cur_row = buf1.get();
  246|  3.80k|    pos = 0;
  247|  3.80k|    memset(cur_row, 0, bytes_per_row + 1);
  248|       |
  249|  3.80k|    next()->finish();
  250|  3.80k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|  2.46M|{
   20|  2.46M|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 1.58M, False: 872k]
  ------------------
   21|  2.46M|}

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

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

_ZN12Pl_RunLengthC2EPKcP8PipelineNS_8action_eE:
   32|  1.68k|    Pipeline(identifier, next),
   33|  1.68k|    m(std::make_unique<Members>(action))
   34|  1.68k|{
   35|  1.68k|    util::assertion(next, "Attempt to create Pl_RunLength with nullptr as next");
   36|  1.68k|}
_ZN12Pl_RunLengthD2Ev:
   44|  1.68k|Pl_RunLength::~Pl_RunLength() = default;
_ZN12Pl_RunLength5writeEPKhm:
   48|  95.4k|{
   49|  95.4k|    if (m->action == a_encode) {
  ------------------
  |  Branch (49:9): [True: 0, False: 95.4k]
  ------------------
   50|      0|        encode(data, len);
   51|  95.4k|    } else {
   52|  95.4k|        decode(data, len);
   53|  95.4k|    }
   54|  95.4k|}
_ZN12Pl_RunLength6decodeEPKhm:
   90|  95.4k|{
   91|  95.4k|    util::no_ci_rt_error_if(
   92|  95.4k|        memory_limit && (len + m->out.size()) > memory_limit, "Pl_RunLength memory limit exceeded");
  ------------------
  |  Branch (92:9): [True: 95.4k, False: 0]
  |  Branch (92:25): [True: 39, False: 95.4k]
  ------------------
   93|  95.4k|    m->out.reserve(len);
   94|  23.0M|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (94:24): [True: 22.9M, False: 95.4k]
  ------------------
   95|  22.9M|        unsigned char const& ch = data[i];
   96|  22.9M|        switch (m->state) {
  ------------------
  |  Branch (96:17): [True: 22.9M, False: 0]
  ------------------
   97|  5.93M|        case st_top:
  ------------------
  |  Branch (97:9): [True: 5.93M, False: 17.0M]
  ------------------
   98|  5.93M|            if (ch < 128) {
  ------------------
  |  Branch (98:17): [True: 616k, False: 5.31M]
  ------------------
   99|       |                // length represents remaining number of bytes to copy
  100|   616k|                m->length = 1U + ch;
  101|   616k|                m->state = st_copying;
  102|  5.31M|            } else if (ch > 128) {
  ------------------
  |  Branch (102:24): [True: 5.31M, False: 1.90k]
  ------------------
  103|       |                // length represents number of copies of next byte
  104|  5.31M|                m->length = 257U - ch;
  105|  5.31M|                m->state = st_run;
  106|  5.31M|            } else // ch == 128
  107|  1.90k|            {
  108|       |                // EOD; stay in this state
  109|  1.90k|            }
  110|  5.93M|            break;
  111|       |
  112|  11.7M|        case st_copying:
  ------------------
  |  Branch (112:9): [True: 11.7M, False: 11.2M]
  ------------------
  113|  11.7M|            m->out.append(1, static_cast<char>(ch));
  114|  11.7M|            if (--m->length == 0) {
  ------------------
  |  Branch (114:17): [True: 615k, False: 11.1M]
  ------------------
  115|   615k|                m->state = st_top;
  116|   615k|            }
  117|  11.7M|            break;
  118|       |
  119|  5.31M|        case st_run:
  ------------------
  |  Branch (119:9): [True: 5.31M, False: 17.6M]
  ------------------
  120|  5.31M|            m->out.append(m->length, static_cast<char>(ch));
  121|  5.31M|            m->state = st_top;
  122|  5.31M|            break;
  123|  22.9M|        }
  124|  22.9M|    }
  125|  95.4k|}
_ZN12Pl_RunLength6finishEv:
  159|  1.53k|{
  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|  1.53k|    if (m->action == a_encode) {
  ------------------
  |  Branch (163:9): [True: 0, False: 1.53k]
  ------------------
  164|      0|        flush_encode();
  165|      0|        unsigned char ch = 128;
  166|      0|        next()->write(&ch, 1);
  167|  1.53k|    } else {
  168|  1.53k|        if (memory_limit && (m->out.size()) > memory_limit) {
  ------------------
  |  Branch (168:13): [True: 1.53k, False: 0]
  |  Branch (168:29): [True: 40, False: 1.49k]
  ------------------
  169|     40|            throw std::runtime_error("Pl_RunLength memory limit exceeded");
  170|     40|        }
  171|  1.49k|        next()->writeString(m->out);
  172|  1.49k|    }
  173|  1.49k|    next()->finish();
  174|  1.49k|}
_ZN12Pl_RunLength7MembersC2ENS_8action_eE:
   18|  1.68k|        action(action)
   19|  1.68k|    {
   20|  1.68k|    }
_ZN12Pl_RunLength7MembersD2Ev:
   22|  1.68k|    ~Members() = default;

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

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

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

_ZN4QPDF15StringDecrypterC2EPS_10QPDFObjGen:
  118|   168k|    qpdf(qpdf),
  119|   168k|    og(og)
  120|   168k|{
  121|   168k|}
_ZN4QPDF7MembersC2ERS_:
  131|  26.8k|    Doc(qpdf, this),
  132|  26.8k|    c(qpdf, this),
  133|  26.8k|    lin(*this),
  134|  26.8k|    objects(*this),
  135|  26.8k|    pages(*this),
  136|  26.8k|    file(std::make_shared<InvalidInputSource>()),
  137|  26.8k|    encp(std::make_shared<EncryptionParameters>())
  138|  26.8k|{
  139|  26.8k|}
_ZN4QPDFC2Ev:
  142|  26.8k|    m(std::make_unique<Members>(*this))
  143|  26.8k|{
  144|  26.8k|    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|  26.8k|    static std::atomic<unsigned long long> unique_id{0};
  148|  26.8k|    m->unique_id = unique_id.fetch_add(1ULL);
  149|  26.8k|}
_ZN4QPDF3Doc13init_acroformEv:
  161|  9.47k|{
  162|  9.47k|    acroform_dh_ = std::make_unique<QPDFAcroFormDocumentHelper>(qpdf);
  163|  9.47k|    acroform_ = acroform_dh_->m.get();
  164|  9.47k|}
_ZN4QPDFD2Ev:
  186|  26.8k|{
  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|  26.8k|    m->xref_table.clear();
  200|   518k|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (200:26): [True: 518k, False: 26.8k]
  ------------------
  201|   518k|        Disconnect(iter.second.object).disconnect();
  202|   518k|    }
  203|  26.8k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  235|  26.8k|{
  236|  26.8k|    m->file = source;
  237|  26.8k|    m->objects.parse(password);
  238|  26.8k|}
_ZN4QPDF4warnERK7QPDFExc:
  337|   927k|{
  338|   927k|    m->c.warn(e);
  339|   927k|}
_ZN4QPDF3Doc6Common4warnERK7QPDFExc:
  343|  1.28M|{
  344|  1.28M|    if (cf.max_warnings() > 0 && m->warnings.size() >= cf.max_warnings()) {
  ------------------
  |  Branch (344:9): [True: 964k, False: 321k]
  |  Branch (344:34): [True: 20.4k, False: 943k]
  ------------------
  345|  20.4k|        stopOnError("Too many warnings - file is too badly damaged");
  346|  20.4k|    }
  347|  1.28M|    m->warnings.emplace_back(e);
  348|  1.28M|    if (!cf.suppress_warnings()) {
  ------------------
  |  Branch (348:9): [True: 1.26M, False: 20.4k]
  ------------------
  349|  1.26M|        *cf.log()->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  350|  1.26M|    }
  351|  1.28M|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  359|  20.2k|{
  360|  20.2k|    m->c.warn(QPDFExc(error_code, getFilename(), object, offset, message));
  361|  20.2k|}
_ZN4QPDF3Doc6Common4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEExSB_:
  369|  1.11k|{
  370|  1.11k|    warn(QPDFExc(error_code, qpdf.getFilename(), object, offset, message));
  371|  1.11k|}
_ZN4QPDF9newStreamEv:
  387|  21.3k|{
  388|  21.3k|    return makeIndirectObject(
  389|  21.3k|        qpdf::Stream(*this, m->objects.nextObjGen(), Dictionary::empty(), 0, 0));
  390|  21.3k|}
_ZN4QPDF9newStreamERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  402|  15.7k|{
  403|  15.7k|    auto result = newStream();
  404|  15.7k|    result.replaceStreamData(data, {}, {});
  405|  15.7k|    return result;
  406|  15.7k|}
_ZN4QPDF9getObjectEii:
  410|  27.0k|{
  411|  27.0k|    return getObject({objid, generation});
  412|  27.0k|}
_ZNK4QPDF11getFilenameEv:
  625|   101k|{
  626|   101k|    return m->file->getName();
  627|   101k|}
_ZN4QPDF7getRootEv:
  669|   170k|{
  670|   170k|    Dictionary Root = m->trailer["/Root"];
  671|   170k|    if (!Root) {
  ------------------
  |  Branch (671:9): [True: 5.34k, False: 165k]
  ------------------
  672|  5.34k|        throw m->c.damagedPDF("", -1, "unable to find /Root dictionary");
  673|  5.34k|    }
  674|   165k|    if (!m->objects.root_checked()) {
  ------------------
  |  Branch (674:9): [True: 13.4k, False: 151k]
  ------------------
  675|  13.4k|        m->objects.root_checked(true);
  676|  13.4k|        if (Name(Root["/Type"]) != "/Catalog") {
  ------------------
  |  Branch (676:13): [True: 2.73k, False: 10.6k]
  ------------------
  677|  2.73k|            warn(m->c.damagedPDF(
  678|  2.73k|                "", -1, "Catalog: setting missing or invalid /Type entry to /Catalog"));
  679|  2.73k|            if (!global::Options::inspection_mode()) {
  ------------------
  |  Branch (679:17): [True: 2.73k, False: 1]
  ------------------
  680|  2.73k|                Root.replace("/Type", Name("/Catalog"));
  681|  2.73k|            }
  682|  2.73k|        }
  683|  13.4k|    }
  684|   165k|    return Root.oh();
  685|   170k|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  713|  40.3k|{
  714|  40.3k|    std::unique_ptr<Pipeline> to_delete;
  715|  40.3k|    if (encp->encrypted) {
  ------------------
  |  Branch (715:9): [True: 3.10k, False: 37.2k]
  ------------------
  716|  3.10k|        decryptStream(
  717|  3.10k|            encp, file, qpdf_for_warning, pipeline, og, stream_dict, is_root_metadata, to_delete);
  718|  3.10k|    }
  719|       |
  720|  40.3k|    bool attempted_finish = false;
  721|  40.3k|    try {
  722|  40.3k|        auto buf = file->read(length, offset);
  723|  40.3k|        if (buf.size() != length) {
  ------------------
  |  Branch (723:13): [True: 0, False: 40.3k]
  ------------------
  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|  40.3k|        pipeline->write(buf.data(), length);
  731|  40.3k|        attempted_finish = true;
  732|  40.3k|        pipeline->finish();
  733|  40.3k|        return true;
  734|  40.3k|    } catch (QPDFExc& e) {
  735|      0|        if (!suppress_warnings) {
  ------------------
  |  Branch (735:13): [True: 0, False: 0]
  ------------------
  736|      0|            qpdf_for_warning.warn(e);
  737|      0|        }
  738|  4.26k|    } catch (std::exception& e) {
  739|  4.26k|        if (!suppress_warnings) {
  ------------------
  |  Branch (739:13): [True: 4.26k, False: 0]
  ------------------
  740|  4.26k|            QTC::TC("qpdf", "QPDF decoding error warning");
  741|  4.26k|            qpdf_for_warning.warn(
  742|       |                // line-break
  743|  4.26k|                qpdf_for_warning.m->c.damagedPDF(
  744|  4.26k|                    *file,
  745|  4.26k|                    "",
  746|  4.26k|                    file->getLastOffset(),
  747|  4.26k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
  748|  4.26k|                     e.what())));
  749|  4.26k|            if (will_retry) {
  ------------------
  |  Branch (749:17): [True: 0, False: 4.26k]
  ------------------
  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|  4.26k|        }
  759|  4.26k|    }
  760|  4.19k|    if (!attempted_finish) {
  ------------------
  |  Branch (760:9): [True: 2.14k, False: 2.05k]
  ------------------
  761|  2.14k|        try {
  762|  2.14k|            pipeline->finish();
  763|  2.14k|        } catch (std::exception&) {
  764|       |            // ignore
  765|  1.40k|        }
  766|  2.14k|    }
  767|  4.19k|    return false;
  768|  4.19k|}
_ZN4QPDF14pipeStreamDataE10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  780|  40.3k|{
  781|  40.3k|    return pipeStreamData(
  782|  40.3k|        m->encp,
  783|  40.3k|        m->file,
  784|  40.3k|        *this,
  785|  40.3k|        og,
  786|  40.3k|        offset,
  787|  40.3k|        length,
  788|  40.3k|        stream_dict,
  789|  40.3k|        is_root_metadata,
  790|  40.3k|        pipeline,
  791|  40.3k|        suppress_warnings,
  792|  40.3k|        will_retry);
  793|  40.3k|}
_ZN4QPDF3Doc6Common11stopOnErrorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  799|  20.4k|{
  800|  20.4k|    throw damagedPDF("", message);
  801|  20.4k|}
_ZN4QPDF3Doc6Common10damagedPDFER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEExSC_:
  807|  49.7k|{
  808|  49.7k|    return {qpdf_e_damaged_pdf, input.getName(), object, offset, message, true};
  809|  49.7k|}
_ZNK4QPDF3Doc6Common10damagedPDFER11InputSourcexRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  815|  45.4k|{
  816|  45.4k|    return damagedPDF(input, m->last_object_description, offset, message);
  817|  45.4k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEExSA_:
  823|   299k|{
  824|   299k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message, true};
  825|   299k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  831|  58.3k|{
  832|  58.3k|    return damagedPDF(object, m->file->getLastOffset(), message);
  833|  58.3k|}
_ZNK4QPDF3Doc6Common10damagedPDFExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  839|  41.3k|{
  840|  41.3k|    return damagedPDF(m->last_object_description, offset, message);
  841|  41.3k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  847|  57.9k|{
  848|  57.9k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
  849|  57.9k|}
_ZN10DisconnectC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  172|   518k|        BaseHandle(obj)
  173|   518k|    {
  174|   518k|    }
_ZN10Disconnect10disconnectEv:
  177|   518k|    {
  178|   518k|        BaseHandle::disconnect(false);
  179|   518k|        if (raw_type_code() != ::ot_null) {
  ------------------
  |  Branch (179:13): [True: 195k, False: 322k]
  ------------------
  180|   195k|            obj->value = QPDF_Destroyed();
  181|   195k|        }
  182|   518k|    }

_ZN26QPDFAcroFormDocumentHelperC2ER4QPDF:
   24|  20.9k|    QPDFDocumentHelper(qpdf),
   25|  20.9k|    m(std::make_shared<Members>(qpdf))
   26|  20.9k|{
   27|  20.9k|}
_ZN4qpdf4impl8AcroForm8validateEb:
   43|  20.9k|{
   44|  20.9k|    invalidateCache();
   45|  20.9k|    analyze();
   46|  20.9k|}
_ZN4qpdf4impl8AcroForm15invalidateCacheEv:
   56|  20.9k|{
   57|  20.9k|    cache_valid_ = false;
   58|  20.9k|    fields_.clear();
   59|  20.9k|    annotation_to_field_.clear();
   60|  20.9k|    bad_fields_.clear();
   61|  20.9k|    unnamed_fields_.clear();
   62|  20.9k|    name_to_fields_.clear();
   63|  20.9k|}
_ZN26QPDFAcroFormDocumentHelper27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  279|  16.7k|{
  280|  16.7k|    return m->getWidgetAnnotationsForPage(h);
  281|  16.7k|}
_ZN4qpdf4impl8AcroForm27getWidgetAnnotationsForPageE20QPDFPageObjectHelper:
  285|  36.3k|{
  286|  36.3k|    return h.getAnnotations("/Widget");
  287|  36.3k|}
_ZN26QPDFAcroFormDocumentHelper21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  312|  1.83k|{
  313|  1.83k|    return m->getFieldForAnnotation(h);
  314|  1.83k|}
_ZN4qpdf4impl8AcroForm21getFieldForAnnotationE26QPDFAnnotationObjectHelper:
  318|  36.4k|{
  319|  36.4k|    QPDFObjectHandle oh = h.getObjectHandle();
  320|  36.4k|    if (!oh.isDictionaryOfType("", "/Widget")) {
  ------------------
  |  Branch (320:9): [True: 0, False: 36.4k]
  ------------------
  321|      0|        return Null::temp();
  322|      0|    }
  323|  36.4k|    analyze();
  324|  36.4k|    QPDFObjGen og(oh.getObjGen());
  325|  36.4k|    if (annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (325:9): [True: 34.2k, False: 2.15k]
  ------------------
  326|  34.2k|        return annotation_to_field_[og];
  327|  34.2k|    }
  328|  2.15k|    return Null::temp();
  329|  36.4k|}
_ZN4qpdf4impl8AcroForm7analyzeEv:
  333|  57.4k|{
  334|  57.4k|    if (cache_valid_) {
  ------------------
  |  Branch (334:9): [True: 36.4k, False: 20.9k]
  ------------------
  335|  36.4k|        return;
  336|  36.4k|    }
  337|  20.9k|    cache_valid_ = true;
  338|  20.9k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  339|  20.9k|    if (!(acroform.isDictionary() && acroform.hasKey("/Fields"))) {
  ------------------
  |  Branch (339:9): [True: 11.3k, False: 9.60k]
  |  Branch (339:11): [True: 9.69k, False: 11.2k]
  |  Branch (339:38): [True: 9.60k, False: 89]
  ------------------
  340|  11.3k|        return;
  341|  11.3k|    }
  342|  9.60k|    QPDFObjectHandle fields = acroform.getKey("/Fields");
  343|  9.60k|    if (Array fa = fields) {
  ------------------
  |  Branch (343:15): [True: 9.48k, False: 120]
  ------------------
  344|       |        // Traverse /AcroForm to find annotations and map them bidirectionally to fields.
  345|  64.8k|        for (auto const& field: fa) {
  ------------------
  |  Branch (345:31): [True: 64.8k, False: 9.48k]
  ------------------
  346|  64.8k|            traverseField(field, {}, 0);
  347|  64.8k|        }
  348|  9.48k|    } else {
  349|    120|        acroform.warn("/Fields key of /AcroForm dictionary is not an array; ignoring");
  350|    120|        fields = Array::empty();
  351|    120|    }
  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|  13.8k|    for (QPDFPageObjectHelper ph: pages) {
  ------------------
  |  Branch (360:33): [True: 13.8k, False: 9.60k]
  ------------------
  361|  37.6k|        for (auto const& iter: getWidgetAnnotationsForPage(ph)) {
  ------------------
  |  Branch (361:30): [True: 37.6k, False: 13.8k]
  ------------------
  362|  37.6k|            QPDFObjectHandle annot(iter.getObjectHandle());
  363|  37.6k|            QPDFObjGen og(annot.getObjGen());
  364|  37.6k|            if (!annotation_to_field_.contains(og)) {
  ------------------
  |  Branch (364:17): [True: 24.7k, False: 12.8k]
  ------------------
  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|  24.7k|                annot.warn(
  371|  24.7k|                    "this widget annotation is not reachable from /AcroForm in the document "
  372|  24.7k|                    "catalog");
  373|  24.7k|                annotation_to_field_[og] = QPDFFormFieldObjectHelper(annot);
  374|  24.7k|                fields_[og].annotations.emplace_back(annot);
  375|  24.7k|            }
  376|  37.6k|        }
  377|  13.8k|    }
  378|  9.60k|}
_ZN4qpdf4impl8AcroForm13traverseFieldE16QPDFObjectHandleRKS2_i:
  382|  95.6k|{
  383|  95.6k|    if (depth > 100) {
  ------------------
  |  Branch (383:9): [True: 0, False: 95.6k]
  ------------------
  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|  95.6k|    if (!field.indirect()) {
  ------------------
  |  Branch (388:9): [True: 36.4k, False: 59.1k]
  ------------------
  389|  36.4k|        field.warn(
  390|  36.4k|            "encountered a direct object as a field or annotation while traversing /AcroForm; "
  391|  36.4k|            "ignoring field or annotation");
  392|  36.4k|        return false;
  393|  36.4k|    }
  394|  59.1k|    if (field == parent) {
  ------------------
  |  Branch (394:9): [True: 108, False: 59.0k]
  ------------------
  395|    108|        field.warn("loop detected while traversing /AcroForm");
  396|    108|        return false;
  397|    108|    }
  398|  59.0k|    if (!field.isDictionary()) {
  ------------------
  |  Branch (398:9): [True: 38.6k, False: 20.3k]
  ------------------
  399|  38.6k|        field.warn(
  400|  38.6k|            "encountered a non-dictionary as a field or annotation while traversing /AcroForm; "
  401|  38.6k|            "ignoring field or annotation");
  402|  38.6k|        return false;
  403|  38.6k|    }
  404|  20.3k|    QPDFObjGen og(field.getObjGen());
  405|  20.3k|    if (unnamed_fields_.contains(og)) {
  ------------------
  |  Branch (405:9): [True: 484, False: 19.8k]
  ------------------
  406|    484|        bad_fields_.insert(og);
  407|    484|    }
  408|  20.3k|    if (fields_.contains(og) || annotation_to_field_.contains(og) || bad_fields_.contains(og)) {
  ------------------
  |  Branch (408:9): [True: 836, False: 19.5k]
  |  Branch (408:33): [True: 438, False: 19.0k]
  |  Branch (408:70): [True: 785, False: 18.3k]
  ------------------
  409|  2.05k|        field.warn("loop detected while traversing /AcroForm");
  410|  2.05k|        return false;
  411|  2.05k|    }
  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|  18.3k|    FormNode node = field;
  420|  18.3k|    const bool is_field = node.field();
  421|  18.3k|    const bool is_annotation = node.widget();
  422|       |
  423|  18.3k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper field found", (depth == 0) ? 0 : 1);
  ------------------
  |  Branch (423:63): [True: 7.77k, False: 10.5k]
  ------------------
  424|  18.3k|    QTC::TC("qpdf", "QPDFAcroFormDocumentHelper annotation found", (is_field ? 0 : 1));
  ------------------
  |  Branch (424:69): [True: 13.2k, False: 5.03k]
  ------------------
  425|       |
  426|  18.3k|    if (!is_field && !is_annotation) {
  ------------------
  |  Branch (426:9): [True: 5.03k, False: 13.2k]
  |  Branch (426:22): [True: 4.28k, False: 753]
  ------------------
  427|  4.28k|        field.warn(
  428|  4.28k|            "encountered an object that is neither field nor annotation while traversing "
  429|  4.28k|            "/AcroForm");
  430|  4.28k|        return false;
  431|  4.28k|    }
  432|       |
  433|  14.0k|    if (is_annotation) {
  ------------------
  |  Branch (433:9): [True: 9.00k, False: 5.02k]
  ------------------
  434|  9.00k|        auto our_field = (is_field ? field : parent);
  ------------------
  |  Branch (434:27): [True: 8.24k, False: 753]
  ------------------
  435|  9.00k|        fields_[our_field].annotations.emplace_back(field);
  436|  9.00k|        annotation_to_field_[og] = QPDFFormFieldObjectHelper(our_field);
  437|  9.00k|    }
  438|       |
  439|  14.0k|    if (!is_field) {
  ------------------
  |  Branch (439:9): [True: 753, False: 13.2k]
  ------------------
  440|    753|        return true;
  441|    753|    }
  442|       |
  443|  13.2k|    if (depth != 0 && field["/Parent"] != parent) {
  ------------------
  |  Branch (443:9): [True: 8.11k, False: 5.15k]
  |  Branch (443:9): [True: 1.72k, False: 11.5k]
  |  Branch (443:23): [True: 1.72k, False: 6.39k]
  ------------------
  444|  35.6k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (444:29): [True: 35.6k, False: 1.26k]
  ------------------
  445|  35.6k|            if (kid == field) {
  ------------------
  |  Branch (445:17): [True: 462, False: 35.1k]
  ------------------
  446|    462|                field.warn("while traversing /AcroForm found field with two parents");
  447|    462|                return true;
  448|    462|            }
  449|  35.6k|        }
  450|  6.84k|        for (auto const& kid: Array(field["/Parent"]["/Kids"])) {
  ------------------
  |  Branch (450:29): [True: 6.84k, False: 1.13k]
  ------------------
  451|  6.84k|            if (kid == parent) {
  ------------------
  |  Branch (451:17): [True: 128, False: 6.71k]
  ------------------
  452|    128|                field.warn("loop detected while traversing /AcroForm");
  453|    128|                return false;
  454|    128|            }
  455|  6.84k|        }
  456|  1.13k|        field.warn("encountered invalid /Parent entry while traversing /AcroForm; correcting");
  457|  1.13k|        field.replaceKey("/Parent", parent);
  458|  1.13k|    }
  459|       |
  460|  12.6k|    if (node.T()) {
  ------------------
  |  Branch (460:9): [True: 9.49k, False: 3.18k]
  ------------------
  461|  9.49k|        auto old = fields_.find(og);
  462|  9.49k|        if (old != fields_.end() && !old->second.name.empty()) {
  ------------------
  |  Branch (462:13): [True: 6.76k, False: 2.73k]
  |  Branch (462:13): [True: 0, False: 9.49k]
  |  Branch (462:37): [True: 0, False: 6.76k]
  ------------------
  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.49k|        std::string name = node.fully_qualified_name();
  467|  9.49k|        fields_[og].name = name;
  468|  9.49k|        name_to_fields_[name].insert(og);
  469|  9.49k|    } else if (!is_annotation) {
  ------------------
  |  Branch (469:16): [True: 2.17k, False: 1.01k]
  ------------------
  470|  2.17k|        unnamed_fields_.insert(og);
  471|  2.17k|    }
  472|       |
  473|  50.5k|    for (auto const& kid: node.Kids()) {
  ------------------
  |  Branch (473:25): [True: 50.5k, False: 12.6k]
  ------------------
  474|  50.5k|        if (bad_fields_.contains(kid)) {
  ------------------
  |  Branch (474:13): [True: 19.7k, False: 30.8k]
  ------------------
  475|  19.7k|            continue;
  476|  19.7k|        }
  477|       |
  478|  30.8k|        if (!traverseField(kid, field, 1 + depth)) {
  ------------------
  |  Branch (478:13): [True: 22.5k, False: 8.27k]
  ------------------
  479|  22.5k|            bad_fields_.insert(kid);
  480|  22.5k|        }
  481|  30.8k|    }
  482|  12.6k|    return true;
  483|  13.2k|}
_ZN4qpdf4impl8AcroForm18getNeedAppearancesEv:
  493|  50.4k|{
  494|  50.4k|    bool result = false;
  495|  50.4k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  496|  50.4k|    if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) {
  ------------------
  |  Branch (496:9): [True: 19.2k, False: 31.1k]
  |  Branch (496:9): [True: 5.30k, False: 45.1k]
  |  Branch (496:36): [True: 5.30k, False: 13.9k]
  ------------------
  497|  5.30k|        result = acroform.getKey("/NeedAppearances").getBoolValue();
  498|  5.30k|    }
  499|  50.4k|    return result;
  500|  50.4k|}
_ZN4qpdf4impl8AcroForm18setNeedAppearancesEb:
  510|  3.24k|{
  511|  3.24k|    QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm");
  512|  3.24k|    if (!acroform.isDictionary()) {
  ------------------
  |  Branch (512:9): [True: 0, False: 3.24k]
  ------------------
  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|  3.24k|    if (val) {
  ------------------
  |  Branch (518:9): [True: 0, False: 3.24k]
  ------------------
  519|      0|        acroform.replaceKey("/NeedAppearances", QPDFObjectHandle::newBool(true));
  520|  3.24k|    } else {
  521|  3.24k|        acroform.removeKey("/NeedAppearances");
  522|  3.24k|    }
  523|  3.24k|}
_ZN26QPDFAcroFormDocumentHelper27generateAppearancesIfNeededEv:
  527|  11.5k|{
  528|  11.5k|    m->generateAppearancesIfNeeded();
  529|  11.5k|}
_ZN4qpdf4impl8AcroForm27generateAppearancesIfNeededEv:
  533|  11.5k|{
  534|  11.5k|    if (!getNeedAppearances()) {
  ------------------
  |  Branch (534:9): [True: 6.23k, False: 5.27k]
  ------------------
  535|  6.23k|        return;
  536|  6.23k|    }
  537|       |
  538|  5.84k|    for (auto const& page: QPDFPageDocumentHelper(qpdf).getAllPages()) {
  ------------------
  |  Branch (538:26): [True: 5.84k, False: 5.27k]
  ------------------
  539|  18.8k|        for (auto& aoh: getWidgetAnnotationsForPage(page)) {
  ------------------
  |  Branch (539:23): [True: 18.8k, False: 5.84k]
  ------------------
  540|  18.8k|            QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh);
  541|  18.8k|            if (ffh.getFieldType() == "/Btn") {
  ------------------
  |  Branch (541:17): [True: 1.53k, False: 17.2k]
  ------------------
  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|  1.53k|                if (ffh.isRadioButton() || ffh.isCheckbox()) {
  ------------------
  |  Branch (546:21): [True: 516, False: 1.02k]
  |  Branch (546:44): [True: 985, False: 35]
  ------------------
  547|  1.50k|                    ffh.setV(ffh.getValue());
  548|  1.50k|                }
  549|  17.2k|            } else {
  550|  17.2k|                ffh.generateAppearance(aoh);
  551|  17.2k|            }
  552|  18.8k|        }
  553|  5.84k|    }
  554|  5.27k|    setNeedAppearances(false);
  555|  5.27k|}

_ZN26QPDFAnnotationObjectHelperC2E16QPDFObjectHandle:
   11|   117k|    QPDFObjectHelper(oh)
   12|   117k|{
   13|   117k|}
_ZN26QPDFAnnotationObjectHelper10getSubtypeEv:
   17|  25.5k|{
   18|  25.5k|    return oh().getKey("/Subtype").getName();
   19|  25.5k|}
_ZN26QPDFAnnotationObjectHelper7getRectEv:
   23|  7.75k|{
   24|  7.75k|    return oh().getKey("/Rect").getArrayAsRectangle();
   25|  7.75k|}
_ZN26QPDFAnnotationObjectHelper23getAppearanceDictionaryEv:
   29|  85.3k|{
   30|  85.3k|    return oh().getKey("/AP");
   31|  85.3k|}
_ZN26QPDFAnnotationObjectHelper18getAppearanceStateEv:
   35|  75.8k|{
   36|  75.8k|    Name AS = get("/AS");
   37|  75.8k|    return AS ? AS.value() : "";
  ------------------
  |  Branch (37:12): [True: 2.30k, False: 73.4k]
  ------------------
   38|  75.8k|}
_ZN26QPDFAnnotationObjectHelper8getFlagsEv:
   42|  16.9k|{
   43|  16.9k|    Integer flags_obj = get("/F");
   44|  16.9k|    return flags_obj ? flags_obj : 0;
  ------------------
  |  Branch (44:12): [True: 14.8k, False: 2.11k]
  ------------------
   45|  16.9k|}
_ZN26QPDFAnnotationObjectHelper19getAppearanceStreamERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
   49|  75.8k|{
   50|  75.8k|    QPDFObjectHandle ap = getAppearanceDictionary();
   51|  75.8k|    std::string desired_state = state.empty() ? getAppearanceState() : state;
  ------------------
  |  Branch (51:33): [True: 75.8k, False: 0]
  ------------------
   52|  75.8k|    if (ap.isDictionary()) {
  ------------------
  |  Branch (52:9): [True: 63.0k, False: 12.7k]
  ------------------
   53|  63.0k|        QPDFObjectHandle ap_sub = ap.getKey(which);
   54|  63.0k|        if (ap_sub.isStream()) {
  ------------------
  |  Branch (54:13): [True: 58.7k, False: 4.36k]
  ------------------
   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|  58.7k|            return ap_sub;
   60|  58.7k|        }
   61|  4.36k|        if (ap_sub.isDictionary() && !desired_state.empty()) {
  ------------------
  |  Branch (61:13): [True: 2.33k, False: 2.02k]
  |  Branch (61:38): [True: 2.02k, False: 311]
  ------------------
   62|  2.02k|            QPDFObjectHandle ap_sub_val = ap_sub.getKey(desired_state);
   63|  2.02k|            if (ap_sub_val.isStream()) {
  ------------------
  |  Branch (63:17): [True: 731, False: 1.29k]
  ------------------
   64|    731|                return ap_sub_val;
   65|    731|            }
   66|  2.02k|        }
   67|  4.36k|    }
   68|  16.3k|    return Null::temp();
   69|  75.8k|}
_ZN26QPDFAnnotationObjectHelper27getPageContentForAppearanceERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiii:
   74|  16.9k|{
   75|  16.9k|    if (!getAppearanceStream("/N").isStream()) {
  ------------------
  |  Branch (75:9): [True: 0, False: 16.9k]
  ------------------
   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|  16.9k|    QPDFObjectHandle rect_obj = oh().getKey("/Rect");
  141|  16.9k|    QPDFObjectHandle as = getAppearanceStream("/N").getDict();
  142|  16.9k|    QPDFObjectHandle bbox_obj = as.getKey("/BBox");
  143|  16.9k|    QPDFObjectHandle matrix_obj = as.getKey("/Matrix");
  144|       |
  145|  16.9k|    int flags = getFlags();
  146|  16.9k|    if (flags & forbidden_flags) {
  ------------------
  |  Branch (146:9): [True: 539, False: 16.4k]
  ------------------
  147|    539|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper forbidden flags");
  148|    539|        return "";
  149|    539|    }
  150|  16.4k|    if ((flags & required_flags) != required_flags) {
  ------------------
  |  Branch (150:9): [True: 0, False: 16.4k]
  ------------------
  151|      0|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper missing required flags");
  152|      0|        return "";
  153|      0|    }
  154|       |
  155|  16.4k|    if (!(bbox_obj.isRectangle() && rect_obj.isRectangle())) {
  ------------------
  |  Branch (155:11): [True: 15.2k, False: 1.12k]
  |  Branch (155:37): [True: 12.2k, False: 3.05k]
  ------------------
  156|  4.17k|        return "";
  157|  4.17k|    }
  158|  12.2k|    QPDFMatrix matrix;
  159|  12.2k|    if (matrix_obj.isMatrix()) {
  ------------------
  |  Branch (159:9): [True: 332, False: 11.8k]
  ------------------
  160|    332|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper explicit matrix");
  161|    332|        matrix = QPDFMatrix(matrix_obj.getArrayAsMatrix());
  162|  11.8k|    } else {
  163|  11.8k|        QTC::TC("qpdf", "QPDFAnnotationObjectHelper default matrix");
  164|  11.8k|    }
  165|  12.2k|    QPDFObjectHandle::Rectangle rect = rect_obj.getArrayAsRectangle();
  166|  12.2k|    bool do_rotate = (rotate && (flags & an_no_rotate));
  ------------------
  |  Branch (166:23): [True: 363, False: 11.8k]
  |  Branch (166:33): [True: 188, False: 175]
  ------------------
  167|  12.2k|    if (do_rotate) {
  ------------------
  |  Branch (167:9): [True: 188, False: 12.0k]
  ------------------
  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|    188|        QPDFMatrix mr;
  175|    188|        mr.rotatex90(rotate);
  176|    188|        mr.concat(matrix);
  177|    188|        matrix = mr;
  178|    188|        double rect_w = rect.urx - rect.llx;
  179|    188|        double rect_h = rect.ury - rect.lly;
  180|    188|        switch (rotate) {
  181|     15|        case 90:
  ------------------
  |  Branch (181:9): [True: 15, False: 173]
  ------------------
  182|     15|            QTC::TC("qpdf", "QPDFAnnotationObjectHelper rotate 90");
  183|     15|            rect = QPDFObjectHandle::Rectangle(
  184|     15|                rect.llx, rect.ury, rect.llx + rect_h, rect.ury + rect_w);
  185|     15|            break;
  186|      6|        case 180:
  ------------------
  |  Branch (186:9): [True: 6, False: 182]
  ------------------
  187|      6|            QTC::TC("qpdf", "QPDFAnnotationObjectHelper rotate 180");
  188|      6|            rect = QPDFObjectHandle::Rectangle(
  189|      6|                rect.llx - rect_w, rect.ury, rect.llx, rect.ury + rect_h);
  190|      6|            break;
  191|    126|        case 270:
  ------------------
  |  Branch (191:9): [True: 126, False: 62]
  ------------------
  192|    126|            QTC::TC("qpdf", "QPDFAnnotationObjectHelper rotate 270");
  193|    126|            rect = QPDFObjectHandle::Rectangle(
  194|    126|                rect.llx - rect_h, rect.ury - rect_w, rect.llx, rect.ury);
  195|    126|            break;
  196|     41|        default:
  ------------------
  |  Branch (196:9): [True: 41, False: 147]
  ------------------
  197|       |            // ignore
  198|     41|            break;
  199|    188|        }
  200|    188|    }
  201|       |
  202|       |    // Transform bounding box by matrix to get T
  203|  12.2k|    QPDFObjectHandle::Rectangle bbox = bbox_obj.getArrayAsRectangle();
  204|  12.2k|    QPDFObjectHandle::Rectangle T = matrix.transformRectangle(bbox);
  205|  12.2k|    if ((T.urx == T.llx) || (T.ury == T.lly)) {
  ------------------
  |  Branch (205:9): [True: 39, False: 12.1k]
  |  Branch (205:29): [True: 47, False: 12.1k]
  ------------------
  206|       |        // avoid division by zero
  207|     85|        return "";
  208|     85|    }
  209|       |    // Compute a matrix to transform the appearance box to the rectangle
  210|  12.1k|    QPDFMatrix AA;
  211|  12.1k|    AA.translate(rect.llx, rect.lly);
  212|  12.1k|    AA.scale((rect.urx - rect.llx) / (T.urx - T.llx), (rect.ury - rect.lly) / (T.ury - T.lly));
  213|  12.1k|    AA.translate(-T.llx, -T.lly);
  214|  12.1k|    if (do_rotate) {
  ------------------
  |  Branch (214:9): [True: 164, False: 11.9k]
  ------------------
  215|    164|        AA.rotatex90(rotate);
  216|    164|    }
  217|       |
  218|  12.1k|    as.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
  219|  12.1k|    return ("q\n" + AA.unparse() + " cm\n" + name + " Do\n" + "Q\n");
  220|  12.2k|}

_ZN18QPDFCryptoProvider7getImplEv:
   19|   412k|{
   20|   412k|    QPDFCryptoProvider& p = getInstance();
   21|   412k|    if (p.m->default_provider.empty()) {
  ------------------
  |  Branch (21:9): [True: 0, False: 412k]
  ------------------
   22|      0|        throw std::logic_error("QPDFCryptoProvider::getImpl called with no default provider.");
   23|      0|    }
   24|   412k|    return p.getImpl_internal(p.m->default_provider);
   25|   412k|}
_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|   412k|{
   67|   412k|    static QPDFCryptoProvider instance;
   68|   412k|    return instance;
   69|   412k|}
_ZNK18QPDFCryptoProvider16getImpl_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   73|   412k|{
   74|   412k|    auto iter = m->providers.find(name);
   75|   412k|    if (iter == m->providers.end()) {
  ------------------
  |  Branch (75:9): [True: 0, False: 412k]
  ------------------
   76|      0|        throw std::logic_error(
   77|      0|            "QPDFCryptoProvider requested unknown implementation \"" + name + "\"");
   78|      0|    }
   79|   412k|    return m->providers[name]();
   80|   412k|}
_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|    196|{
   37|    196|    getRandomProvider()->provideRandomData(data, len);
   38|    196|}
_ZN17QPDFCrypto_native8MD5_initEv:
   42|   110k|{
   43|   110k|    md5 = std::make_shared<MD5_native>();
   44|   110k|}
_ZN17QPDFCrypto_native10MD5_updateEPKhm:
   48|   116k|{
   49|   116k|    md5->update(const_cast<unsigned char*>(data), len);
   50|   116k|}
_ZN17QPDFCrypto_native12MD5_finalizeEv:
   54|   110k|{
   55|   110k|    md5->finalize();
   56|   110k|}
_ZN17QPDFCrypto_native10MD5_digestEPh:
   60|   110k|{
   61|   110k|    md5->digest(d);
   62|   110k|}
_ZN17QPDFCrypto_native8RC4_initEPKhi:
   66|  41.0k|{
   67|  41.0k|    rc4 = std::make_shared<RC4_native>(key_data, key_len);
   68|  41.0k|}
_ZN17QPDFCrypto_native11RC4_processEPKhmPh:
   72|  41.1k|{
   73|  41.1k|    rc4->process(in_data, len, out_data);
   74|  41.1k|}
_ZN17QPDFCrypto_native9SHA2_initEi:
   83|  98.2k|{
   84|  98.2k|    sha2 = std::make_shared<SHA2_native>(bits);
   85|  98.2k|}
_ZN17QPDFCrypto_native11SHA2_updateEPKhm:
   89|  98.8k|{
   90|  98.8k|    sha2->update(data, len);
   91|  98.8k|}
_ZN17QPDFCrypto_native13SHA2_finalizeEv:
   95|  98.2k|{
   96|  98.2k|    sha2->finalize();
   97|  98.2k|}
_ZN17QPDFCrypto_native11SHA2_digestEv:
  101|  98.2k|{
  102|  98.2k|    return sha2->getRawDigest();
  103|  98.2k|}
_ZN17QPDFCrypto_native13rijndael_initEbPKhmbPh:
  113|   162k|{
  114|   162k|    aes_pdf = std::make_shared<AES_PDF_native>(encrypt, key_data, key_len, cbc_mode, cbc_block);
  115|   162k|}
_ZN17QPDFCrypto_native16rijndael_processEPhS0_:
  119|  26.6M|{
  120|  26.6M|    aes_pdf->update(in_data, out_data);
  121|  26.6M|}
_ZN17QPDFCrypto_native17rijndael_finalizeEv:
  125|   162k|{
  126|   162k|}
QPDFCrypto_native.cc:_ZL17getRandomProviderv:
   12|    196|{
   13|       |#ifdef USE_INSECURE_RANDOM
   14|       |    static RandomDataProvider* insecure_random_data_provider =
   15|       |        InsecureRandomDataProvider::getInstance();
   16|       |#else
   17|    196|    static RandomDataProvider* insecure_random_data_provider = nullptr;
   18|    196|#endif
   19|    196|    static RandomDataProvider* secure_random_data_provider =
   20|    196|        SecureRandomDataProvider::getInstance();
   21|       |
   22|    196|    static RandomDataProvider* provider =
   23|    196|        (secure_random_data_provider         ? secure_random_data_provider
  ------------------
  |  Branch (23:10): [True: 1, False: 195]
  ------------------
   24|    196|             : insecure_random_data_provider ? insecure_random_data_provider
  ------------------
  |  Branch (24:16): [True: 0, False: 195]
  ------------------
   25|    195|                                             : nullptr);
   26|       |
   27|    196|    if (provider == nullptr) {
  ------------------
  |  Branch (27:9): [True: 0, False: 196]
  ------------------
   28|      0|        throw std::logic_error("QPDFCrypto_native has no random data provider");
   29|      0|    }
   30|       |
   31|    196|    return provider;
   32|    196|}

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   950k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 589k, False: 361k]
  ------------------
   10|   950k|    error_code(error_code),
   11|   950k|    filename(filename),
   12|   950k|    object(object),
   13|   950k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 589k, False: 361k]
  ------------------
   14|   950k|    message(message)
   15|   950k|{
   16|   950k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   370k|    std::runtime_error(
   26|   370k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 370k, False: 40]
  |  Branch (26:49): [True: 40, False: 0]
  ------------------
   27|   370k|    error_code(error_code),
   28|   370k|    filename(filename),
   29|   370k|    object(object),
   30|   370k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 370k, False: 40]
  |  Branch (30:22): [True: 40, False: 0]
  ------------------
   31|   370k|    message(message)
   32|   370k|{
   33|   370k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|  1.32M|{
   42|  1.32M|    std::string result;
   43|  1.32M|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 972k, False: 348k]
  ------------------
   44|   972k|        result += filename;
   45|   972k|    }
   46|  1.32M|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 180k, False: 1.14M]
  |  Branch (46:29): [True: 134k, False: 46.0k]
  ------------------
   47|  1.18M|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 838k, False: 348k]
  ------------------
   48|   838k|            result += " (";
   49|   838k|        }
   50|  1.18M|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 1.14M, False: 46.0k]
  ------------------
   51|  1.14M|            result += object;
   52|  1.14M|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 779k, False: 360k]
  ------------------
   53|   779k|                result += ", ";
   54|   779k|            }
   55|  1.14M|        }
   56|  1.18M|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 826k, False: 360k]
  ------------------
   57|   826k|            result += "offset " + std::to_string(offset);
   58|   826k|        }
   59|  1.18M|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 838k, False: 348k]
  ------------------
   60|   838k|            result += ")";
   61|   838k|        }
   62|  1.18M|    }
   63|  1.32M|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 1.32M, False: 246]
  ------------------
   64|  1.32M|        result += ": ";
   65|  1.32M|    }
   66|  1.32M|    result += message;
   67|  1.32M|    return result;
   68|  1.32M|}

_ZN25QPDFFormFieldObjectHelperC2E16QPDFObjectHandle:
   34|  35.9k|    QPDFObjectHelper(o),
   35|  35.9k|    m(std::make_shared<Members>(oh()))
   36|  35.9k|{
   37|  35.9k|}
_ZN25QPDFFormFieldObjectHelperC2Ev:
   40|  33.7k|    QPDFObjectHelper(Null::temp()),
   41|  33.7k|    m(std::make_shared<Members>(QPDFObjectHandle()))
   42|  33.7k|{
   43|  33.7k|}
_ZNK4qpdf4impl8FormNode9inheritedERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
   92|  31.2k|{
   93|  31.2k|    if (!obj) {
  ------------------
  |  Branch (93:9): [True: 672, False: 30.5k]
  ------------------
   94|    672|        return null_oh;
   95|    672|    }
   96|  30.5k|    auto node = *this;
   97|  30.5k|    QPDFObjGen::set seen;
   98|  30.5k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
   99|  46.1k|    while (node.Parent() && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (99:12): [True: 21.1k, False: 25.0k]
  |  Branch (99:12): [True: 20.2k, False: 25.8k]
  |  Branch (99:30): [True: 17.6k, False: 3.48k]
  |  Branch (99:46): [True: 2.62k, False: 857]
  ------------------
  100|  20.2k|        node = node.Parent();
  101|  20.2k|        if (auto const& result = node[name]) {
  ------------------
  |  Branch (101:25): [True: 4.70k, False: 15.5k]
  ------------------
  102|  4.70k|            return {result};
  103|  4.70k|        }
  104|  20.2k|    }
  105|  25.8k|    return acroform ? from_AcroForm(name) : null_oh;
  ------------------
  |  Branch (105:12): [True: 0, False: 25.8k]
  ------------------
  106|  30.5k|}
_ZNK4qpdf4impl8FormNode18inheritable_stringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  116|  14.1k|{
  117|  14.1k|    if (auto fv = inheritable_value<String>(name)) {
  ------------------
  |  Branch (117:14): [True: 827, False: 13.3k]
  ------------------
  118|    827|        return fv.utf8_value();
  119|    827|    }
  120|  13.3k|    return {};
  121|  14.1k|}
_ZN25QPDFFormFieldObjectHelper12getFieldTypeEv:
  134|  18.8k|{
  135|  18.8k|    if (auto ft = m->FT()) {
  ------------------
  |  Branch (135:14): [True: 18.0k, False: 741]
  ------------------
  136|  18.0k|        return ft;
  137|  18.0k|    }
  138|    741|    return {};
  139|  18.8k|}
_ZNK4qpdf4impl8FormNode20fully_qualified_nameEv:
  149|  9.49k|{
  150|  9.49k|    std::string result;
  151|  9.49k|    auto node = *this;
  152|  9.49k|    QPDFObjGen::set seen;
  153|  9.49k|    size_t depth = 0; // Don't bother with loop detection until depth becomes suspicious
  154|  46.7k|    while (node && (++depth < 10 || seen.add(node))) {
  ------------------
  |  Branch (154:12): [True: 38.6k, False: 8.12k]
  |  Branch (154:21): [True: 31.7k, False: 6.83k]
  |  Branch (154:37): [True: 5.46k, False: 1.37k]
  ------------------
  155|  37.2k|        if (auto T = node.T()) {
  ------------------
  |  Branch (155:18): [True: 32.9k, False: 4.24k]
  ------------------
  156|  32.9k|            if (!result.empty()) {
  ------------------
  |  Branch (156:17): [True: 23.5k, False: 9.49k]
  ------------------
  157|  23.5k|                result.insert(0, 1, '.');
  158|  23.5k|            }
  159|  32.9k|            result.insert(0, T.utf8_value());
  160|  32.9k|        }
  161|  37.2k|        node = node.Parent();
  162|  37.2k|    }
  163|  9.49k|    return result;
  164|  9.49k|}
_ZN25QPDFFormFieldObjectHelper8getValueEv:
  213|  1.50k|{
  214|  1.50k|    return Null::if_null(m->V<QPDFObjectHandle>());
  215|  1.50k|}
_ZNK4qpdf4impl8FormNode5valueEv:
  225|  14.1k|{
  226|  14.1k|    return inheritable_string("/V");
  227|  14.1k|}
_ZN25QPDFFormFieldObjectHelper19getDefaultResourcesEv:
  249|  15.7k|{
  250|  15.7k|    return Null::if_null(m->getDefaultResources());
  251|  15.7k|}
_ZN4qpdf4impl8FormNode19getDefaultResourcesEv:
  255|  25.0k|{
  256|  25.0k|    return from_AcroForm("/DR");
  257|  25.0k|}
_ZNK4qpdf4impl8FormNode18default_appearanceEv:
  267|  14.1k|{
  268|  14.1k|    if (auto DA = inheritable_value<String>("/DA")) {
  ------------------
  |  Branch (268:14): [True: 11.4k, False: 2.65k]
  ------------------
  269|  11.4k|        return DA.utf8_value();
  270|  11.4k|    }
  271|  2.65k|    if (String DA = from_AcroForm("/DA")) {
  ------------------
  |  Branch (271:16): [True: 460, False: 2.19k]
  ------------------
  272|    460|        return DA.utf8_value();
  273|    460|    }
  274|  2.19k|    return {};
  275|  2.65k|}
_ZN4qpdf4impl8FormNode8getFlagsEv:
  307|  6.81k|{
  308|  6.81k|    auto f = inheritable_value<QPDFObjectHandle>("/Ff");
  309|  6.81k|    return f.isInteger() ? f.getIntValueAsInt() : 0;
  ------------------
  |  Branch (309:12): [True: 2.36k, False: 4.45k]
  ------------------
  310|  6.81k|}
_ZN25QPDFFormFieldObjectHelper10isCheckboxEv:
  326|  1.02k|{
  327|  1.02k|    return m->isCheckbox();
  328|  1.02k|}
_ZN4qpdf4impl8FormNode10isCheckboxEv:
  332|  2.52k|{
  333|  2.52k|    return FT() == "/Btn" && (getFlags() & (ff_btn_radio | ff_btn_pushbutton)) == 0;
  ------------------
  |  Branch (333:12): [True: 2.52k, False: 0]
  |  Branch (333:30): [True: 1.97k, False: 551]
  ------------------
  334|  2.52k|}
_ZN25QPDFFormFieldObjectHelper13isRadioButtonEv:
  350|  1.53k|{
  351|  1.53k|    return m->isRadioButton();
  352|  1.53k|}
_ZN4qpdf4impl8FormNode13isRadioButtonEv:
  356|  2.51k|{
  357|  2.51k|    return FT() == "/Btn" && (getFlags() & ff_btn_radio) == ff_btn_radio;
  ------------------
  |  Branch (357:12): [True: 2.48k, False: 29]
  |  Branch (357:30): [True: 1.46k, False: 1.02k]
  ------------------
  358|  2.51k|}
_ZN4qpdf4impl8FormNode8isChoiceEv:
  380|  15.7k|{
  381|  15.7k|    return FT() == "/Ch";
  382|  15.7k|}
_ZN4qpdf4impl8FormNode10getChoicesEv:
  392|  1.57k|{
  393|  1.57k|    if (!isChoice()) {
  ------------------
  |  Branch (393:9): [True: 0, False: 1.57k]
  ------------------
  394|      0|        return {};
  395|      0|    }
  396|  1.57k|    std::vector<std::string> result;
  397|  64.7k|    for (auto const& item: inheritable_value<Array>("/Opt")) {
  ------------------
  |  Branch (397:26): [True: 64.7k, False: 1.57k]
  ------------------
  398|  64.7k|        if (item.isString()) {
  ------------------
  |  Branch (398:13): [True: 53.4k, False: 11.2k]
  ------------------
  399|  53.4k|            result.emplace_back(item.getUTF8Value());
  400|  53.4k|        } else if (item.size() == 2) {
  ------------------
  |  Branch (400:20): [True: 281, False: 11.0k]
  ------------------
  401|    281|            auto display = item.getArrayItem(1);
  402|    281|            if (display.isString()) {
  ------------------
  |  Branch (402:17): [True: 212, False: 69]
  ------------------
  403|    212|                result.emplace_back(display.getUTF8Value());
  404|    212|            }
  405|    281|        }
  406|  64.7k|    }
  407|  1.57k|    return result;
  408|  1.57k|}
_ZN4qpdf4impl8FormNode17setFieldAttributeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKNS_4NameE:
  424|    533|{
  425|    533|    replace(key, value);
  426|    533|}
_ZN25QPDFFormFieldObjectHelper4setVE16QPDFObjectHandleb:
  442|  1.50k|{
  443|  1.50k|    m->setV(value, need_appearances);
  444|  1.50k|}
_ZN4qpdf4impl8FormNode4setVE16QPDFObjectHandleb:
  448|  1.50k|{
  449|  1.50k|    if (FT() == "/Btn") {
  ------------------
  |  Branch (449:9): [True: 1.50k, False: 0]
  ------------------
  450|  1.50k|        Name name = value;
  451|  1.50k|        if (isCheckbox()) {
  ------------------
  |  Branch (451:13): [True: 985, False: 516]
  ------------------
  452|    985|            if (!name) {
  ------------------
  |  Branch (452:17): [True: 452, False: 533]
  ------------------
  453|    452|                warn("ignoring attempt to set a checkbox field to a value whose type is not name");
  454|    452|                return;
  455|    452|            }
  456|       |            // Accept any value other than /Off to mean checked. Files have been seen that use
  457|       |            // /1 or other values.
  458|    533|            setCheckBoxValue(name != "/Off");
  459|    533|            return;
  460|    985|        }
  461|    516|        if (isRadioButton()) {
  ------------------
  |  Branch (461:13): [True: 516, False: 0]
  ------------------
  462|    516|            if (!name) {
  ------------------
  |  Branch (462:17): [True: 56, False: 460]
  ------------------
  463|     56|                warn(
  464|     56|                    "ignoring attempt to set a radio button field to an object that is not a name");
  465|     56|                return;
  466|     56|            }
  467|    460|            setRadioButtonValue(name);
  468|    460|            return;
  469|    516|        }
  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|    516|    }
  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|    815|{
  503|    815|    qpdf_expect(name);
  ------------------
  |  |   13|    815|#define qpdf_expect assert
  ------------------
  |  Branch (503:5): [True: 815, 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|    815|    auto kids = Kids();
  512|    815|    if (!kids) {
  ------------------
  |  Branch (512:9): [True: 401, False: 414]
  ------------------
  513|       |        // This is most likely one of the individual buttons. Try calling on the parent.
  514|    401|        auto parent = Parent();
  515|    401|        if (parent.Kids()) {
  ------------------
  |  Branch (515:13): [True: 355, False: 46]
  ------------------
  516|    355|            parent.setRadioButtonValue(name);
  517|    355|            return;
  518|    355|        }
  519|    401|    }
  520|    460|    if (!isRadioButton() || !kids) {
  ------------------
  |  Branch (520:9): [True: 29, False: 431]
  |  Branch (520:29): [True: 46, False: 385]
  ------------------
  521|     75|        warn("don't know how to set the value of this field as a radio button");
  522|     75|        return;
  523|     75|    }
  524|    385|    replace("/V", name);
  525|  4.16k|    for (FormNode kid: kids) {
  ------------------
  |  Branch (525:22): [True: 4.16k, False: 385]
  ------------------
  526|  4.16k|        auto ap = kid.AP();
  527|  4.16k|        QPDFObjectHandle annot;
  528|  4.16k|        if (!ap) {
  ------------------
  |  Branch (528:13): [True: 3.24k, False: 919]
  ------------------
  529|       |            // The widget may be below. If there is more than one, just find the first one.
  530|  3.24k|            for (FormNode grandkid: kid.Kids()) {
  ------------------
  |  Branch (530:35): [True: 3.18k, False: 3.14k]
  ------------------
  531|  3.18k|                ap = grandkid.AP();
  532|  3.18k|                if (ap) {
  ------------------
  |  Branch (532:21): [True: 103, False: 3.08k]
  ------------------
  533|    103|                    annot = grandkid;
  534|    103|                    break;
  535|    103|                }
  536|  3.18k|            }
  537|  3.24k|        } else {
  538|    919|            annot = kid;
  539|    919|        }
  540|  4.16k|        if (!annot) {
  ------------------
  |  Branch (540:13): [True: 3.14k, False: 1.02k]
  ------------------
  541|  3.14k|            warn("unable to set the value of this radio button");
  542|  3.14k|            continue;
  543|  3.14k|        }
  544|  1.02k|        if (ap["/N"].contains(name.value())) {
  ------------------
  |  Branch (544:13): [True: 196, False: 826]
  ------------------
  545|    196|            annot.replace("/AS", name);
  546|    826|        } else {
  547|    826|            annot.replace("/AS", Name("/Off"));
  548|    826|        }
  549|  1.02k|    }
  550|    385|}
_ZN4qpdf4impl8FormNode16setCheckBoxValueEb:
  554|    533|{
  555|    533|    auto ap = AP();
  556|    533|    QPDFObjectHandle annot;
  557|    533|    if (ap) {
  ------------------
  |  Branch (557:9): [True: 396, False: 137]
  ------------------
  558|    396|        annot = oh();
  559|    396|    } else {
  560|       |        // The widget may be below. If there is more than one, just find the first one.
  561|  1.66k|        for (FormNode kid: Kids()) {
  ------------------
  |  Branch (561:26): [True: 1.66k, False: 105]
  ------------------
  562|  1.66k|            ap = kid.AP();
  563|  1.66k|            if (ap) {
  ------------------
  |  Branch (563:17): [True: 32, False: 1.63k]
  ------------------
  564|     32|                annot = kid;
  565|     32|                break;
  566|     32|            }
  567|  1.66k|        }
  568|    137|    }
  569|    533|    std::string on_value;
  570|    533|    if (value) {
  ------------------
  |  Branch (570:9): [True: 450, False: 83]
  ------------------
  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|    450|        if (ap) {
  ------------------
  |  Branch (573:13): [True: 359, False: 91]
  ------------------
  574|    470|            for (auto const& item: Dictionary(ap["/N"])) {
  ------------------
  |  Branch (574:34): [True: 470, False: 73]
  ------------------
  575|    470|                if (item.first != "/Off") {
  ------------------
  |  Branch (575:21): [True: 286, False: 184]
  ------------------
  576|    286|                    on_value = item.first;
  577|    286|                    break;
  578|    286|                }
  579|    470|            }
  580|    359|        }
  581|    450|        if (on_value.empty()) {
  ------------------
  |  Branch (581:13): [True: 164, False: 286]
  ------------------
  582|    164|            on_value = "/Yes";
  583|    164|        }
  584|    450|    }
  585|       |
  586|       |    // Set /AS to the on value or /Off in addition to setting /V.
  587|    533|    auto name = Name(value ? on_value : "/Off");
  ------------------
  |  Branch (587:22): [True: 450, False: 83]
  ------------------
  588|    533|    setFieldAttribute("/V", name);
  589|    533|    if (!annot) {
  ------------------
  |  Branch (589:9): [True: 105, False: 428]
  ------------------
  590|    105|        warn("unable to set the value of this checkbox");
  591|    105|        return;
  592|    105|    }
  593|    428|    annot.replace("/AS", name);
  594|    428|}
_ZN25QPDFFormFieldObjectHelper18generateAppearanceER26QPDFAnnotationObjectHelper:
  598|  17.2k|{
  599|  17.2k|    m->generateAppearance(aoh);
  600|  17.2k|}
_ZN4qpdf4impl8FormNode18generateAppearanceER26QPDFAnnotationObjectHelper:
  604|  17.2k|{
  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|  17.2k|    auto ft = FT();
  608|  17.2k|    if (ft == "/Tx" || ft == "/Ch") {
  ------------------
  |  Branch (608:9): [True: 14.5k, False: 2.73k]
  |  Branch (608:24): [True: 1.83k, False: 898]
  ------------------
  609|  16.3k|        generateTextAppearance(aoh);
  610|  16.3k|    }
  611|  17.2k|}
_ZN4qpdf4impl8FormNode22generateTextAppearanceER26QPDFAnnotationObjectHelper:
  881|  16.3k|{
  882|  16.3k|    no_ci_warn_if(
  883|  16.3k|        !Dictionary(aoh), // There is no guarantee that aoh is a dictionary
  884|  16.3k|        "cannot generate appearance for non-dictionary annotation" //
  885|  16.3k|    );
  886|  16.3k|    Stream AS = aoh.getAppearanceStream("/N"); // getAppearanceStream returns a stream or null.
  887|  16.3k|    if (!AS) {
  ------------------
  |  Branch (887:9): [True: 7.75k, False: 8.62k]
  ------------------
  888|  7.75k|        QPDFObjectHandle::Rectangle rect = aoh.getRect(); // may silently be invalid / all zeros
  889|  7.75k|        QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly);
  890|  7.75k|        auto* pdf = qpdf();
  891|  7.75k|        no_ci_stop_damaged_if(!pdf, "unable to get owning QPDF for appearance generation");
  892|  7.75k|        AS = pdf->newStream("/Tx BMC\nEMC\n");
  893|  7.75k|        AS.replaceDict(Dictionary(
  894|  7.75k|            {{"/BBox", QPDFObjectHandle::newFromRectangle(bbox)},
  895|  7.75k|             {"/Resources", Dictionary({{"/ProcSet", Array({Name("/PDF"), Name("/Text")})}})},
  896|  7.75k|             {"/Type", Name("/XObject")},
  897|  7.75k|             {"/Subtype", Name("/Form")}}));
  898|  7.75k|        if (auto ap = AP()) {
  ------------------
  |  Branch (898:18): [True: 1.12k, False: 6.63k]
  ------------------
  899|  1.12k|            ap.replace("/N", AS);
  900|  6.63k|        } else {
  901|  6.63k|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  902|  6.63k|        }
  903|  7.75k|    }
  904|       |
  905|  16.3k|    if (AS.obj_sp().use_count() > 3) {
  ------------------
  |  Branch (905:9): [True: 2.44k, False: 13.9k]
  ------------------
  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|  2.44k|        auto data = AS.getStreamData(qpdf_dl_all);
  918|  2.44k|        AS = AS.copy();
  919|  2.44k|        AS.replaceStreamData(std::move(data), Null::temp(), Null::temp());
  920|  2.44k|        if (Dictionary AP = aoh.getAppearanceDictionary()) {
  ------------------
  |  Branch (920:24): [True: 1.01k, False: 1.42k]
  ------------------
  921|  1.01k|            AP.replace("/N", AS);
  922|  1.42k|        } else {
  923|  1.42k|            aoh.replace("/AP", Dictionary({{"/N", AS}}));
  924|       |            // aoh is a dictionary, so insertion will succeed. No need to check by retrieving it.
  925|  1.42k|        }
  926|  2.44k|    }
  927|  16.3k|    QPDFObjectHandle bbox_obj = AS.getDict()["/BBox"];
  928|  16.3k|    if (!bbox_obj.isRectangle()) {
  ------------------
  |  Branch (928:9): [True: 797, False: 15.5k]
  ------------------
  929|    797|        aoh.warn("unable to get appearance stream bounding box");
  930|    797|        return;
  931|    797|    }
  932|  15.5k|    QPDFObjectHandle::Rectangle bbox = bbox_obj.getArrayAsRectangle();
  933|  15.5k|    std::string DA = default_appearance();
  934|  15.5k|    std::string V = value();
  935|       |
  936|  15.5k|    TfFinder tff;
  937|  15.5k|    Pl_QPDFTokenizer tok("tf", &tff);
  938|  15.5k|    tok.writeString(DA);
  939|  15.5k|    tok.finish();
  940|  15.5k|    double tf = tff.getTf();
  941|  15.5k|    DA = tff.getDA();
  942|       |
  943|  15.5k|    std::string (*encoder)(std::string const&, char) = &QUtil::utf8_to_ascii;
  944|  15.5k|    std::string font_name = tff.getFontName();
  945|  15.5k|    if (!font_name.empty()) {
  ------------------
  |  Branch (945:9): [True: 9.67k, False: 5.91k]
  ------------------
  946|       |        // See if the font is encoded with something we know about.
  947|  9.67k|        Dictionary resources = AS.getDict()["/Resources"];
  948|  9.67k|        Dictionary font = resources["/Font"][font_name];
  949|  9.67k|        if (!font) {
  ------------------
  |  Branch (949:13): [True: 9.22k, False: 449]
  ------------------
  950|  9.22k|            font = getDefaultResources()["/Font"][font_name];
  951|  9.22k|            if (resources) {
  ------------------
  |  Branch (951:17): [True: 7.44k, False: 1.78k]
  ------------------
  952|  7.44k|                if (resources.indirect()) {
  ------------------
  |  Branch (952:21): [True: 212, False: 7.22k]
  ------------------
  953|    212|                    resources = resources.qpdf()->makeIndirectObject(resources.copy());
  954|    212|                    AS.getDict().replace("/Resources", resources);
  955|    212|                }
  956|       |                // Use mergeResources to force /Font to be local
  957|  7.44k|                QPDFObjectHandle res = resources;
  958|  7.44k|                res.mergeResources(Dictionary({{"/Font", Dictionary::empty()}}));
  959|  7.44k|                res.getKey("/Font").replace(font_name, font);
  960|  7.44k|            }
  961|  9.22k|        }
  962|       |
  963|  9.67k|        if (Name Encoding = font["/Encoding"]) {
  ------------------
  |  Branch (963:18): [True: 1.42k, False: 8.24k]
  ------------------
  964|  1.42k|            if (Encoding == "/WinAnsiEncoding") {
  ------------------
  |  Branch (964:17): [True: 373, False: 1.05k]
  ------------------
  965|    373|                encoder = &QUtil::utf8_to_win_ansi;
  966|  1.05k|            } else if (Encoding == "/MacRomanEncoding") {
  ------------------
  |  Branch (966:24): [True: 40, False: 1.01k]
  ------------------
  967|     40|                encoder = &QUtil::utf8_to_mac_roman;
  968|     40|            }
  969|  1.42k|        }
  970|  9.67k|    }
  971|       |
  972|  15.5k|    V = (*encoder)(V, '?');
  973|       |
  974|  15.5k|    std::vector<std::string> opt;
  975|  15.5k|    if (isChoice() && (getFlags() & ff_ch_combo) == 0) {
  ------------------
  |  Branch (975:9): [True: 1.80k, False: 13.7k]
  |  Branch (975:23): [True: 1.57k, False: 233]
  ------------------
  976|  1.57k|        opt = getChoices();
  977|  53.6k|        for (auto& o: opt) {
  ------------------
  |  Branch (977:21): [True: 53.6k, False: 1.57k]
  ------------------
  978|  53.6k|            o = (*encoder)(o, '?');
  979|  53.6k|        }
  980|  1.57k|    }
  981|       |
  982|  15.5k|    std::string result;
  983|  15.5k|    pl::String pl(result);
  984|  15.5k|    ValueSetter vs(DA, V, opt, tf, bbox);
  985|  15.5k|    Pl_QPDFTokenizer vs_tok("", &vs, &pl);
  986|  15.5k|    vs_tok.writeString(AS.getStreamData(qpdf_dl_all));
  987|  15.5k|    vs_tok.finish();
  988|  15.5k|    AS.replaceStreamData(std::move(result), Null::temp(), Null::temp());
  989|  15.5k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderC2Ev:
  800|  14.1k|        TfFinder() = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder11handleTokenERKN13QPDFTokenizer5TokenE:
  805|   604k|        {
  806|   604k|            auto ttype = token.getType();
  807|   604k|            auto const& value = token.getValue();
  808|   604k|            DA.emplace_back(token.getRawValue());
  809|   604k|            switch (ttype) {
  810|   107k|            case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (810:13): [True: 107k, False: 496k]
  ------------------
  811|   139k|            case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (811:13): [True: 32.2k, False: 571k]
  ------------------
  812|   139k|                last_num = strtod(value.c_str(), nullptr);
  813|   139k|                last_num_idx = QIntC::to_int(DA.size() - 1);
  814|   139k|                break;
  815|       |
  816|  88.2k|            case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (816:13): [True: 88.2k, False: 515k]
  ------------------
  817|  88.2k|                last_name = value;
  818|  88.2k|                break;
  819|       |
  820|  93.5k|            case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (820:13): [True: 93.5k, False: 510k]
  ------------------
  821|  93.5k|                if (token.isWord("Tf")) {
  ------------------
  |  Branch (821:21): [True: 10.8k, False: 82.6k]
  ------------------
  822|  10.8k|                    if ((last_num > 1.0) && (last_num < 1000.0)) {
  ------------------
  |  Branch (822:25): [True: 9.57k, False: 1.25k]
  |  Branch (822:45): [True: 9.41k, False: 163]
  ------------------
  823|       |                        // These ranges are arbitrary but keep us from doing insane things or
  824|       |                        // suffering from over/underflow
  825|  9.41k|                        tf = last_num;
  826|  9.41k|                    }
  827|  10.8k|                    tf_idx = last_num_idx;
  828|  10.8k|                    font_name = last_name;
  829|  10.8k|                }
  830|  93.5k|                break;
  831|       |
  832|   282k|            default:
  ------------------
  |  Branch (832:13): [True: 282k, False: 321k]
  ------------------
  833|   282k|                break;
  834|   604k|            }
  835|   604k|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder5getTfEv:
  839|  14.1k|        {
  840|  14.1k|            return tf;
  841|  14.1k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinder5getDAEv:
  850|  14.1k|        {
  851|  14.1k|            std::string result;
  852|  14.1k|            int i = -1;
  853|   604k|            for (auto const& cur: DA) {
  ------------------
  |  Branch (853:33): [True: 604k, False: 14.1k]
  ------------------
  854|   604k|                if (++i == tf_idx) {
  ------------------
  |  Branch (854:21): [True: 9.73k, False: 594k]
  ------------------
  855|  9.73k|                    double delta = strtod(cur.c_str(), nullptr) - tf;
  856|  9.73k|                    if (delta > 0.001 || delta < -0.001) {
  ------------------
  |  Branch (856:25): [True: 96, False: 9.63k]
  |  Branch (856:42): [True: 624, False: 9.01k]
  ------------------
  857|       |                        // tf doesn't match the font size passed to Tf, so substitute.
  858|    720|                        QTC::TC("qpdf", "QPDFFormFieldObjectHelper fallback Tf");
  859|    720|                        result += QUtil::double_to_string(tf);
  860|    720|                        continue;
  861|    720|                    }
  862|  9.73k|                }
  863|   603k|                result += cur;
  864|   603k|            }
  865|  14.1k|            return result;
  866|  14.1k|        }
QPDFFormFieldObjectHelper.cc:_ZNK12_GLOBAL__N_18TfFinder11getFontNameEv:
  844|  14.1k|        {
  845|  14.1k|            return font_name;
  846|  14.1k|        }
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS1_6vectorIS7_NS5_IS7_EEEEdRKN16QPDFObjectHandle9RectangleE:
  646|  14.1k|    DA(DA),
  647|  14.1k|    V(V),
  648|  14.1k|    opt(opt),
  649|  14.1k|    tf(tf),
  650|  14.1k|    bbox(bbox)
  651|  14.1k|{
  652|  14.1k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter11handleTokenERKN13QPDFTokenizer5TokenE:
  656|   699k|{
  657|   699k|    QPDFTokenizer::token_type_e ttype = token.getType();
  658|   699k|    std::string value = token.getValue();
  659|   699k|    bool do_replace = false;
  660|   699k|    switch (state) {
  ------------------
  |  Branch (660:13): [True: 699k, False: 0]
  ------------------
  661|  50.7k|    case st_top:
  ------------------
  |  Branch (661:5): [True: 50.7k, False: 648k]
  ------------------
  662|  50.7k|        writeToken(token);
  663|  50.7k|        if (token.isWord("BMC")) {
  ------------------
  |  Branch (663:13): [True: 12.0k, False: 38.7k]
  ------------------
  664|  12.0k|            state = st_bmc;
  665|  12.0k|        }
  666|  50.7k|        break;
  667|       |
  668|  24.1k|    case st_bmc:
  ------------------
  |  Branch (668:5): [True: 24.1k, False: 675k]
  ------------------
  669|  24.1k|        if ((ttype == QPDFTokenizer::tt_space) || (ttype == QPDFTokenizer::tt_comment)) {
  ------------------
  |  Branch (669:13): [True: 12.0k, False: 12.0k]
  |  Branch (669:51): [True: 21, False: 12.0k]
  ------------------
  670|  12.1k|            writeToken(token);
  671|  12.1k|        } else {
  672|  12.0k|            state = st_emc;
  673|  12.0k|        }
  674|       |        // fall through to emc
  675|       |
  676|   624k|    case st_emc:
  ------------------
  |  Branch (676:5): [True: 600k, False: 98.5k]
  ------------------
  677|   624k|        if (token.isWord("EMC")) {
  ------------------
  |  Branch (677:13): [True: 11.8k, False: 613k]
  ------------------
  678|  11.8k|            do_replace = true;
  679|  11.8k|            state = st_end;
  680|  11.8k|        }
  681|   624k|        break;
  682|       |
  683|  23.6k|    case st_end:
  ------------------
  |  Branch (683:5): [True: 23.6k, False: 675k]
  ------------------
  684|  23.6k|        writeToken(token);
  685|  23.6k|        break;
  686|   699k|    }
  687|   699k|    if (do_replace) {
  ------------------
  |  Branch (687:9): [True: 11.8k, False: 687k]
  ------------------
  688|  11.8k|        writeAppearance();
  689|  11.8k|    }
  690|   699k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter15writeAppearanceEv:
  704|  13.5k|{
  705|  13.5k|    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|  13.5k|    double tfh = 1.2 * tf;
  711|  13.5k|    int dx = 1;
  712|       |
  713|       |    // Write one or more lines, centered vertically, possibly with one row highlighted.
  714|       |
  715|  13.5k|    auto max_rows = static_cast<size_t>((bbox.ury - bbox.lly) / tfh);
  716|  13.5k|    bool highlight = false;
  717|  13.5k|    size_t highlight_idx = 0;
  718|       |
  719|  13.5k|    std::vector<std::string> lines;
  720|  13.5k|    if (opt.empty() || (max_rows < 2)) {
  ------------------
  |  Branch (720:9): [True: 12.4k, False: 1.17k]
  |  Branch (720:24): [True: 411, False: 760]
  ------------------
  721|  12.8k|        lines.push_back(V);
  722|  12.8k|    } else {
  723|       |        // Figure out what rows to write
  724|    760|        size_t nopt = opt.size();
  725|    760|        size_t found_idx = 0;
  726|    760|        bool found = false;
  727|  40.5k|        for (found_idx = 0; found_idx < nopt; ++found_idx) {
  ------------------
  |  Branch (727:29): [True: 40.1k, False: 479]
  ------------------
  728|  40.1k|            if (opt.at(found_idx) == V) {
  ------------------
  |  Branch (728:17): [True: 281, False: 39.8k]
  ------------------
  729|    281|                found = true;
  730|    281|                break;
  731|    281|            }
  732|  40.1k|        }
  733|    760|        if (found) {
  ------------------
  |  Branch (733:13): [True: 281, False: 479]
  ------------------
  734|       |            // Try to make the found item the second one, but adjust for under/overflow.
  735|    281|            int wanted_first = QIntC::to_int(found_idx) - 1;
  736|    281|            int wanted_last = QIntC::to_int(found_idx + max_rows) - 2;
  737|    281|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list found");
  738|    281|            if (wanted_first < 0) {
  ------------------
  |  Branch (738:17): [True: 43, False: 238]
  ------------------
  739|     43|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list first too low");
  740|     43|                wanted_last -= wanted_first;
  741|     43|                wanted_first = 0;
  742|     43|            }
  743|    281|            if (wanted_last >= QIntC::to_int(nopt)) {
  ------------------
  |  Branch (743:17): [True: 240, False: 41]
  ------------------
  744|    240|                QTC::TC("qpdf", "QPDFFormFieldObjectHelper list last too high");
  745|    240|                auto diff = wanted_last - QIntC::to_int(nopt) + 1;
  746|    240|                wanted_first = std::max(0, wanted_first - diff);
  747|    240|                wanted_last -= diff;
  748|    240|            }
  749|    281|            highlight = true;
  750|    281|            highlight_idx = found_idx - QIntC::to_size(wanted_first);
  751|  11.7k|            for (size_t i = QIntC::to_size(wanted_first); i <= QIntC::to_size(wanted_last); ++i) {
  ------------------
  |  Branch (751:59): [True: 11.4k, False: 281]
  ------------------
  752|  11.4k|                lines.push_back(opt.at(i));
  753|  11.4k|            }
  754|    479|        } else {
  755|    479|            QTC::TC("qpdf", "QPDFFormFieldObjectHelper list not found");
  756|       |            // include our value and the first n-1 rows
  757|    479|            highlight_idx = 0;
  758|    479|            highlight = true;
  759|    479|            lines.push_back(V);
  760|  35.8k|            for (size_t i = 0; ((i < nopt) && (i < (max_rows - 1))); ++i) {
  ------------------
  |  Branch (760:33): [True: 35.3k, False: 458]
  |  Branch (760:47): [True: 35.3k, False: 21]
  ------------------
  761|  35.3k|                lines.push_back(opt.at(i));
  762|  35.3k|            }
  763|    479|        }
  764|    760|    }
  765|       |
  766|       |    // Write the lines centered vertically, highlighting if needed
  767|  13.5k|    size_t nlines = lines.size();
  768|  13.5k|    double dy = bbox.ury - ((bbox.ury - bbox.lly - (static_cast<double>(nlines) * tfh)) / 2.0);
  769|  13.5k|    if (highlight) {
  ------------------
  |  Branch (769:9): [True: 740, False: 12.8k]
  ------------------
  770|    740|        write(
  771|    740|            "q\n0.85 0.85 0.85 rg\n" + QUtil::double_to_string(bbox.llx) + " " +
  772|    740|            QUtil::double_to_string(
  773|    740|                bbox.lly + dy - (tfh * (static_cast<double>(highlight_idx + 1)))) +
  774|    740|            " " + QUtil::double_to_string(bbox.urx - bbox.llx) + " " +
  775|    740|            QUtil::double_to_string(tfh) + " re f\nQ\n");
  776|    740|    }
  777|  13.5k|    dy -= tf;
  778|  13.5k|    write("q\nBT\n" + DA + "\n");
  779|  73.6k|    for (size_t i = 0; i < nlines; ++i) {
  ------------------
  |  Branch (779:24): [True: 60.1k, False: 13.5k]
  ------------------
  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|  60.1k|        if (i == 0) {
  ------------------
  |  Branch (783:13): [True: 13.5k, False: 46.5k]
  ------------------
  784|  13.5k|            write(
  785|  13.5k|                QUtil::double_to_string(bbox.llx + static_cast<double>(dx)) + " " +
  786|  13.5k|                QUtil::double_to_string(bbox.lly + static_cast<double>(dy)) + " Td\n");
  787|  46.5k|        } else {
  788|  46.5k|            write("0 " + QUtil::double_to_string(-tfh) + " Td\n");
  789|  46.5k|        }
  790|  60.1k|        write(QPDFObjectHandle::newString(lines.at(i)).unparse() + " Tj\n");
  791|  60.1k|    }
  792|  13.5k|    write("ET\nQ\nEMC");
  793|  13.5k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetter9handleEOFEv:
  694|  13.5k|{
  695|  13.5k|    if (!replaced) {
  ------------------
  |  Branch (695:9): [True: 1.73k, False: 11.8k]
  ------------------
  696|  1.73k|        QTC::TC("qpdf", "QPDFFormFieldObjectHelper replaced BMC at EOF");
  697|  1.73k|        write("/Tx BMC\n");
  698|  1.73k|        writeAppearance();
  699|  1.73k|    }
  700|  13.5k|}
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_111ValueSetterD2Ev:
  624|  14.1k|        ~ValueSetter() override = default;
QPDFFormFieldObjectHelper.cc:_ZN12_GLOBAL__N_18TfFinderD2Ev:
  801|  14.1k|        ~TfFinder() final = default;
_ZN25QPDFFormFieldObjectHelper7MembersC2ERK16QPDFObjectHandle:
   28|  69.6k|        FormNode(oh)
   29|  69.6k|    {
   30|  69.6k|    }

_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|  61.7k|{
   78|  61.7k|    static auto l = create();
   79|  61.7k|    return l;
   80|  61.7k|}
_ZN10QPDFLogger4warnEPKc:
  102|     23|{
  103|     23|    getWarn(false)->writeCStr(s);
  104|     23|}
_ZN10QPDFLogger7getWarnEb:
  114|  1.26M|{
  115|  1.26M|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 1.26M]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|  1.26M|    return getError(null_okay);
  119|  1.26M|}
_ZN10QPDFLogger8getErrorEb:
  135|  1.30M|{
  136|  1.30M|    return throwIfNull(m->p_error, null_okay);
  137|  1.30M|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|  1.30M|{
  255|  1.30M|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 1.30M]
  |  Branch (255:24): [True: 1.30M, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|  1.30M|    return p;
  259|  1.30M|}
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|  24.5k|    a(1.0),
    8|  24.5k|    b(0.0),
    9|  24.5k|    c(0.0),
   10|  24.5k|    d(1.0),
   11|  24.5k|    e(0.0),
   12|  24.5k|    f(0.0)
   13|  24.5k|{
   14|  24.5k|}
_ZN10QPDFMatrixC2Edddddd:
   17|  36.6k|    a(a),
   18|  36.6k|    b(b),
   19|  36.6k|    c(c),
   20|  36.6k|    d(d),
   21|  36.6k|    e(e),
   22|  36.6k|    f(f)
   23|  36.6k|{
   24|  36.6k|}
_ZN10QPDFMatrixC2ERKN16QPDFObjectHandle6MatrixE:
   27|    332|    a(m.a),
   28|    332|    b(m.b),
   29|    332|    c(m.c),
   30|    332|    d(m.d),
   31|    332|    e(m.e),
   32|    332|    f(m.f)
   33|    332|{
   34|    332|}
_ZNK10QPDFMatrix7unparseEv:
   47|  12.1k|{
   48|  12.1k|    return (
   49|  12.1k|        QUtil::double_to_string(fix_rounding(a), 5) + " " +
   50|  12.1k|        QUtil::double_to_string(fix_rounding(b), 5) + " " +
   51|  12.1k|        QUtil::double_to_string(fix_rounding(c), 5) + " " +
   52|  12.1k|        QUtil::double_to_string(fix_rounding(d), 5) + " " +
   53|  12.1k|        QUtil::double_to_string(fix_rounding(e), 5) + " " +
   54|  12.1k|        QUtil::double_to_string(fix_rounding(f), 5));
   55|  12.1k|}
_ZN10QPDFMatrix6concatERKS_:
   65|  36.8k|{
   66|  36.8k|    double ap = (this->a * other.a) + (this->c * other.b);
   67|  36.8k|    double bp = (this->b * other.a) + (this->d * other.b);
   68|  36.8k|    double cp = (this->a * other.c) + (this->c * other.d);
   69|  36.8k|    double dp = (this->b * other.c) + (this->d * other.d);
   70|  36.8k|    double ep = (this->a * other.e) + (this->c * other.f) + this->e;
   71|  36.8k|    double fp = (this->b * other.e) + (this->d * other.f) + this->f;
   72|  36.8k|    this->a = ap;
   73|  36.8k|    this->b = bp;
   74|  36.8k|    this->c = cp;
   75|  36.8k|    this->d = dp;
   76|  36.8k|    this->e = ep;
   77|  36.8k|    this->f = fp;
   78|  36.8k|}
_ZN10QPDFMatrix5scaleEdd:
   82|  12.1k|{
   83|  12.1k|    concat(QPDFMatrix(sx, 0, 0, sy, 0, 0));
   84|  12.1k|}
_ZN10QPDFMatrix9translateEdd:
   88|  24.2k|{
   89|  24.2k|    concat(QPDFMatrix(1, 0, 0, 1, tx, ty));
   90|  24.2k|}
_ZN10QPDFMatrix9rotatex90Ei:
   94|    352|{
   95|    352|    switch (angle) {
   96|     26|    case 90:
  ------------------
  |  Branch (96:5): [True: 26, False: 326]
  ------------------
   97|     26|        concat(QPDFMatrix(0, 1, -1, 0, 0, 0));
   98|     26|        break;
   99|     12|    case 180:
  ------------------
  |  Branch (99:5): [True: 12, False: 340]
  ------------------
  100|     12|        concat(QPDFMatrix(-1, 0, 0, -1, 0, 0));
  101|     12|        break;
  102|    238|    case 270:
  ------------------
  |  Branch (102:5): [True: 238, False: 114]
  ------------------
  103|    238|        concat(QPDFMatrix(0, -1, 1, 0, 0, 0));
  104|    238|        break;
  105|     76|    default:
  ------------------
  |  Branch (105:5): [True: 76, False: 276]
  ------------------
  106|       |        // ignore
  107|     76|        break;
  108|    352|    }
  109|    352|}
_ZNK10QPDFMatrix9transformEddRdS0_:
  113|  48.9k|{
  114|  48.9k|    xp = (this->a * x) + (this->c * y) + this->e;
  115|  48.9k|    yp = (this->b * x) + (this->d * y) + this->f;
  116|  48.9k|}
_ZNK10QPDFMatrix18transformRectangleEN16QPDFObjectHandle9RectangleE:
  120|  12.2k|{
  121|  12.2k|    std::vector<double> tx(4);
  122|  12.2k|    std::vector<double> ty(4);
  123|  12.2k|    transform(r.llx, r.lly, tx.at(0), ty.at(0));
  124|  12.2k|    transform(r.llx, r.ury, tx.at(1), ty.at(1));
  125|  12.2k|    transform(r.urx, r.lly, tx.at(2), ty.at(2));
  126|  12.2k|    transform(r.urx, r.ury, tx.at(3), ty.at(3));
  127|  12.2k|    return {
  128|  12.2k|        *std::min_element(tx.begin(), tx.end()),
  129|  12.2k|        *std::min_element(ty.begin(), ty.end()),
  130|  12.2k|        *std::max_element(tx.begin(), tx.end()),
  131|  12.2k|        *std::max_element(ty.begin(), ty.end())};
  132|  12.2k|}
QPDFMatrix.cc:_ZL12fix_roundingd:
   38|  72.8k|{
   39|  72.8k|    if ((d > -0.00001) && (d < 0.00001)) {
  ------------------
  |  Branch (39:9): [True: 71.8k, False: 967]
  |  Branch (39:27): [True: 24.3k, False: 47.5k]
  ------------------
   40|  24.3k|        d = 0.0;
   41|  24.3k|    }
   42|  72.8k|    return d;
   43|  72.8k|}

_ZN10QPDFObject14getDescriptionEv:
    5|   241k|{
    6|   241k|    qpdf_offset_t shift = (getTypeCode() == ::ot_dictionary) ? 2
  ------------------
  |  Branch (6:27): [True: 99.2k, False: 142k]
  ------------------
    7|   241k|        : (getTypeCode() == ::ot_array)                      ? 1
  ------------------
  |  Branch (7:11): [True: 98, False: 142k]
  ------------------
    8|   142k|                                                             : 0;
    9|       |
   10|   241k|    if (object_description) {
  ------------------
  |  Branch (10:9): [True: 165k, False: 76.7k]
  ------------------
   11|   165k|        switch (object_description->index()) {
  ------------------
  |  Branch (11:17): [True: 165k, False: 0]
  ------------------
   12|   158k|        case 0:
  ------------------
  |  Branch (12:9): [True: 158k, False: 6.60k]
  ------------------
   13|   158k|            {
   14|       |                // Simple template string
   15|   158k|                auto description = std::get<0>(*object_description);
   16|       |
   17|   158k|                if (auto pos = description.find("$OG"); pos != std::string::npos) {
  ------------------
  |  Branch (17:57): [True: 0, False: 158k]
  ------------------
   18|      0|                    description.replace(pos, 3, og.unparse(' '));
   19|      0|                }
   20|   158k|                if (auto pos = description.find("$PO"); pos != std::string::npos) {
  ------------------
  |  Branch (20:57): [True: 129k, False: 29.5k]
  ------------------
   21|   129k|                    description.replace(pos, 3, std::to_string(parsed_offset + shift));
   22|   129k|                }
   23|   158k|                return description;
   24|      0|            }
   25|      0|        case 1:
  ------------------
  |  Branch (25:9): [True: 0, False: 165k]
  ------------------
   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|  4.73k|        case 2:
  ------------------
  |  Branch (33:9): [True: 4.73k, False: 160k]
  ------------------
   34|  4.73k|            {
   35|       |                // Child object description
   36|  4.73k|                auto j_descr = std::get<2>(*object_description);
   37|  4.73k|                std::string result;
   38|  4.73k|                if (auto p = j_descr.parent.lock()) {
  ------------------
  |  Branch (38:26): [True: 4.73k, False: 0]
  ------------------
   39|  4.73k|                    result = p->getDescription();
   40|  4.73k|                }
   41|  4.73k|                result += j_descr.static_descr;
   42|  4.73k|                if (auto pos = result.find("$VD"); pos != std::string::npos) {
  ------------------
  |  Branch (42:52): [True: 4.73k, False: 0]
  ------------------
   43|  4.73k|                    result.replace(pos, 3, j_descr.var_descr);
   44|  4.73k|                }
   45|  4.73k|                return result;
   46|      0|            }
   47|  1.87k|        case 3:
  ------------------
  |  Branch (47:9): [True: 1.87k, False: 163k]
  ------------------
   48|  1.87k|            auto [stream_id, obj_id] = std::get<3>(*object_description);
   49|  1.87k|            std::string result = qpdf ? qpdf->getFilename() : "";
  ------------------
  |  Branch (49:34): [True: 1.87k, False: 0]
  ------------------
   50|  1.87k|            result += " object stream " + std::to_string(stream_id) + ", object " +
   51|  1.87k|                std::to_string(obj_id) + " 0 at offset " + std::to_string(parsed_offset + shift);
   52|  1.87k|            return result;
   53|   165k|        }
   54|       |
   55|   165k|    } else if (og.isIndirect()) {
  ------------------
  |  Branch (55:16): [True: 76.5k, False: 246]
  ------------------
   56|  76.5k|        return "object " + og.unparse(' ');
   57|  76.5k|    }
   58|    246|    return {};
   59|   241k|}

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|   444k|{
   35|   444k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 444k, False: 465]
  ------------------
   36|   444k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  31.4k|    supports_retry(supports_retry)
   47|  31.4k|{
   48|  31.4k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  31.4k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  31.4k|}
_ZN16QPDFObjectHandle18StreamDataProvider13supportsRetryEv:
   85|  4.64k|{
   86|  4.64k|    return supports_retry;
   87|  4.64k|}
_ZN16QPDFObjectHandle11TokenFilter9handleEOFEv:
  119|  14.1k|{
  120|  14.1k|}
_ZN16QPDFObjectHandle11TokenFilter11setPipelineEP8Pipeline:
  124|  56.0k|{
  125|  56.0k|    pipeline = p;
  126|  56.0k|}
_ZN16QPDFObjectHandle11TokenFilter5writeEPKcm:
  130|   236k|{
  131|   236k|    if (!pipeline) {
  ------------------
  |  Branch (131:9): [True: 0, False: 236k]
  ------------------
  132|      0|        return;
  133|      0|    }
  134|   236k|    if (len) {
  ------------------
  |  Branch (134:9): [True: 222k, False: 13.3k]
  ------------------
  135|   222k|        pipeline->write(data, len);
  136|   222k|    }
  137|   236k|}
_ZN16QPDFObjectHandle11TokenFilter5writeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  141|   149k|{
  142|   149k|    write(str.c_str(), str.length());
  143|   149k|}
_ZN16QPDFObjectHandle11TokenFilter10writeTokenERKN13QPDFTokenizer5TokenE:
  147|  86.4k|{
  148|  86.4k|    std::string const& value = token.getRawValue();
  149|  86.4k|    write(value.c_str(), value.length());
  150|  86.4k|}
_ZN4qpdf4Name19analyzeJSONEncodingERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  180|   294k|{
  181|   294k|    int tail = 0;       // Number of continuation characters expected.
  182|   294k|    bool tail2 = false; // Potential overlong 3 octet utf-8.
  183|   294k|    bool tail3 = false; // potential overlong 4 octet
  184|   294k|    bool needs_escaping = false;
  185|  16.8M|    for (auto const& it: name) {
  ------------------
  |  Branch (185:24): [True: 16.8M, False: 272k]
  ------------------
  186|  16.8M|        auto c = static_cast<unsigned char>(it);
  187|  16.8M|        if (tail) {
  ------------------
  |  Branch (187:13): [True: 13.4k, False: 16.8M]
  ------------------
  188|  13.4k|            if ((c & 0xc0) != 0x80) {
  ------------------
  |  Branch (188:17): [True: 5.05k, False: 8.37k]
  ------------------
  189|  5.05k|                return {false, false};
  190|  5.05k|            }
  191|  8.37k|            if (tail2) {
  ------------------
  |  Branch (191:17): [True: 425, False: 7.95k]
  ------------------
  192|    425|                if ((c & 0xe0) == 0x80) {
  ------------------
  |  Branch (192:21): [True: 73, False: 352]
  ------------------
  193|     73|                    return {false, false};
  194|     73|                }
  195|    352|                tail2 = false;
  196|  7.95k|            } else if (tail3) {
  ------------------
  |  Branch (196:24): [True: 598, False: 7.35k]
  ------------------
  197|    598|                if ((c & 0xf0) == 0x80) {
  ------------------
  |  Branch (197:21): [True: 221, False: 377]
  ------------------
  198|    221|                    return {false, false};
  199|    221|                }
  200|    377|                tail3 = false;
  201|    377|            }
  202|  8.08k|            tail--;
  203|  16.8M|        } else if (c < 0x80) {
  ------------------
  |  Branch (203:20): [True: 16.7M, False: 25.7k]
  ------------------
  204|  16.7M|            if (!needs_escaping) {
  ------------------
  |  Branch (204:17): [True: 2.14M, False: 14.6M]
  ------------------
  205|  2.14M|                needs_escaping = !((c > 34 && c != '\\') || c == ' ' || c == 33);
  ------------------
  |  Branch (205:37): [True: 2.13M, False: 8.05k]
  |  Branch (205:47): [True: 2.12M, False: 6.10k]
  |  Branch (205:61): [True: 232, False: 13.9k]
  |  Branch (205:73): [True: 1.08k, False: 12.8k]
  ------------------
  206|  2.14M|            }
  207|  16.7M|        } else if ((c & 0xe0) == 0xc0) {
  ------------------
  |  Branch (207:20): [True: 3.23k, False: 22.5k]
  ------------------
  208|  3.23k|            if ((c & 0xfe) == 0xc0) {
  ------------------
  |  Branch (208:17): [True: 522, False: 2.71k]
  ------------------
  209|    522|                return {false, false};
  210|    522|            }
  211|  2.71k|            tail = 1;
  212|  22.5k|        } else if ((c & 0xf0) == 0xe0) {
  ------------------
  |  Branch (212:20): [True: 3.20k, False: 19.3k]
  ------------------
  213|  3.20k|            tail2 = (c == 0xe0);
  214|  3.20k|            tail = 2;
  215|  19.3k|        } else if ((c & 0xf8) == 0xf0) {
  ------------------
  |  Branch (215:20): [True: 2.97k, False: 16.3k]
  ------------------
  216|  2.97k|            tail3 = (c == 0xf0);
  217|  2.97k|            tail = 3;
  218|  16.3k|        } else {
  219|  16.3k|            return {false, false};
  220|  16.3k|        }
  221|  16.8M|    }
  222|   272k|    return {tail == 0, !needs_escaping};
  223|   294k|}
_ZN4qpdf4Name9normalizeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  227|  67.2k|{
  228|  67.2k|    if (name.empty()) {
  ------------------
  |  Branch (228:9): [True: 0, False: 67.2k]
  ------------------
  229|      0|        return name;
  230|      0|    }
  231|  67.2k|    std::string result;
  232|  67.2k|    result += name.at(0);
  233|  43.2M|    for (size_t i = 1; i < name.length(); ++i) {
  ------------------
  |  Branch (233:24): [True: 43.1M, False: 67.2k]
  ------------------
  234|  43.1M|        char ch = name.at(i);
  235|       |        // Don't use locale/ctype here; follow PDF spec guidelines.
  236|  43.1M|        if (ch == '\0') {
  ------------------
  |  Branch (236:13): [True: 7.19k, False: 43.1M]
  ------------------
  237|       |            // QPDFTokenizer embeds a null character to encode an invalid #.
  238|  7.19k|            result += "#";
  239|  43.1M|        } else if (
  240|  43.1M|            ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (240:13): [True: 40.4M, False: 2.73M]
  |  Branch (240:24): [True: 850, False: 2.73M]
  |  Branch (240:37): [True: 342, False: 2.73M]
  |  Branch (240:50): [True: 380, False: 2.73M]
  |  Branch (240:63): [True: 426, False: 2.73M]
  |  Branch (240:76): [True: 214, False: 2.73M]
  |  Branch (240:89): [True: 231, False: 2.72M]
  ------------------
  241|  42.4M|            ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch > 126) {
  ------------------
  |  Branch (241:13): [True: 672, False: 2.72M]
  |  Branch (241:26): [True: 238, False: 2.72M]
  |  Branch (241:39): [True: 198, False: 2.72M]
  |  Branch (241:52): [True: 76, False: 2.72M]
  |  Branch (241:65): [True: 351, False: 2.72M]
  |  Branch (241:78): [True: 2.00M, False: 725k]
  ------------------
  242|  42.4M|            result += util::hex_encode_char(ch);
  243|  42.4M|        } else {
  244|   725k|            result += ch;
  245|   725k|        }
  246|  43.1M|    }
  247|  67.2k|    return result;
  248|  67.2k|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|   880k|{
  253|   880k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 880k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 880k]
  ------------------
  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: 880k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|  84.3k|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 84.3k, False: 796k]
  ------------------
  260|  84.3k|        return QPDFObject::create<QPDF_Null>();
  261|    914|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 914, False: 879k]
  ------------------
  262|    914|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|   428k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 428k, False: 452k]
  ------------------
  264|   428k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|  57.5k|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 57.5k, False: 823k]
  ------------------
  266|  57.5k|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  51.9k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 51.9k, False: 828k]
  ------------------
  268|  51.9k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|   176k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 176k, False: 703k]
  ------------------
  270|   176k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|  42.4k|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 42.4k, False: 838k]
  ------------------
  272|  42.4k|        {
  273|  42.4k|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|  42.4k|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 42.4k]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|  42.4k|            } else {
  277|  42.4k|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 461, False: 41.9k]
  ------------------
  278|  42.4k|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 461, False: 41.9k]
  ------------------
  279|    461|                    QPDF_Array result;
  280|    461|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|    461|                    result.sp->size = a.sp->size;
  282|  7.23k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 7.23k, False: 461]
  ------------------
  283|  7.23k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 1.07k, False: 6.15k]
  ------------------
  284|  7.23k|                    }
  285|    461|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|  41.9k|                } else {
  287|  41.9k|                    std::vector<QPDFObjectHandle> result;
  288|  41.9k|                    result.reserve(a.elements.size());
  289|   718k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 718k, False: 41.9k]
  ------------------
  290|   718k|                        result.emplace_back(
  291|   718k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 718k, False: 0]
  |  Branch (291:40): [True: 21.8k, False: 696k]
  ------------------
  292|   718k|                    }
  293|  41.9k|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|  41.9k|                }
  295|  42.4k|            }
  296|  42.4k|        }
  297|  38.2k|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 38.2k, False: 842k]
  ------------------
  298|  38.2k|        {
  299|  38.2k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|  38.2k|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 0, False: 38.2k]
  ------------------
  301|      0|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|  38.2k|            } else {
  303|  38.2k|                std::map<std::string, QPDFObjectHandle> new_items;
  304|   290k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 290k, False: 38.2k]
  ------------------
  305|   290k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 157k, False: 132k]
  ------------------
  306|   290k|                }
  307|  38.2k|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|  38.2k|            }
  309|  38.2k|        }
  310|     17|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 17, False: 880k]
  ------------------
  311|     17|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|     17|        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: 880k]
  ------------------
  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: 880k]
  ------------------
  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: 880k]
  ------------------
  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: 880k]
  ------------------
  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: 880k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|   880k|    }
  327|      0|    return {}; // unreachable
  328|   880k|}
_ZNK4qpdf10BaseHandle7unparseEv:
  474|   348k|{
  475|   348k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (475:13): [True: 348k, False: 0]
  ------------------
  476|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (476:5): [True: 0, False: 348k]
  ------------------
  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: 348k]
  ------------------
  480|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  481|      0|        return ""; // does not return
  482|  59.9k|    case ::ot_null:
  ------------------
  |  Branch (482:5): [True: 59.9k, False: 288k]
  ------------------
  483|  59.9k|        return "null";
  484|    381|    case ::ot_boolean:
  ------------------
  |  Branch (484:5): [True: 381, False: 347k]
  ------------------
  485|    381|        return std::get<QPDF_Bool>(obj->value).val ? "true" : "false";
  ------------------
  |  Branch (485:16): [True: 34, False: 347]
  ------------------
  486|   108k|    case ::ot_integer:
  ------------------
  |  Branch (486:5): [True: 108k, False: 239k]
  ------------------
  487|   108k|        return std::to_string(std::get<QPDF_Integer>(obj->value).val);
  488|  3.25k|    case ::ot_real:
  ------------------
  |  Branch (488:5): [True: 3.25k, False: 344k]
  ------------------
  489|  3.25k|        return std::get<QPDF_Real>(obj->value).val;
  490|   131k|    case ::ot_string:
  ------------------
  |  Branch (490:5): [True: 131k, False: 216k]
  ------------------
  491|   131k|        return std::get<QPDF_String>(obj->value).unparse(false);
  492|  44.4k|    case ::ot_name:
  ------------------
  |  Branch (492:5): [True: 44.4k, False: 303k]
  ------------------
  493|  44.4k|        return Name::normalize(std::get<QPDF_Name>(obj->value).name);
  494|      0|    case ::ot_array:
  ------------------
  |  Branch (494:5): [True: 0, False: 348k]
  ------------------
  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: 348k]
  ------------------
  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: 348k]
  ------------------
  531|      0|        return obj->og.unparse(' ') + " R";
  532|      0|    case ::ot_operator:
  ------------------
  |  Branch (532:5): [True: 0, False: 348k]
  ------------------
  533|      0|        return std::get<QPDF_Operator>(obj->value).val;
  534|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (534:5): [True: 0, False: 348k]
  ------------------
  535|      0|        return std::get<QPDF_InlineImage>(obj->value).val;
  536|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (536:5): [True: 0, False: 348k]
  ------------------
  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: 348k]
  ------------------
  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: 348k]
  ------------------
  543|      0|        return obj->og.unparse(' ') + " R";
  544|   348k|    }
  545|      0|    return {}; // unreachable
  546|   348k|}
_ZNK4qpdf10BaseHandle10write_jsonEiRN4JSON6WriterE:
  550|   489k|{
  551|   489k|    switch (resolved_type_code()) {
  552|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (552:5): [True: 0, False: 489k]
  ------------------
  553|      0|        throw std::logic_error(
  554|      0|            "QPDFObjectHandle: attempting to get JSON from a uninitialized object");
  555|      0|        break; // unreachable
  556|  18.6k|    case ::ot_null:
  ------------------
  |  Branch (556:5): [True: 18.6k, False: 470k]
  ------------------
  557|  18.6k|    case ::ot_operator:
  ------------------
  |  Branch (557:5): [True: 0, False: 489k]
  ------------------
  558|  18.6k|    case ::ot_inlineimage:
  ------------------
  |  Branch (558:5): [True: 0, False: 489k]
  ------------------
  559|  18.6k|        p << "null";
  560|  18.6k|        break;
  561|  4.10k|    case ::ot_boolean:
  ------------------
  |  Branch (561:5): [True: 4.10k, False: 485k]
  ------------------
  562|  4.10k|        p << std::get<QPDF_Bool>(obj->value).val;
  563|  4.10k|        break;
  564|   163k|    case ::ot_integer:
  ------------------
  |  Branch (564:5): [True: 163k, False: 326k]
  ------------------
  565|   163k|        p << std::to_string(std::get<QPDF_Integer>(obj->value).val);
  566|   163k|        break;
  567|  52.9k|    case ::ot_real:
  ------------------
  |  Branch (567:5): [True: 52.9k, False: 436k]
  ------------------
  568|  52.9k|        {
  569|  52.9k|            auto const& val = std::get<QPDF_Real>(obj->value).val;
  570|  52.9k|            if (val.empty()) {
  ------------------
  |  Branch (570:17): [True: 0, False: 52.9k]
  ------------------
  571|       |                // Can't really happen...
  572|      0|                p << "0";
  573|  52.9k|            } else if (val.at(0) == '.') {
  ------------------
  |  Branch (573:24): [True: 684, False: 52.3k]
  ------------------
  574|    684|                p << "0" << val;
  575|  52.3k|            } else if (val.length() >= 2 && val.at(0) == '-' && val.at(1) == '.') {
  ------------------
  |  Branch (575:24): [True: 34.0k, False: 18.2k]
  |  Branch (575:45): [True: 2.61k, False: 31.4k]
  |  Branch (575:65): [True: 2.14k, False: 469]
  ------------------
  576|  2.14k|                p << "-0." << val.substr(2);
  577|  50.1k|            } else {
  578|  50.1k|                p << val;
  579|  50.1k|            }
  580|  52.9k|            if (val.back() == '.') {
  ------------------
  |  Branch (580:17): [True: 645, False: 52.3k]
  ------------------
  581|    645|                p << "0";
  582|    645|            }
  583|  52.9k|        }
  584|  52.9k|        break;
  585|  25.4k|    case ::ot_string:
  ------------------
  |  Branch (585:5): [True: 25.4k, False: 464k]
  ------------------
  586|  25.4k|        std::get<QPDF_String>(obj->value).writeJSON(json_version, p);
  587|  25.4k|        break;
  588|   111k|    case ::ot_name:
  ------------------
  |  Branch (588:5): [True: 111k, False: 377k]
  ------------------
  589|   111k|        {
  590|   111k|            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|   111k|            if (json_version == 1) {
  ------------------
  |  Branch (593:17): [True: 0, False: 111k]
  ------------------
  594|      0|                p << "\"" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  595|   111k|            } else {
  596|   111k|                if (auto res = Name::analyzeJSONEncoding(n.name); res.first) {
  ------------------
  |  Branch (596:67): [True: 101k, False: 9.99k]
  ------------------
  597|   101k|                    if (res.second) {
  ------------------
  |  Branch (597:25): [True: 98.0k, False: 3.59k]
  ------------------
  598|  98.0k|                        p << "\"" << n.name << "\"";
  599|  98.0k|                    } else {
  600|  3.59k|                        p << "\"" << JSON::Writer::encode_string(n.name) << "\"";
  601|  3.59k|                    }
  602|   101k|                } else {
  603|  9.99k|                    p << "\"n:" << JSON::Writer::encode_string(Name::normalize(n.name)) << "\"";
  604|  9.99k|                }
  605|   111k|            }
  606|   111k|        }
  607|   111k|        break;
  608|  56.9k|    case ::ot_array:
  ------------------
  |  Branch (608:5): [True: 56.9k, False: 432k]
  ------------------
  609|  56.9k|        {
  610|  56.9k|            auto const& a = std::get<QPDF_Array>(obj->value);
  611|  56.9k|            p.writeStart('[');
  612|  56.9k|            if (a.sp) {
  ------------------
  |  Branch (612:17): [True: 491, False: 56.4k]
  ------------------
  613|    491|                size_t next = 0;
  614|  8.57k|                for (auto& [key, value]: a.sp->elements) {
  ------------------
  |  Branch (614:40): [True: 8.57k, False: 491]
  ------------------
  615|  50.6k|                    for (size_t j = next; j < key; ++j) {
  ------------------
  |  Branch (615:43): [True: 42.1k, False: 8.57k]
  ------------------
  616|  42.1k|                        p.writeNext() << "null";
  617|  42.1k|                    }
  618|  8.57k|                    p.writeNext();
  619|  8.57k|                    auto item_og = value.id_gen();
  620|  8.57k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (620:25): [True: 531, False: 8.04k]
  ------------------
  621|    531|                        p << "\"" << item_og.unparse(' ') << " R\"";
  622|  8.04k|                    } else {
  623|  8.04k|                        value.write_json(json_version, p);
  624|  8.04k|                    }
  625|  8.57k|                    next = key + 1;
  626|  8.57k|                }
  627|  16.2k|                for (size_t j = next; j < a.sp->size; ++j) {
  ------------------
  |  Branch (627:39): [True: 15.7k, False: 491]
  ------------------
  628|  15.7k|                    p.writeNext() << "null";
  629|  15.7k|                }
  630|  56.4k|            } else {
  631|   337k|                for (auto const& item: a.elements) {
  ------------------
  |  Branch (631:38): [True: 337k, False: 56.4k]
  ------------------
  632|   337k|                    p.writeNext();
  633|   337k|                    auto item_og = item.id_gen();
  634|   337k|                    if (item_og.isIndirect()) {
  ------------------
  |  Branch (634:25): [True: 9.77k, False: 328k]
  ------------------
  635|  9.77k|                        p << "\"" << item_og.unparse(' ') << " R\"";
  636|   328k|                    } else {
  637|   328k|                        item.write_json(json_version, p);
  638|   328k|                    }
  639|   337k|                }
  640|  56.4k|            }
  641|  56.9k|            p.writeEnd(']');
  642|  56.9k|        }
  643|  56.9k|        break;
  644|  56.6k|    case ::ot_dictionary:
  ------------------
  |  Branch (644:5): [True: 56.6k, False: 432k]
  ------------------
  645|  56.6k|        {
  646|  56.6k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  647|  56.6k|            p.writeStart('{');
  648|   220k|            for (auto& iter: d.items) {
  ------------------
  |  Branch (648:28): [True: 220k, False: 56.6k]
  ------------------
  649|   220k|                if (!iter.second.null()) {
  ------------------
  |  Branch (649:21): [True: 182k, False: 37.5k]
  ------------------
  650|   182k|                    p.writeNext();
  651|   182k|                    if (json_version == 1) {
  ------------------
  |  Branch (651:25): [True: 0, False: 182k]
  ------------------
  652|      0|                        p << "\"" << JSON::Writer::encode_string(Name::normalize(iter.first))
  653|      0|                          << "\": ";
  654|   182k|                    } else if (auto res = Name::analyzeJSONEncoding(iter.first); res.first) {
  ------------------
  |  Branch (654:82): [True: 170k, False: 12.7k]
  ------------------
  655|   170k|                        if (res.second) {
  ------------------
  |  Branch (655:29): [True: 166k, False: 3.97k]
  ------------------
  656|   166k|                            p << "\"" << iter.first << "\": ";
  657|   166k|                        } else {
  658|  3.97k|                            p << "\"" << JSON::Writer::encode_string(iter.first) << "\": ";
  659|  3.97k|                        }
  660|   170k|                    } else {
  661|  12.7k|                        p << "\"n:" << JSON::Writer::encode_string(Name::normalize(iter.first))
  662|  12.7k|                          << "\": ";
  663|  12.7k|                    }
  664|   182k|                    iter.second.writeJSON(json_version, p);
  665|   182k|                }
  666|   220k|            }
  667|  56.6k|            p.writeEnd('}');
  668|  56.6k|        }
  669|  56.6k|        break;
  670|      0|    case ::ot_stream:
  ------------------
  |  Branch (670:5): [True: 0, False: 489k]
  ------------------
  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: 489k]
  ------------------
  674|      0|        p << "\"" << obj->og.unparse(' ') << " R\"";
  675|      0|        break;
  676|      0|    default:
  ------------------
  |  Branch (676:5): [True: 0, False: 489k]
  ------------------
  677|      0|        throw std::logic_error("attempted to write an unsuitable object as JSON");
  678|   489k|    }
  679|   489k|}
_ZN4qpdf10BaseHandle10disconnectEb:
  683|  4.09M|{
  684|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  685|  4.09M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (685:9): [True: 3.58M, False: 518k]
  |  Branch (685:24): [True: 343k, False: 3.23M]
  ------------------
  686|   343k|        return;
  687|   343k|    }
  688|       |
  689|  3.75M|    switch (raw_type_code()) {
  690|   210k|    case ::ot_array:
  ------------------
  |  Branch (690:5): [True: 210k, False: 3.54M]
  ------------------
  691|   210k|        {
  692|   210k|            auto& a = std::get<QPDF_Array>(obj->value);
  693|   210k|            if (a.sp) {
  ------------------
  |  Branch (693:17): [True: 758, False: 210k]
  ------------------
  694|  33.9k|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (694:32): [True: 33.9k, False: 758]
  ------------------
  695|  33.9k|                    item.second.disconnect();
  696|  33.9k|                }
  697|   210k|            } else {
  698|  2.17M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (698:30): [True: 2.17M, False: 210k]
  ------------------
  699|  2.17M|                    oh.disconnect();
  700|  2.17M|                }
  701|   210k|            }
  702|   210k|        }
  703|   210k|        break;
  704|   311k|    case ::ot_dictionary:
  ------------------
  |  Branch (704:5): [True: 311k, False: 3.44M]
  ------------------
  705|  1.32M|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (705:24): [True: 1.32M, False: 311k]
  ------------------
  706|  1.32M|            iter.second.disconnect();
  707|  1.32M|        }
  708|   311k|        break;
  709|  47.1k|    case ::ot_stream:
  ------------------
  |  Branch (709:5): [True: 47.1k, False: 3.70M]
  ------------------
  710|  47.1k|        {
  711|  47.1k|            auto& s = std::get<QPDF_Stream>(obj->value);
  712|  47.1k|            s.m->stream_provider = nullptr;
  713|  47.1k|            s.m->stream_dict.disconnect();
  714|  47.1k|        }
  715|  47.1k|        break;
  716|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (716:5): [True: 0, False: 3.75M]
  ------------------
  717|      0|        return;
  718|  3.18M|    default:
  ------------------
  |  Branch (718:5): [True: 3.18M, False: 569k]
  ------------------
  719|  3.18M|        break;
  720|  3.75M|    }
  721|  3.75M|    obj->qpdf = nullptr;
  722|  3.75M|    obj->og = QPDFObjGen();
  723|  3.75M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  727|    132|{
  728|    132|    return obj == rhs.obj;
  729|    132|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  739|  15.4k|{
  740|  15.4k|    static constexpr std::array<char const*, 16> tn{
  741|  15.4k|        "uninitialized",
  742|  15.4k|        "reserved",
  743|  15.4k|        "null",
  744|  15.4k|        "boolean",
  745|  15.4k|        "integer",
  746|  15.4k|        "real",
  747|  15.4k|        "string",
  748|  15.4k|        "name",
  749|  15.4k|        "array",
  750|  15.4k|        "dictionary",
  751|  15.4k|        "stream",
  752|  15.4k|        "operator",
  753|  15.4k|        "inline-image",
  754|  15.4k|        "unresolved",
  755|  15.4k|        "destroyed",
  756|  15.4k|        "reference"};
  757|  15.4k|    return tn[type_code()];
  758|  15.4k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  774|   317k|{
  775|   317k|    return type_code() == ::ot_boolean;
  776|   317k|}
_ZNK16QPDFObjectHandle6isNullEv:
  788|   162k|{
  789|   162k|    return type_code() == ::ot_null;
  790|   162k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  794|  1.01M|{
  795|  1.01M|    return type_code() == ::ot_integer;
  796|  1.01M|}
_ZNK16QPDFObjectHandle6isRealEv:
  800|   579k|{
  801|   579k|    return type_code() == ::ot_real;
  802|   579k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  806|   427k|{
  807|   427k|    return (isInteger() || isReal());
  ------------------
  |  Branch (807:13): [True: 91.3k, False: 335k]
  |  Branch (807:28): [True: 332k, False: 3.13k]
  ------------------
  808|   427k|}
_ZNK16QPDFObjectHandle15getNumericValueEv:
  812|   181k|{
  813|   181k|    if (isInteger()) {
  ------------------
  |  Branch (813:9): [True: 17.1k, False: 163k]
  ------------------
  814|  17.1k|        return static_cast<double>(getIntValue());
  815|   163k|    } else if (isReal()) {
  ------------------
  |  Branch (815:16): [True: 163k, False: 0]
  ------------------
  816|   163k|        return atof(getRealValue().c_str());
  817|   163k|    } else {
  818|      0|        typeWarning("number", "returning 0");
  819|      0|        QTC::TC("qpdf", "QPDFObjectHandle numeric non-numeric");
  820|      0|        return 0;
  821|      0|    }
  822|   181k|}
_ZNK16QPDFObjectHandle16getValueAsNumberERd:
  826|   181k|{
  827|   181k|    if (!isNumber()) {
  ------------------
  |  Branch (827:9): [True: 408, False: 181k]
  ------------------
  828|    408|        return false;
  829|    408|    }
  830|   181k|    value = getNumericValue();
  831|   181k|    return true;
  832|   181k|}
_ZNK16QPDFObjectHandle6isNameEv:
  836|   220k|{
  837|   220k|    return type_code() == ::ot_name;
  838|   220k|}
_ZNK16QPDFObjectHandle8isStringEv:
  842|   149k|{
  843|   149k|    return type_code() == ::ot_string;
  844|   149k|}
_ZNK16QPDFObjectHandle10isOperatorEv:
  848|  3.77M|{
  849|  3.77M|    return type_code() == ::ot_operator;
  850|  3.77M|}
_ZNK16QPDFObjectHandle7isArrayEv:
  860|  76.0k|{
  861|  76.0k|    return type_code() == ::ot_array;
  862|  76.0k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  866|  2.19M|{
  867|  2.19M|    return type_code() == ::ot_dictionary;
  868|  2.19M|}
_ZNK16QPDFObjectHandle8isStreamEv:
  872|   335k|{
  873|   335k|    return type_code() == ::ot_stream;
  874|   335k|}
_ZNK16QPDFObjectHandle8isScalarEv:
  884|   296k|{
  885|   296k|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (885:12): [True: 382, False: 296k]
  |  Branch (885:24): [True: 109k, False: 187k]
  |  Branch (885:39): [True: 44.6k, False: 142k]
  |  Branch (885:51): [True: 63.0k, False: 79.5k]
  |  Branch (885:63): [True: 3.25k, False: 76.3k]
  |  Branch (885:75): [True: 71.8k, False: 4.50k]
  ------------------
  886|   296k|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  890|  4.51k|{
  891|  4.51k|    return Name(*this) == name;
  892|  4.51k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  896|  1.09M|{
  897|  1.09M|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (897:12): [True: 311k, False: 786k]
  |  Branch (897:31): [True: 131k, False: 180k]
  |  Branch (897:47): [True: 32.1k, False: 147k]
  ------------------
  898|   163k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (898:10): [True: 57.3k, False: 106k]
  |  Branch (898:29): [True: 94.8k, False: 11.5k]
  ------------------
  899|  1.09M|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  903|   218k|{
  904|   218k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (904:14): [True: 38.2k, False: 180k]
  ------------------
  905|  38.2k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (905:16): [True: 38.2k, False: 0]
  |  Branch (905:27): [True: 12.2k, False: 25.9k]
  |  Branch (905:43): [True: 13.9k, False: 12.0k]
  ------------------
  906|  26.2k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (906:14): [True: 13.9k, False: 12.2k]
  |  Branch (906:33): [True: 525, False: 11.7k]
  ------------------
  907|  38.2k|    }
  908|   180k|    return false;
  909|   218k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  915|  5.65k|{
  916|  5.65k|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (916:14): [True: 5.65k, False: 0]
  ------------------
  917|  5.65k|        return boolean->val;
  918|  5.65k|    } else {
  919|      0|        typeWarning("boolean", "returning false");
  920|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  921|      0|        return false;
  922|      0|    }
  923|  5.65k|}
_ZN4qpdf7IntegerC2Ex:
  938|  39.2k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  939|  39.2k|{
  940|  39.2k|}
_ZN16QPDFObjectHandle10newIntegerEx:
  944|  4.29k|{
  945|  4.29k|    return {QPDFObject::create<QPDF_Integer>(value)};
  946|  4.29k|}
_ZNK4qpdf7Integer5valueEv:
  950|   176k|{
  951|   176k|    auto* i = as<QPDF_Integer>();
  952|   176k|    if (!i) {
  ------------------
  |  Branch (952:9): [True: 1.11k, False: 175k]
  ------------------
  953|  1.11k|        throw invalid_error("Integer");
  954|  1.11k|    }
  955|   175k|    return i->val;
  956|   176k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  960|  51.9k|{
  961|  51.9k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (961:20): [True: 51.9k, False: 0]
  ------------------
  962|  51.9k|        return integer;
  963|  51.9k|    } else {
  964|      0|        typeWarning("integer", "returning 0");
  965|      0|        return 0;
  966|      0|    }
  967|  51.9k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  971|  7.43k|{
  972|  7.43k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (972:20): [True: 7.35k, False: 76]
  ------------------
  973|  7.35k|        value = integer;
  974|  7.35k|        return true;
  975|  7.35k|    }
  976|     76|    return false;
  977|  7.43k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  981|  49.5k|{
  982|  49.5k|    try {
  983|  49.5k|        return Integer(*this).value<int>();
  984|  49.5k|    } catch (std::invalid_argument&) {
  985|     36|        typeWarning("integer", "returning 0");
  986|     36|        return 0;
  987|     36|    }
  988|  49.5k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
  992|  1.41k|{
  993|  1.41k|    if (!isInteger()) {
  ------------------
  |  Branch (993:9): [True: 47, False: 1.36k]
  ------------------
  994|     47|        return false;
  995|     47|    }
  996|  1.36k|    value = getIntValueAsInt();
  997|  1.36k|    return true;
  998|  1.41k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1002|  26.0k|{
 1003|  26.0k|    try {
 1004|  26.0k|        return Integer(*this).value<unsigned long long>();
 1005|  26.0k|    } catch (std::invalid_argument&) {
 1006|    690|        typeWarning("integer", "returning 0");
 1007|    690|        return 0;
 1008|    690|    }
 1009|  26.0k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1023|  7.57k|{
 1024|  7.57k|    try {
 1025|  7.57k|        return Integer(*this).value<unsigned int>();
 1026|  7.57k|    } catch (std::invalid_argument&) {
 1027|    391|        typeWarning("integer", "returning 0");
 1028|    391|        return 0;
 1029|    391|    }
 1030|  7.57k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1034|  1.57k|{
 1035|  1.57k|    if (!isInteger()) {
  ------------------
  |  Branch (1035:9): [True: 157, False: 1.41k]
  ------------------
 1036|    157|        return false;
 1037|    157|    }
 1038|  1.41k|    value = getUIntValueAsUInt();
 1039|  1.41k|    return true;
 1040|  1.57k|}
_ZNK16QPDFObjectHandle12getRealValueEv:
 1046|   163k|{
 1047|   163k|    if (auto* real = as<QPDF_Real>()) {
  ------------------
  |  Branch (1047:15): [True: 163k, False: 0]
  ------------------
 1048|   163k|        return real->val;
 1049|   163k|    }
 1050|      0|    typeWarning("real", "returning 0.0");
 1051|      0|    return "0.0";
 1052|   163k|}
_ZN16QPDFObjectHandle7newNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1068|  12.1k|{
 1069|  12.1k|    return {QPDFObject::create<QPDF_Name>(name)};
 1070|  12.1k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1078|  57.3k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1079|  57.3k|{
 1080|  57.3k|}
_ZNK4qpdf4Name5valueEv:
 1084|   347k|{
 1085|   347k|    auto* n = as<QPDF_Name>();
 1086|   347k|    if (!n) {
  ------------------
  |  Branch (1086:9): [True: 0, False: 347k]
  ------------------
 1087|      0|        throw invalid_error("Name");
 1088|      0|    }
 1089|   347k|    return n->name;
 1090|   347k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1094|  47.1k|{
 1095|  47.1k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1095:15): [True: 43.5k, False: 3.61k]
  ------------------
 1096|  43.5k|        return name->name;
 1097|  43.5k|    }
 1098|  3.61k|    typeWarning("name", "returning dummy name");
 1099|  3.61k|    return "/QPDFFakeName";
 1100|  47.1k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1116|  60.1k|{
 1117|  60.1k|    return {QPDFObject::create<QPDF_String>(str)};
 1118|  60.1k|}
_ZN16QPDFObjectHandle16newUnicodeStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1122|  1.16k|{
 1123|  1.16k|    return {String::utf16(utf8_str).obj_sp()};
 1124|  1.16k|}
_ZN4qpdf6StringC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1127|    755|    BaseHandle(QPDFObject::create<QPDF_String>(str))
 1128|    755|{
 1129|    755|}
_ZN4qpdf6StringC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1132|    410|    BaseHandle(QPDFObject::create<QPDF_String>(std::move(str)))
 1133|    410|{
 1134|    410|}
_ZN4qpdf6String5utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1138|  1.16k|{
 1139|  1.16k|    std::string result;
 1140|  1.16k|    if (QUtil::utf8_to_pdf_doc(utf8_str, result, '?')) {
  ------------------
  |  Branch (1140:9): [True: 755, False: 410]
  ------------------
 1141|    755|        return String(result);
 1142|    755|    }
 1143|    410|    return String(QUtil::utf8_to_utf16(utf8_str));
 1144|  1.16k|}
_ZNK4qpdf6String5valueEv:
 1148|  3.82k|{
 1149|  3.82k|    auto* s = as<QPDF_String>();
 1150|  3.82k|    if (!s) {
  ------------------
  |  Branch (1150:9): [True: 0, False: 3.82k]
  ------------------
 1151|      0|        throw invalid_error("String");
 1152|      0|    }
 1153|  3.82k|    return s->val;
 1154|  3.82k|}
_ZNK4qpdf6String10utf8_valueEv:
 1158|   257k|{
 1159|   257k|    auto* s = as<QPDF_String>();
 1160|   257k|    if (!s) {
  ------------------
  |  Branch (1160:9): [True: 0, False: 257k]
  ------------------
 1161|      0|        throw invalid_error("String");
 1162|      0|    }
 1163|   257k|    if (util::is_utf16(s->val)) {
  ------------------
  |  Branch (1163:9): [True: 32.3k, False: 224k]
  ------------------
 1164|  32.3k|        return QUtil::utf16_to_utf8(s->val);
 1165|  32.3k|    }
 1166|   224k|    if (util::is_explicit_utf8(s->val)) {
  ------------------
  |  Branch (1166:9): [True: 2.92k, False: 221k]
  ------------------
 1167|       |        // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
 1168|       |        // of U+FEFF.
 1169|  2.92k|        return s->val.substr(3);
 1170|  2.92k|    }
 1171|   221k|    return QUtil::pdf_doc_to_utf8(s->val);
 1172|   224k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1176|  3.82k|{
 1177|  3.82k|    try {
 1178|  3.82k|        return String(obj).value();
 1179|  3.82k|    } catch (std::invalid_argument&) {
 1180|      0|        typeWarning("string", "returning empty string");
 1181|      0|        return {};
 1182|      0|    }
 1183|  3.82k|}
_ZNK16QPDFObjectHandle12getUTF8ValueEv:
 1198|   211k|{
 1199|   211k|    try {
 1200|   211k|        return String(obj).utf8_value();
 1201|   211k|    } catch (std::invalid_argument&) {
 1202|      0|        typeWarning("string", "returning empty string");
 1203|      0|        return {};
 1204|      0|    }
 1205|   211k|}
_ZNK16QPDFObjectHandle16getOperatorValueEv:
 1222|  1.22M|{
 1223|  1.22M|    if (auto* op = as<QPDF_Operator>()) {
  ------------------
  |  Branch (1223:15): [True: 1.22M, False: 0]
  ------------------
 1224|  1.22M|        return op->val;
 1225|  1.22M|    }
 1226|      0|    typeWarning("operator", "returning fake value");
 1227|      0|    return "QPDFFAKE";
 1228|  1.22M|}
_ZN16QPDFObjectHandle6aitemsEv:
 1264|  4.58k|{
 1265|  4.58k|    return *this;
 1266|  4.58k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1280|  2.26k|{
 1281|  2.26k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1281:9): [True: 127, False: 2.13k]
  ------------------
 1282|    127|        return true;
 1283|  2.13k|    } else if (isArray()) {
  ------------------
  |  Branch (1283:16): [True: 509, False: 1.62k]
  ------------------
 1284|  2.07k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1284:24): [True: 2.07k, False: 496]
  ------------------
 1285|  2.07k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1285:17): [True: 13, False: 2.06k]
  ------------------
 1286|     13|                return true;
 1287|     13|            }
 1288|  2.07k|        }
 1289|    509|    }
 1290|  2.12k|    return false;
 1291|  2.26k|}
_ZN16QPDFObjectHandle14mergeResourcesES_PNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEENS1_IS7_S7_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S7_EEEEEES9_NS5_INSA_ISB_SE_EEEEEE:
 1308|  35.3k|{
 1309|  35.3k|    if (!(isDictionary() && other.isDictionary())) {
  ------------------
  |  Branch (1309:11): [True: 30.6k, False: 4.75k]
  |  Branch (1309:29): [True: 26.8k, False: 3.75k]
  ------------------
 1310|  8.51k|        QTC::TC("qpdf", "QPDFObjectHandle merge top type mismatch");
 1311|  8.51k|        return;
 1312|  8.51k|    }
 1313|       |
 1314|  26.8k|    auto make_og_to_name = [](QPDFObjectHandle& dict,
 1315|  26.8k|                              std::map<QPDFObjGen, std::string>& og_to_name) {
 1316|  26.8k|        for (auto const& [key, value]: dict.as_dictionary()) {
 1317|  26.8k|            if (!value.null() && value.isIndirect()) {
 1318|  26.8k|                og_to_name.insert_or_assign(value.getObjGen(), key);
 1319|  26.8k|            }
 1320|  26.8k|        }
 1321|  26.8k|    };
 1322|       |
 1323|       |    // This algorithm is described in comments in QPDFObjectHandle.hh
 1324|       |    // above the declaration of mergeResources.
 1325|  46.5k|    for (auto const& [rtype, value1]: other.as_dictionary()) {
  ------------------
  |  Branch (1325:37): [True: 46.5k, False: 26.8k]
  ------------------
 1326|  46.5k|        auto other_val = value1;
 1327|  46.5k|        if (hasKey(rtype)) {
  ------------------
  |  Branch (1327:13): [True: 27.8k, False: 18.6k]
  ------------------
 1328|  27.8k|            QPDFObjectHandle this_val = getKey(rtype);
 1329|  27.8k|            if (this_val.isDictionary() && other_val.isDictionary()) {
  ------------------
  |  Branch (1329:17): [True: 21.8k, False: 5.99k]
  |  Branch (1329:44): [True: 21.3k, False: 487]
  ------------------
 1330|  21.3k|                if (this_val.isIndirect()) {
  ------------------
  |  Branch (1330:21): [True: 5.05k, False: 16.2k]
  ------------------
 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|  5.05k|                    QTC::TC("qpdf", "QPDFObjectHandle replace with copy");
 1335|  5.05k|                    this_val = replaceKeyAndGetNew(rtype, this_val.shallowCopy());
 1336|  5.05k|                }
 1337|  21.3k|                std::map<QPDFObjGen, std::string> og_to_name;
 1338|  21.3k|                std::set<std::string> rnames;
 1339|  21.3k|                int min_suffix = 1;
 1340|  21.3k|                bool initialized_maps = false;
 1341|   179k|                for (auto const& [key, value2]: other_val.as_dictionary()) {
  ------------------
  |  Branch (1341:47): [True: 179k, False: 21.3k]
  ------------------
 1342|   179k|                    QPDFObjectHandle rval = value2;
 1343|   179k|                    if (!this_val.hasKey(key)) {
  ------------------
  |  Branch (1343:25): [True: 39.1k, False: 140k]
  ------------------
 1344|  39.1k|                        if (!rval.isIndirect()) {
  ------------------
  |  Branch (1344:29): [True: 13.4k, False: 25.6k]
  ------------------
 1345|  13.4k|                            QTC::TC("qpdf", "QPDFObjectHandle merge shallow copy");
 1346|  13.4k|                            rval = rval.shallowCopy();
 1347|  13.4k|                        }
 1348|  39.1k|                        this_val.replaceKey(key, rval);
 1349|   140k|                    } else if (conflicts) {
  ------------------
  |  Branch (1349:32): [True: 0, False: 140k]
  ------------------
 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|   179k|                }
 1371|  21.3k|            } else if (this_val.isArray() && other_val.isArray()) {
  ------------------
  |  Branch (1371:24): [True: 2.45k, False: 4.03k]
  |  Branch (1371:46): [True: 2.29k, False: 161]
  ------------------
 1372|  2.29k|                std::set<std::string> scalars;
 1373|   100k|                for (auto this_item: this_val.aitems()) {
  ------------------
  |  Branch (1373:36): [True: 100k, False: 2.29k]
  ------------------
 1374|   100k|                    if (this_item.isScalar()) {
  ------------------
  |  Branch (1374:25): [True: 99.1k, False: 1.38k]
  ------------------
 1375|  99.1k|                        scalars.insert(this_item.unparse());
 1376|  99.1k|                    }
 1377|   100k|                }
 1378|   194k|                for (auto other_item: other_val.aitems()) {
  ------------------
  |  Branch (1378:37): [True: 194k, False: 2.29k]
  ------------------
 1379|   194k|                    if (other_item.isScalar()) {
  ------------------
  |  Branch (1379:25): [True: 192k, False: 2.42k]
  ------------------
 1380|   192k|                        if (!scalars.contains(other_item.unparse())) {
  ------------------
  |  Branch (1380:29): [True: 117k, False: 75.0k]
  ------------------
 1381|   117k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array");
 1382|   117k|                            this_val.appendItem(other_item);
 1383|   117k|                        } else {
 1384|  75.0k|                            QTC::TC("qpdf", "QPDFObjectHandle merge array dup");
 1385|  75.0k|                        }
 1386|   192k|                    }
 1387|   194k|                }
 1388|  2.29k|            }
 1389|  27.8k|        } else {
 1390|  18.6k|            QTC::TC("qpdf", "QPDFObjectHandle merge copy from other");
 1391|  18.6k|            replaceKey(rtype, other_val.shallowCopy());
 1392|  18.6k|        }
 1393|  46.5k|    }
 1394|  26.8k|}
_ZNK16QPDFObjectHandle16getResourceNamesEv:
 1398|  16.9k|{
 1399|       |    // Return second-level dictionary keys
 1400|  16.9k|    std::set<std::string> result;
 1401|  48.7k|    for (auto const& item: as_dictionary(strict)) {
  ------------------
  |  Branch (1401:26): [True: 48.7k, False: 16.9k]
  ------------------
 1402|   495k|        for (auto const& [key2, val2]: item.second.as_dictionary(strict)) {
  ------------------
  |  Branch (1402:38): [True: 495k, False: 48.7k]
  ------------------
 1403|   495k|            if (!val2.null()) {
  ------------------
  |  Branch (1403:17): [True: 410k, False: 85.2k]
  ------------------
 1404|   410k|                result.insert(key2);
 1405|   410k|            }
 1406|   495k|        }
 1407|  48.7k|    }
 1408|  16.9k|    return result;
 1409|  16.9k|}
_ZNK16QPDFObjectHandle21getUniqueResourceNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERiPNS0_3setIS6_NS0_4lessIS6_EENS4_IS6_EEEE:
 1414|  16.9k|{
 1415|  16.9k|    std::set<std::string> names = (namesp ? *namesp : getResourceNames());
  ------------------
  |  Branch (1415:36): [True: 0, False: 16.9k]
  ------------------
 1416|  16.9k|    int max_suffix = min_suffix + QIntC::to_int(names.size());
 1417|  16.9k|    while (min_suffix <= max_suffix) {
  ------------------
  |  Branch (1417:12): [True: 16.9k, False: 0]
  ------------------
 1418|  16.9k|        std::string candidate = prefix + std::to_string(min_suffix);
 1419|  16.9k|        if (!names.contains(candidate)) {
  ------------------
  |  Branch (1419:13): [True: 16.9k, False: 10]
  ------------------
 1420|  16.9k|            return candidate;
 1421|  16.9k|        }
 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|  16.9k|}
_ZN16QPDFObjectHandle26arrayOrStreamToStreamArrayERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_:
 1446|  32.5k|{
 1447|  32.5k|    all_description = description;
 1448|  32.5k|    std::vector<QPDFObjectHandle> result;
 1449|  32.5k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (1449:14): [True: 9.12k, False: 23.4k]
  ------------------
 1450|  9.12k|        int n_items = static_cast<int>(array.size());
 1451|   185k|        for (int i = 0; i < n_items; ++i) {
  ------------------
  |  Branch (1451:25): [True: 176k, False: 9.12k]
  ------------------
 1452|   176k|            QPDFObjectHandle item = array[i];
 1453|   176k|            if (item.isStream()) {
  ------------------
  |  Branch (1453:17): [True: 36.8k, False: 139k]
  ------------------
 1454|  36.8k|                result.emplace_back(item);
 1455|   139k|            } else {
 1456|   139k|                item.warn(
 1457|   139k|                    {qpdf_e_damaged_pdf,
 1458|   139k|                     "",
 1459|   139k|                     description + ": item index " + std::to_string(i) + " (from 0)",
 1460|   139k|                     0,
 1461|   139k|                     "ignoring non-stream in an array of streams"});
 1462|   139k|            }
 1463|   176k|        }
 1464|  23.4k|    } else if (isStream()) {
  ------------------
  |  Branch (1464:16): [True: 8.80k, False: 14.6k]
  ------------------
 1465|  8.80k|        result.emplace_back(*this);
 1466|  14.6k|    } else if (!null()) {
  ------------------
  |  Branch (1466:16): [True: 609, False: 14.0k]
  ------------------
 1467|    609|        warn(
 1468|    609|            {qpdf_e_damaged_pdf,
 1469|    609|             "",
 1470|    609|             description,
 1471|    609|             0,
 1472|    609|             " object is supposed to be a stream or an array of streams but is neither"});
 1473|    609|    }
 1474|       |
 1475|  32.5k|    bool first = true;
 1476|  45.6k|    for (auto const& item: result) {
  ------------------
  |  Branch (1476:26): [True: 45.6k, False: 32.5k]
  ------------------
 1477|  45.6k|        if (first) {
  ------------------
  |  Branch (1477:13): [True: 17.0k, False: 28.5k]
  ------------------
 1478|  17.0k|            first = false;
 1479|  28.5k|        } else {
 1480|  28.5k|            all_description += ",";
 1481|  28.5k|        }
 1482|  45.6k|        all_description += " stream " + item.getObjGen().unparse(' ');
 1483|  45.6k|    }
 1484|       |
 1485|  32.5k|    return result;
 1486|  32.5k|}
_ZN16QPDFObjectHandle15getPageContentsEv:
 1490|  7.96k|{
 1491|  7.96k|    std::string description = "page object " + getObjGen().unparse(' ');
 1492|  7.96k|    std::string all_description;
 1493|  7.96k|    return getKey("/Contents").arrayOrStreamToStreamArray(description, all_description);
 1494|  7.96k|}
_ZN16QPDFObjectHandle15addPageContentsES_b:
 1498|  7.96k|{
 1499|  7.96k|    new_contents.assertStream();
 1500|       |
 1501|  7.96k|    std::vector<QPDFObjectHandle> content_streams;
 1502|  7.96k|    if (first) {
  ------------------
  |  Branch (1502:9): [True: 4.04k, False: 3.92k]
  ------------------
 1503|  4.04k|        QTC::TC("qpdf", "QPDFObjectHandle prepend page contents");
 1504|  4.04k|        content_streams.push_back(new_contents);
 1505|  4.04k|    }
 1506|  7.96k|    for (auto const& iter: getPageContents()) {
  ------------------
  |  Branch (1506:26): [True: 5.13k, False: 7.96k]
  ------------------
 1507|  5.13k|        QTC::TC("qpdf", "QPDFObjectHandle append page contents");
 1508|  5.13k|        content_streams.push_back(iter);
 1509|  5.13k|    }
 1510|  7.96k|    if (!first) {
  ------------------
  |  Branch (1510:9): [True: 3.92k, False: 4.04k]
  ------------------
 1511|  3.92k|        content_streams.push_back(new_contents);
 1512|  3.92k|    }
 1513|       |
 1514|  7.96k|    replaceKey("/Contents", newArray(content_streams));
 1515|  7.96k|}
_ZN16QPDFObjectHandle22coalesceContentStreamsEv:
 1552|  19.9k|{
 1553|  19.9k|    QPDFObjectHandle contents = getKey("/Contents");
 1554|  19.9k|    if (contents.isStream()) {
  ------------------
  |  Branch (1554:9): [True: 4.10k, False: 15.8k]
  ------------------
 1555|  4.10k|        QTC::TC("qpdf", "QPDFObjectHandle coalesce called on stream");
 1556|  4.10k|        return;
 1557|  15.8k|    } else if (!contents.isArray()) {
  ------------------
  |  Branch (1557:16): [True: 11.2k, False: 4.64k]
  ------------------
 1558|       |        // /Contents is optional for pages, and some very damaged files may have pages that are
 1559|       |        // invalid in other ways.
 1560|  11.2k|        return;
 1561|  11.2k|    }
 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.64k|    QPDF& qpdf = getQPDF("coalesceContentStreams called on object  with no associated PDF file");
 1567|       |
 1568|  4.64k|    QPDFObjectHandle new_contents = newStream(&qpdf);
 1569|  4.64k|    replaceKey("/Contents", new_contents);
 1570|       |
 1571|  4.64k|    auto provider = std::shared_ptr<StreamDataProvider>(new CoalesceProvider(*this, contents));
 1572|  4.64k|    new_contents.replaceStreamData(provider, newNull(), newNull());
 1573|  4.64k|}
_ZNK16QPDFObjectHandle7unparseEv:
 1577|   351k|{
 1578|   351k|    if (isIndirect()) {
  ------------------
  |  Branch (1578:9): [True: 3.26k, False: 348k]
  ------------------
 1579|  3.26k|        return getObjGen().unparse(' ') + " R";
 1580|   348k|    } else {
 1581|   348k|        return unparseResolved();
 1582|   348k|    }
 1583|   351k|}
_ZNK16QPDFObjectHandle15unparseResolvedEv:
 1587|   348k|{
 1588|   348k|    if (!obj) {
  ------------------
  |  Branch (1588:9): [True: 0, False: 348k]
  ------------------
 1589|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1590|      0|    }
 1591|   348k|    return BaseHandle::unparse();
 1592|   348k|}
_ZNK16QPDFObjectHandle7getJSONEib:
 1606|  17.2k|{
 1607|  17.2k|    if ((!dereference_indirect) && isIndirect()) {
  ------------------
  |  Branch (1607:9): [True: 0, False: 17.2k]
  |  Branch (1607:36): [True: 0, False: 0]
  ------------------
 1608|      0|        return JSON::makeString(unparse());
 1609|  17.2k|    } else if (!obj) {
  ------------------
  |  Branch (1609:16): [True: 0, False: 17.2k]
  ------------------
 1610|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1611|  17.2k|    } else {
 1612|  17.2k|        Pl_Buffer p{"json"};
 1613|  17.2k|        JSON::Writer jw{&p, 0};
 1614|  17.2k|        writeJSON(json_version, jw, dereference_indirect);
 1615|  17.2k|        p.finish();
 1616|  17.2k|        return JSON::parse(p.getString());
 1617|  17.2k|    }
 1618|  17.2k|}
_ZNK16QPDFObjectHandle9writeJSONEiRN4JSON6WriterEb:
 1622|   200k|{
 1623|   200k|    if (!dereference_indirect && isIndirect()) {
  ------------------
  |  Branch (1623:9): [True: 182k, False: 17.2k]
  |  Branch (1623:34): [True: 46.5k, False: 136k]
  ------------------
 1624|  46.5k|        p << "\"" << getObjGen().unparse(' ') << " R\"";
 1625|   153k|    } else if (!obj) {
  ------------------
  |  Branch (1625:16): [True: 0, False: 153k]
  ------------------
 1626|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1627|   153k|    } else {
 1628|   153k|        write_json(json_version, p);
 1629|   153k|    }
 1630|   200k|}
_ZN16QPDFObjectHandle18pipeContentStreamsEP8PipelineRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERS8_:
 1690|  24.5k|{
 1691|  24.5k|    bool need_newline = false;
 1692|  24.5k|    std::string buffer;
 1693|  24.5k|    pl::String buf(buffer);
 1694|  40.0k|    for (auto stream: arrayOrStreamToStreamArray(description, all_description)) {
  ------------------
  |  Branch (1694:21): [True: 40.0k, False: 23.4k]
  ------------------
 1695|  40.0k|        if (need_newline) {
  ------------------
  |  Branch (1695:13): [True: 15.2k, False: 24.7k]
  ------------------
 1696|  15.2k|            buf.writeCStr("\n");
 1697|  15.2k|        }
 1698|  40.0k|        if (!stream.pipeStreamData(&buf, 0, qpdf_dl_specialized)) {
  ------------------
  |  Branch (1698:13): [True: 1.11k, False: 38.9k]
  ------------------
 1699|  1.11k|            QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent");
 1700|  1.11k|            throw QPDFExc(
 1701|  1.11k|                qpdf_e_damaged_pdf,
 1702|  1.11k|                "content stream",
 1703|  1.11k|                "content stream object " + stream.getObjGen().unparse(' '),
 1704|  1.11k|                0,
 1705|  1.11k|                "errors while decoding content stream");
 1706|  1.11k|        }
 1707|  38.9k|        need_newline = buffer.empty() || buffer.back() != '\n';
  ------------------
  |  Branch (1707:24): [True: 2.92k, False: 35.9k]
  |  Branch (1707:42): [True: 15.5k, False: 20.4k]
  ------------------
 1708|  38.9k|        QTC::TC("qpdf", "QPDFObjectHandle need_newline", need_newline ? 0 : 1);
  ------------------
  |  Branch (1708:58): [True: 18.1k, False: 20.7k]
  ------------------
 1709|  38.9k|        p->writeString(buffer);
 1710|  38.9k|        buffer.clear();
 1711|  38.9k|    }
 1712|  23.4k|    p->finish();
 1713|  23.4k|}
_ZN16QPDFObjectHandle17parsePageContentsEPNS_15ParserCallbacksE:
 1717|  19.9k|{
 1718|  19.9k|    std::string description = "page object " + getObjGen().unparse(' ');
 1719|  19.9k|    getKey("/Contents").parseContentStream_internal(description, callbacks);
 1720|  19.9k|}
_ZN16QPDFObjectHandle27parseContentStream_internalERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_15ParserCallbacksE:
 1754|  19.9k|{
 1755|  19.9k|    std::string stream_data;
 1756|  19.9k|    pl::String buf(stream_data);
 1757|  19.9k|    std::string all_description;
 1758|  19.9k|    pipeContentStreams(&buf, description, all_description);
 1759|  19.9k|    if (callbacks) {
  ------------------
  |  Branch (1759:9): [True: 0, False: 19.9k]
  ------------------
 1760|      0|        callbacks->contentSize(stream_data.size());
 1761|      0|    }
 1762|  19.9k|    try {
 1763|  19.9k|        parseContentStream_data(stream_data, all_description, callbacks, getOwningQPDF());
 1764|  19.9k|    } catch (TerminateParsing&) {
 1765|      0|        return;
 1766|      0|    }
 1767|  18.6k|    if (callbacks) {
  ------------------
  |  Branch (1767:9): [True: 0, False: 18.6k]
  ------------------
 1768|      0|        callbacks->handleEOF();
 1769|      0|    }
 1770|  18.6k|}
_ZN16QPDFObjectHandle23parseContentStream_dataENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEERKNS0_12basic_stringIcS3_NS0_9allocatorIcEEEEPNS_15ParserCallbacksEP4QPDF:
 1778|  18.6k|{
 1779|  18.6k|    size_t stream_length = stream_data.size();
 1780|  18.6k|    auto input = is::OffsetBuffer(description, stream_data);
 1781|  18.6k|    Tokenizer tokenizer;
 1782|  18.6k|    tokenizer.allowEOF();
 1783|  18.6k|    auto max_bad_count = Limits::parser_max_errors();
 1784|  18.6k|    auto sp_description = Parser::make_description(description, "content");
 1785|  3.79M|    while (QIntC::to_size(input.tell()) < stream_length) {
  ------------------
  |  Branch (1785:12): [True: 3.78M, False: 12.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|  3.78M|        tokenizer.nextToken(input, "content", true);
 1790|  3.78M|        qpdf_offset_t offset = input.getLastOffset();
 1791|  3.78M|        input.seek(offset, SEEK_SET);
 1792|  3.78M|        auto [obj, empty] = Parser::parse_content(input, sp_description, tokenizer, context);
 1793|  3.78M|        if (empty) {
  ------------------
  |  Branch (1793:13): [True: 6.01k, False: 3.77M]
  ------------------
 1794|       |            // EOF
 1795|  6.01k|            return;
 1796|  6.01k|        }
 1797|  3.77M|        if (!obj) {
  ------------------
  |  Branch (1797:13): [True: 5.94k, False: 3.77M]
  ------------------
 1798|  5.94k|            if (max_bad_count && --max_bad_count == 0) {
  ------------------
  |  Branch (1798:17): [True: 5.94k, False: 0]
  |  Branch (1798:34): [True: 216, False: 5.72k]
  ------------------
 1799|    216|                Limits::error();
 1800|    216|                warn(
 1801|    216|                    context,
 1802|    216|                    {qpdf_e_damaged_pdf,
 1803|    216|                     description,
 1804|    216|                     "stream data",
 1805|    216|                     input.tell(),
 1806|    216|                     "limits error(parser-max-errors): too many errors during content stream "
 1807|    216|                     "parsing"});
 1808|    216|                return;
 1809|    216|            }
 1810|  5.72k|            obj = newNull();
 1811|  5.72k|        }
 1812|  3.77M|        size_t length = QIntC::to_size(input.tell() - offset);
 1813|  3.77M|        if (callbacks) {
  ------------------
  |  Branch (1813:13): [True: 0, False: 3.77M]
  ------------------
 1814|      0|            callbacks->handleObject(obj, QIntC::to_size(offset), length);
 1815|      0|        }
 1816|  3.77M|        if (obj.isOperator() && obj.getOperatorValue() == "ID") {
  ------------------
  |  Branch (1816:13): [True: 1.22M, False: 2.55M]
  |  Branch (1816:13): [True: 2.00k, False: 3.77M]
  |  Branch (1816:33): [True: 2.00k, False: 1.22M]
  ------------------
 1817|       |            // Discard next character; it is the space after ID that terminated the token.  Read
 1818|       |            // until end of inline image.
 1819|  2.00k|            char ch;
 1820|  2.00k|            input.read(&ch, 1);
 1821|  2.00k|            tokenizer.expectInlineImage(input);
 1822|  2.00k|            tokenizer.nextToken(input, description);
 1823|  2.00k|            offset = input.getLastOffset();
 1824|  2.00k|            length = QIntC::to_size(input.tell() - offset);
 1825|  2.00k|            if (tokenizer.getType() == QPDFTokenizer::tt_bad) {
  ------------------
  |  Branch (1825:17): [True: 109, False: 1.89k]
  ------------------
 1826|    109|                QTC::TC("qpdf", "QPDFObjectHandle EOF in inline image");
 1827|    109|                warn(
 1828|    109|                    context,
 1829|    109|                    {qpdf_e_damaged_pdf,
 1830|    109|                     description,
 1831|    109|                     "stream data",
 1832|    109|                     input.tell(),
 1833|    109|                     "EOF found while reading inline image"});
 1834|  1.89k|            } else {
 1835|  1.89k|                QTC::TC("qpdf", "QPDFObjectHandle inline image token");
 1836|  1.89k|                if (callbacks) {
  ------------------
  |  Branch (1836:21): [True: 0, False: 1.89k]
  ------------------
 1837|      0|                    callbacks->handleObject(
 1838|      0|                        QPDFObjectHandle::newInlineImage(tokenizer.getValue()),
 1839|      0|                        QIntC::to_size(offset),
 1840|      0|                        length);
 1841|      0|                }
 1842|  1.89k|            }
 1843|  2.00k|        }
 1844|  3.77M|    }
 1845|  18.6k|}
_ZN16QPDFObjectHandle7newNullEv:
 1886|   112k|{
 1887|   112k|    return {QPDFObject::create<QPDF_Null>()};
 1888|   112k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1898|  67.9k|{
 1899|  67.9k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1900|  67.9k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1922|  25.5k|{
 1923|  25.5k|    return {QPDFObject::create<QPDF_Array>(items)};
 1924|  25.5k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1928|  16.9k|{
 1929|  16.9k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1930|  16.9k|}
_ZN16QPDFObjectHandle16newFromRectangleERKNS_9RectangleE:
 1958|  7.75k|{
 1959|  7.75k|    return newArray(rect);
 1960|  7.75k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1976|  21.9k|{
 1977|  21.9k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1978|  21.9k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1982|  21.9k|{
 1983|  21.9k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1984|  21.9k|}
_ZN16QPDFObjectHandle9newStreamEP4QPDF:
 1988|  4.64k|{
 1989|  4.64k|    if (qpdf == nullptr) {
  ------------------
  |  Branch (1989:9): [True: 0, False: 4.64k]
  ------------------
 1990|      0|        throw std::runtime_error("attempt to create stream in null qpdf object");
 1991|      0|    }
 1992|  4.64k|    QTC::TC("qpdf", "QPDFObjectHandle newStream");
 1993|  4.64k|    return qpdf->newStream();
 1994|  4.64k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2027|   208k|{
 2028|   208k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2028:12): [True: 208k, False: 0]
  ------------------
 2029|   208k|}
_ZN16QPDFObjectHandle20setObjectDescriptionEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2033|  29.1k|{
 2034|  29.1k|    if (obj) {
  ------------------
  |  Branch (2034:9): [True: 29.1k, False: 0]
  ------------------
 2035|  29.1k|        auto descr = std::make_shared<QPDFObject::Description>(object_description);
 2036|  29.1k|        obj->setDescription(owning_qpdf, descr);
 2037|  29.1k|    }
 2038|  29.1k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2042|  61.6k|{
 2043|  61.6k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2043:12): [True: 61.6k, False: 0]
  |  Branch (2043:19): [True: 32.4k, False: 29.1k]
  ------------------
 2044|  61.6k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2048|  43.5k|{
 2049|  43.5k|    if (!obj) {
  ------------------
  |  Branch (2049:9): [True: 0, False: 43.5k]
  ------------------
 2050|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2051|      0|    }
 2052|  43.5k|    return {copy()};
 2053|  43.5k|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2128|  1.11k|{
 2129|  1.11k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2130|  1.11k|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2140|  15.4k|{
 2141|  15.4k|    return {
 2142|  15.4k|        qpdf_e_object,
 2143|  15.4k|        "",
 2144|  15.4k|        description(),
 2145|  15.4k|        0,
 2146|  15.4k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2147|  15.4k|            message};
 2148|  15.4k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2152|  15.4k|{
 2153|  15.4k|    if (!obj) {
  ------------------
  |  Branch (2153:9): [True: 0, False: 15.4k]
  ------------------
 2154|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2155|      0|    }
 2156|  15.4k|    warn(type_error(expected_type, message));
 2157|  15.4k|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2173|  7.96k|{
 2174|  7.96k|    if (!istype) {
  ------------------
  |  Branch (2174:9): [True: 0, False: 7.96k]
  ------------------
 2175|      0|        throw type_error(type_name);
 2176|      0|    }
 2177|  7.96k|}
_ZNK16QPDFObjectHandle12assertStreamEv:
 2241|  7.96k|{
 2242|  7.96k|    assertType("stream", isStream());
 2243|  7.96k|}
_ZNK16QPDFObjectHandle13isFormXObjectEv:
 2296|  77.3k|{
 2297|  77.3k|    return isStreamOfType("", "/Form");
 2298|  77.3k|}
_ZNK16QPDFObjectHandle7isImageEb:
 2302|  15.6k|{
 2303|  15.6k|    return (
 2304|  15.6k|        isStreamOfType("", "/Image") &&
  ------------------
  |  Branch (2304:9): [True: 525, False: 15.0k]
  ------------------
 2305|    525|        ((!exclude_imagemask) ||
  ------------------
  |  Branch (2305:10): [True: 0, False: 525]
  ------------------
 2306|    525|         (!(getDict().getKey("/ImageMask").isBool() &&
  ------------------
  |  Branch (2306:13): [True: 351, False: 174]
  ------------------
 2307|    351|            getDict().getKey("/ImageMask").getBoolValue()))));
  ------------------
  |  Branch (2307:13): [True: 351, False: 0]
  ------------------
 2308|  15.6k|}
_ZN4qpdf10BaseHandle4warnEP4QPDFO7QPDFExc:
 2320|    325|{
 2321|    325|    if (!qpdf) {
  ------------------
  |  Branch (2321:9): [True: 0, False: 325]
  ------------------
 2322|      0|        throw std::move(e);
 2323|      0|    }
 2324|    325|    qpdf->warn(std::move(e));
 2325|    325|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2329|   348k|{
 2330|   348k|    if (!qpdf()) {
  ------------------
  |  Branch (2330:9): [True: 571, False: 348k]
  ------------------
 2331|    571|        throw std::move(e);
 2332|    571|    }
 2333|   348k|    qpdf()->warn(std::move(e));
 2334|   348k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2338|   227k|{
 2339|   227k|    if (qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 192k, False: 34.8k]
  ------------------
 2340|   192k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2341|   192k|    } else {
 2342|  34.8k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2343|  34.8k|    }
 2344|   227k|}
_ZN16QPDFObjectHandle14QPDFArrayItemsC2ERKS_:
 2432|  4.58k|    oh(oh)
 2433|  4.58k|{
 2434|  4.58k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorppEv:
 2438|   295k|{
 2439|   295k|    if (!m->is_end) {
  ------------------
  |  Branch (2439:9): [True: 295k, False: 0]
  ------------------
 2440|   295k|        ++m->item_number;
 2441|   295k|        updateIValue();
 2442|   295k|    }
 2443|   295k|    return *this;
 2444|   295k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratordeEv:
 2458|   295k|{
 2459|   295k|    updateIValue();
 2460|   295k|    return ivalue;
 2461|   295k|}
_ZNK16QPDFObjectHandle14QPDFArrayItems8iteratoreqERKS1_:
 2472|   299k|{
 2473|   299k|    return (m->item_number == other.m->item_number);
 2474|   299k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iteratorC2ERS_b:
 2477|  9.17k|    m(new Members(oh, for_begin))
 2478|  9.17k|{
 2479|  9.17k|    updateIValue();
 2480|  9.17k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator12updateIValueEv:
 2484|   599k|{
 2485|   599k|    m->is_end = (m->item_number >= m->oh.getArrayNItems());
 2486|   599k|    if (m->is_end) {
  ------------------
  |  Branch (2486:9): [True: 9.17k, False: 590k]
  ------------------
 2487|  9.17k|        ivalue = QPDFObjectHandle();
 2488|   590k|    } else {
 2489|   590k|        ivalue = m->oh.getArrayItem(m->item_number);
 2490|   590k|    }
 2491|   599k|}
_ZN16QPDFObjectHandle14QPDFArrayItems8iterator7MembersC2ERS_b:
 2494|  9.17k|    oh(oh)
 2495|  9.17k|{
 2496|  9.17k|    item_number = for_begin ? 0 : oh.getArrayNItems();
  ------------------
  |  Branch (2496:19): [True: 4.58k, False: 4.58k]
  ------------------
 2497|  9.17k|}
_ZN16QPDFObjectHandle14QPDFArrayItems5beginEv:
 2501|  4.58k|{
 2502|  4.58k|    return {oh, true};
 2503|  4.58k|}
_ZN16QPDFObjectHandle14QPDFArrayItems3endEv:
 2507|  4.58k|{
 2508|  4.58k|    return {oh, false};
 2509|  4.58k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2513|   923k|{
 2514|   923k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2514:12): [True: 923k, False: 0]
  ------------------
 2515|   923k|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2519|   674k|{
 2520|   674k|    return getObjGen().getObj();
 2521|   674k|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2531|   665k|{
 2532|   665k|    return getObjectID() != 0;
 2533|   665k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2538|   489k|{
 2539|   489k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2539:12): [True: 489k, False: 0]
  ------------------
 2540|   489k|}
_ZNK16QPDFObjectHandle7getQPDFERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2544|  4.64k|{
 2545|  4.64k|    if (auto result = obj ? obj->getQPDF() : nullptr) {
  ------------------
  |  Branch (2545:14): [True: 4.64k, False: 0]
  ------------------
 2546|  4.64k|        return *result;
 2547|  4.64k|    }
 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.64k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2553|     19|{
 2554|     19|    if (obj) {
  ------------------
  |  Branch (2554:9): [True: 19, False: 0]
  ------------------
 2555|     19|        obj->setParsedOffset(offset);
 2556|     19|    }
 2557|     19|}
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderC2E16QPDFObjectHandleS1_:
   95|  4.64k|            containing_page(containing_page),
   96|  4.64k|            old_contents(old_contents)
   97|  4.64k|        {
   98|  4.64k|        }
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProviderD2Ev:
   99|  4.64k|        ~CoalesceProvider() override = default;
QPDFObjectHandle.cc:_ZN12_GLOBAL__N_116CoalesceProvider17provideStreamDataERK10QPDFObjGenP8Pipeline:
  110|  4.64k|{
  111|  4.64k|    QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data");
  112|  4.64k|    std::string description = "page object " + containing_page.getObjGen().unparse(' ');
  113|  4.64k|    std::string all_description;
  114|  4.64k|    old_contents.pipeContentStreams(p, description, all_description);
  115|  4.64k|}

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

_ZN25QPDFOutlineDocumentHelper8Accessor9checkSeenERS_10QPDFObjGen:
   23|  5.57k|{
   24|  5.57k|    return !dh.m->seen.add(og);
   25|  5.57k|}
_ZN25QPDFOutlineDocumentHelperC2ER4QPDF:
   28|  11.5k|    QPDFDocumentHelper(qpdf),
   29|  11.5k|    m(std::make_shared<Members>())
   30|  11.5k|{
   31|  11.5k|    validate();
   32|  11.5k|}
_ZN25QPDFOutlineDocumentHelper8validateEb:
   42|  11.5k|{
   43|  11.5k|    m->outlines.clear();
   44|  11.5k|    m->names_dest = nullptr;
   45|       |
   46|  11.5k|    QPDFObjectHandle root = qpdf.getRoot();
   47|  11.5k|    if (!root.hasKey("/Outlines")) {
  ------------------
  |  Branch (47:9): [True: 10.7k, False: 798]
  ------------------
   48|  10.7k|        return;
   49|  10.7k|    }
   50|    798|    auto outlines = root.getKey("/Outlines");
   51|    798|    if (!(outlines.isDictionary() && outlines.hasKey("/First"))) {
  ------------------
  |  Branch (51:9): [True: 23, False: 775]
  |  Branch (51:11): [True: 785, False: 13]
  |  Branch (51:38): [True: 775, False: 10]
  ------------------
   52|     23|        return;
   53|     23|    }
   54|    775|    QPDFObjectHandle cur = outlines.getKey("/First");
   55|    775|    QPDFObjGen::set seen;
   56|  2.54k|    while (!cur.null()) {
  ------------------
  |  Branch (56:12): [True: 1.81k, False: 727]
  ------------------
   57|  1.81k|        if (!seen.add(cur)) {
  ------------------
  |  Branch (57:13): [True: 48, False: 1.77k]
  ------------------
   58|     48|            cur.warn("Loop detected loop in /Outlines tree");
   59|     48|            return;
   60|     48|        }
   61|  1.77k|        m->outlines.emplace_back(QPDFOutlineObjectHelper::Accessor::create(cur, *this, 1));
   62|  1.77k|        cur = cur.getKey("/Next");
   63|  1.77k|    }
   64|    775|}
_ZN25QPDFOutlineDocumentHelper16initializeByPageEv:
   80|  15.9k|{
   81|  15.9k|    std::list<QPDFOutlineObjectHelper> queue;
   82|  15.9k|    queue.insert(queue.end(), m->outlines.begin(), m->outlines.end());
   83|       |
   84|  21.7k|    while (!queue.empty()) {
  ------------------
  |  Branch (84:12): [True: 5.75k, False: 15.9k]
  ------------------
   85|  5.75k|        QPDFOutlineObjectHelper oh = queue.front();
   86|  5.75k|        queue.pop_front();
   87|  5.75k|        m->by_page[oh.getDestPage().getObjGen()].push_back(oh);
   88|  5.75k|        std::vector<QPDFOutlineObjectHelper> kids = oh.getKids();
   89|  5.75k|        queue.insert(queue.end(), kids.begin(), kids.end());
   90|  5.75k|    }
   91|  15.9k|}
_ZN25QPDFOutlineDocumentHelper18getOutlinesForPageE10QPDFObjGen:
   95|  17.1k|{
   96|  17.1k|    if (m->by_page.empty()) {
  ------------------
  |  Branch (96:9): [True: 15.9k, False: 1.16k]
  ------------------
   97|  15.9k|        initializeByPage();
   98|  15.9k|    }
   99|  17.1k|    if (m->by_page.contains(og)) {
  ------------------
  |  Branch (99:9): [True: 266, False: 16.8k]
  ------------------
  100|    266|        return m->by_page[og];
  101|    266|    }
  102|  16.8k|    return {};
  103|  17.1k|}
_ZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandle:
  107|  1.60k|{
  108|  1.60k|    QPDFObjectHandle result;
  109|  1.60k|    if (name.isName()) {
  ------------------
  |  Branch (109:9): [True: 114, False: 1.49k]
  ------------------
  110|    114|        if (!m->dest_dict) {
  ------------------
  |  Branch (110:13): [True: 32, False: 82]
  ------------------
  111|     32|            m->dest_dict = qpdf.getRoot().getKey("/Dests");
  112|     32|        }
  113|    114|        result = m->dest_dict.getKeyIfDict(name.getName());
  114|  1.49k|    } else if (name.isString()) {
  ------------------
  |  Branch (114:16): [True: 1.49k, False: 0]
  ------------------
  115|  1.49k|        if (!m->names_dest) {
  ------------------
  |  Branch (115:13): [True: 772, False: 721]
  ------------------
  116|    772|            auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
  117|    772|            if (dests.isDictionary()) {
  ------------------
  |  Branch (117:17): [True: 543, False: 229]
  ------------------
  118|    543|                m->names_dest = std::make_unique<QPDFNameTreeObjectHelper>(
  119|    543|                    dests,
  120|    543|                    qpdf,
  121|    543|                    [](QPDFObjectHandle const& o) -> bool {
  122|    543|                        return o.isArray() || o.contains("/D");
  123|    543|                    },
  124|    543|                    true);
  125|    543|                m->names_dest->validate();
  126|    543|            }
  127|    772|        }
  128|  1.49k|        if (m->names_dest) {
  ------------------
  |  Branch (128:13): [True: 1.16k, False: 328]
  ------------------
  129|  1.16k|            if (m->names_dest->findObject(name.getUTF8Value(), result)) {
  ------------------
  |  Branch (129:17): [True: 153, False: 1.01k]
  ------------------
  130|    153|                QTC::TC("qpdf", "QPDFOutlineDocumentHelper string named dest");
  131|    153|            }
  132|  1.16k|        }
  133|  1.49k|    }
  134|  1.60k|    if (!result) {
  ------------------
  |  Branch (134:9): [True: 912, False: 695]
  ------------------
  135|    912|        return QPDFObjectHandle::newNull();
  136|    912|    }
  137|    695|    if (result.isDictionary()) {
  ------------------
  |  Branch (137:9): [True: 90, False: 605]
  ------------------
  138|     90|        return result.getKey("/D");
  139|     90|    }
  140|    605|    return result;
  141|    695|}
_ZN25QPDFOutlineDocumentHelper7MembersC2Ev:
   10|  11.5k|    Members() = default;
_ZN25QPDFOutlineDocumentHelper7MembersD2Ev:
   12|  11.5k|    ~Members() = default;
QPDFOutlineDocumentHelper.cc:_ZZN25QPDFOutlineDocumentHelper16resolveNamedDestE16QPDFObjectHandleENK3$_0clERKS0_:
  121|  29.5k|                    [](QPDFObjectHandle const& o) -> bool {
  122|  29.5k|                        return o.isArray() || o.contains("/D");
  ------------------
  |  Branch (122:32): [True: 4.23k, False: 25.3k]
  |  Branch (122:47): [True: 24.6k, False: 721]
  ------------------
  123|  29.5k|                    },

_ZN23QPDFOutlineObjectHelper7MembersC2ER25QPDFOutlineDocumentHelper:
    8|  5.57k|    dh(dh)
    9|  5.57k|{
   10|  5.57k|}
_ZN23QPDFOutlineObjectHelperC2E16QPDFObjectHandleR25QPDFOutlineDocumentHelperi:
   14|  5.57k|    QPDFObjectHelper(a_oh),
   15|  5.57k|    m(new Members(dh))
   16|  5.57k|{
   17|  5.57k|    if (depth > 50) {
  ------------------
  |  Branch (17:9): [True: 0, False: 5.57k]
  ------------------
   18|       |        // Not exercised in test suite, but was tested manually by temporarily changing max depth
   19|       |        // to 1.
   20|      0|        return;
   21|      0|    }
   22|  5.57k|    if (QPDFOutlineDocumentHelper::Accessor::checkSeen(m->dh, a_oh.getObjGen())) {
  ------------------
  |  Branch (22:9): [True: 1.74k, False: 3.83k]
  ------------------
   23|  1.74k|        a_oh.warn("Loop detected loop in /Outlines tree");
   24|  1.74k|        return;
   25|  1.74k|    }
   26|       |
   27|  3.83k|    QPDFObjGen::set children;
   28|  3.83k|    QPDFObjectHandle cur = a_oh.getKey("/First");
   29|  7.63k|    while (!cur.null() && cur.isIndirect()) {
  ------------------
  |  Branch (29:12): [True: 4.03k, False: 3.60k]
  |  Branch (29:27): [True: 3.97k, False: 63]
  ------------------
   30|  3.97k|        if (!children.add(cur)) {
  ------------------
  |  Branch (30:13): [True: 166, False: 3.80k]
  ------------------
   31|    166|            cur.warn("Loop detected loop in /Outlines tree");
   32|    166|            break;
   33|    166|        }
   34|  3.80k|        QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
   35|  3.80k|        new_ooh.m->parent = std::make_shared<QPDFOutlineObjectHelper>(*this);
   36|  3.80k|        m->kids.emplace_back(new_ooh);
   37|  3.80k|        cur = cur.getKey("/Next");
   38|  3.80k|    }
   39|  3.83k|}
_ZN23QPDFOutlineObjectHelper7getKidsEv:
   49|  5.32k|{
   50|  5.32k|    return m->kids;
   51|  5.32k|}
_ZN23QPDFOutlineObjectHelper7getDestEv:
   55|  5.75k|{
   56|  5.75k|    auto dest = get("/Dest");
   57|  5.75k|    if (dest.null()) {
  ------------------
  |  Branch (57:9): [True: 4.26k, False: 1.49k]
  ------------------
   58|  4.26k|        auto const& A = get("/A");
   59|  4.26k|        if (Name(A["/S"]) == "/GoTo") {
  ------------------
  |  Branch (59:13): [True: 1.88k, False: 2.37k]
  ------------------
   60|  1.88k|            dest = A["/D"];
   61|  1.88k|        }
   62|  4.26k|    }
   63|  5.75k|    if (dest.null()) {
  ------------------
  |  Branch (63:9): [True: 2.42k, False: 3.33k]
  ------------------
   64|  2.42k|        return QPDFObjectHandle::newNull();
   65|  2.42k|    }
   66|  3.33k|    if (dest.isName() || dest.isString()) {
  ------------------
  |  Branch (66:9): [True: 114, False: 3.21k]
  |  Branch (66:26): [True: 1.49k, False: 1.72k]
  ------------------
   67|  1.60k|        return m->dh.resolveNamedDest(dest);
   68|  1.60k|    }
   69|  1.72k|    return dest;
   70|  3.33k|}
_ZN23QPDFOutlineObjectHelper11getDestPageEv:
   74|  5.75k|{
   75|  5.75k|    QPDFObjectHandle dest = getDest();
   76|  5.75k|    if (!dest.empty() && dest.isArray()) {
  ------------------
  |  Branch (76:9): [True: 1.85k, False: 3.90k]
  |  Branch (76:26): [True: 1.76k, False: 85]
  ------------------
   77|  1.76k|        return dest.getArrayItem(0);
   78|  1.76k|    }
   79|  3.98k|    return QPDFObjectHandle::newNull();
   80|  5.75k|}

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

_ZN20QPDFPageObjectHelperC2E16QPDFObjectHandle:
  219|  59.7k|    QPDFObjectHelper(oh)
  220|  59.7k|{
  221|  59.7k|}
_ZN20QPDFPageObjectHelper12getAttributeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEb:
  225|  38.7k|{
  226|  38.7k|    return getAttribute(name, copy_if_shared, nullptr, false);
  227|  38.7k|}
_ZN20QPDFPageObjectHelper12getAttributeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEbNS0_8functionIF16QPDFObjectHandlevEEEb:
  235|  38.7k|{
  236|  38.7k|    const bool is_form_xobject = oh().isFormXObject();
  237|  38.7k|    bool inherited = false;
  238|  38.7k|    auto dict = is_form_xobject ? oh().getDict() : oh();
  ------------------
  |  Branch (238:17): [True: 0, False: 38.7k]
  ------------------
  239|  38.7k|    auto result = dict.getKey(name);
  240|       |
  241|  38.7k|    if (!is_form_xobject && result.null() &&
  ------------------
  |  Branch (241:9): [True: 38.7k, False: 2]
  |  Branch (241:29): [True: 1.52k, False: 37.2k]
  ------------------
  242|  1.52k|        (name == "/MediaBox" || name == "/CropBox" || name == "/Resources" || name == "/Rotate")) {
  ------------------
  |  Branch (242:10): [True: 0, False: 1.52k]
  |  Branch (242:33): [True: 0, False: 1.52k]
  |  Branch (242:55): [True: 1.52k, False: 0]
  |  Branch (242:79): [True: 0, False: 0]
  ------------------
  243|  1.52k|        QPDFObjectHandle node = dict;
  244|  1.52k|        QPDFObjGen::set seen{};
  245|  1.93k|        while (seen.add(node) && node.hasKey("/Parent")) {
  ------------------
  |  Branch (245:16): [True: 1.88k, False: 43]
  |  Branch (245:16): [True: 717, False: 1.21k]
  |  Branch (245:34): [True: 717, False: 1.17k]
  ------------------
  246|    717|            node = node.getKey("/Parent");
  247|    717|            result = node.getKey(name);
  248|    717|            if (!result.null()) {
  ------------------
  |  Branch (248:17): [True: 309, False: 408]
  ------------------
  249|    309|                inherited = true;
  250|    309|                break;
  251|    309|            }
  252|    717|        }
  253|  1.52k|    }
  254|  38.7k|    if (copy_if_shared && (inherited || result.isIndirect())) {
  ------------------
  |  Branch (254:9): [True: 20.1k, False: 18.6k]
  |  Branch (254:28): [True: 309, False: 19.8k]
  |  Branch (254:41): [True: 5.29k, False: 14.5k]
  ------------------
  255|  5.59k|        QTC::TC("qpdf", "QPDFPageObjectHelper copy shared attribute", is_form_xobject ? 0 : 1);
  ------------------
  |  Branch (255:71): [True: 0, False: 5.59k]
  ------------------
  256|  5.59k|        result = dict.replaceKeyAndGetNew(name, result.shallowCopy());
  257|  5.59k|    }
  258|  38.7k|    if (result.null() && get_fallback) {
  ------------------
  |  Branch (258:9): [True: 1.21k, False: 37.5k]
  |  Branch (258:26): [True: 0, False: 1.21k]
  ------------------
  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|  38.7k|    return result;
  267|  38.7k|}
_ZN20QPDFPageObjectHelper14forEachXObjectEbNSt3__18functionIFvR16QPDFObjectHandleS3_RKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEENS1_IFbS2_EEE:
  327|  18.6k|{
  328|  18.6k|    QTC::TC(
  329|  18.6k|        "qpdf",
  330|  18.6k|        "QPDFPageObjectHelper::forEachXObject",
  331|  18.6k|        recursive ? (oh().isFormXObject() ? 0 : 1) : (oh().isFormXObject() ? 2 : 3));
  ------------------
  |  Branch (331:9): [True: 0, False: 18.6k]
  |  Branch (331:22): [True: 0, False: 0]
  |  Branch (331:55): [True: 0, False: 18.6k]
  ------------------
  332|  18.6k|    QPDFObjGen::set seen;
  333|  18.6k|    std::list<QPDFPageObjectHelper> queue;
  334|  18.6k|    queue.emplace_back(*this);
  335|  37.2k|    while (!queue.empty()) {
  ------------------
  |  Branch (335:12): [True: 18.6k, False: 18.6k]
  ------------------
  336|  18.6k|        auto& ph = queue.front();
  337|  18.6k|        if (seen.add(ph)) {
  ------------------
  |  Branch (337:13): [True: 18.6k, False: 0]
  ------------------
  338|  18.6k|            auto xobj_dict = ph.getAttribute("/Resources", false).getKeyIfDict("/XObject");
  339|  28.5k|            for (auto const& [key, value]: xobj_dict.as_dictionary()) {
  ------------------
  |  Branch (339:42): [True: 28.5k, False: 18.6k]
  ------------------
  340|  28.5k|                if (value.null()) {
  ------------------
  |  Branch (340:21): [True: 12.8k, False: 15.6k]
  ------------------
  341|  12.8k|                    continue;
  342|  12.8k|                }
  343|  15.6k|                auto obj = value;
  344|  15.6k|                if ((!selector) || selector(obj)) {
  ------------------
  |  Branch (344:21): [True: 0, False: 15.6k]
  |  Branch (344:21): [True: 174, False: 15.4k]
  |  Branch (344:36): [True: 174, False: 15.4k]
  ------------------
  345|    174|                    action(obj, xobj_dict, key);
  346|    174|                }
  347|  15.6k|                if (recursive && obj.isFormXObject()) {
  ------------------
  |  Branch (347:21): [True: 0, False: 15.6k]
  |  Branch (347:34): [True: 0, False: 0]
  ------------------
  348|      0|                    queue.emplace_back(obj);
  349|      0|                }
  350|  15.6k|            }
  351|  18.6k|        }
  352|  18.6k|        queue.pop_front();
  353|  18.6k|    }
  354|  18.6k|}
_ZN20QPDFPageObjectHelper12forEachImageEbNSt3__18functionIFvR16QPDFObjectHandleS3_RKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEE:
  361|  18.6k|{
  362|  18.6k|    forEachXObject(recursive, action, [](QPDFObjectHandle obj) { return obj.isImage(); });
  363|  18.6k|}
_ZN20QPDFPageObjectHelper9getImagesEv:
  382|  18.6k|{
  383|  18.6k|    std::map<std::string, QPDFObjectHandle> result;
  384|  18.6k|    forEachImage(
  385|  18.6k|        false, [&result](QPDFObjectHandle& obj, QPDFObjectHandle&, std::string const& key) {
  386|  18.6k|            result[key] = obj;
  387|  18.6k|        });
  388|  18.6k|    return result;
  389|  18.6k|}
_ZN20QPDFPageObjectHelper14getAnnotationsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  444|  56.4k|{
  445|  56.4k|    std::vector<QPDFAnnotationObjectHelper> result;
  446|   578k|    for (auto const& annot: oh().getKey("/Annots").as_array()) {
  ------------------
  |  Branch (446:27): [True: 578k, False: 56.4k]
  ------------------
  447|   578k|        if (annot.isDictionaryOfType("", only_subtype)) {
  ------------------
  |  Branch (447:13): [True: 83.8k, False: 494k]
  ------------------
  448|  83.8k|            result.emplace_back(annot);
  449|  83.8k|        }
  450|   578k|    }
  451|  56.4k|    return result;
  452|  56.4k|}
_ZN20QPDFPageObjectHelper15addPageContentsE16QPDFObjectHandleb:
  462|  7.96k|{
  463|  7.96k|    oh().addPageContents(contents, first);
  464|  7.96k|}
_ZN20QPDFPageObjectHelper22coalesceContentStreamsEv:
  474|  19.9k|{
  475|  19.9k|    oh().coalesceContentStreams();
  476|  19.9k|}
_ZN20QPDFPageObjectHelper13parseContentsEPN16QPDFObjectHandle15ParserCallbacksE:
  486|  19.9k|{
  487|  19.9k|    if (oh().isFormXObject()) {
  ------------------
  |  Branch (487:9): [True: 0, False: 19.9k]
  ------------------
  488|      0|        oh().parseAsContents(callbacks);
  489|  19.9k|    } else {
  490|  19.9k|        oh().parsePageContents(callbacks);
  491|  19.9k|    }
  492|  19.9k|}
QPDFPageObjectHelper.cc:_ZZN20QPDFPageObjectHelper12forEachImageEbNSt3__18functionIFvR16QPDFObjectHandleS3_RKNS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEEEEENK3$_0clES2_:
  362|  15.6k|    forEachXObject(recursive, action, [](QPDFObjectHandle obj) { return obj.isImage(); });
QPDFPageObjectHelper.cc:_ZZN20QPDFPageObjectHelper9getImagesEvENK3$_0clER16QPDFObjectHandleS2_RKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  385|    174|        false, [&result](QPDFObjectHandle& obj, QPDFObjectHandle&, std::string const& key) {
  386|    174|            result[key] = obj;
  387|    174|        });

_ZN4qpdf4impl6Parser13parse_contentER11InputSourceNSt3__110shared_ptrINS4_7variantIJNS4_12basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEN10QPDFObject10JSON_DescrENSD_10ChildDescrENSD_14ObjStreamDescrEEEEEERNS_9TokenizerEP4QPDF:
   75|  3.78M|{
   76|  3.78M|    static const std::string content("content"); // GCC12 - make constexpr
   77|  3.78M|    auto p = Parser(
   78|  3.78M|        input,
   79|  3.78M|        std::move(sp_description),
   80|  3.78M|        content,
   81|  3.78M|        tokenizer,
   82|  3.78M|        nullptr,
   83|  3.78M|        context,
   84|  3.78M|        true,
   85|  3.78M|        0,
   86|  3.78M|        0,
   87|  3.78M|        context && context->doc().reconstructed_xref());
  ------------------
  |  Branch (87:9): [True: 3.78M, False: 0]
  |  Branch (87:20): [True: 3.77M, False: 6.97k]
  ------------------
   88|  3.78M|    if (auto result = p.parse(true)) {
  ------------------
  |  Branch (88:14): [True: 3.77M, False: 11.9k]
  ------------------
   89|  3.77M|        return {result, false};
   90|  3.77M|    }
   91|  11.9k|    return {{}, p.empty_};
   92|  3.78M|}
_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   190k|{
  130|   190k|    return Parser(
  131|   190k|               input,
  132|   190k|               make_description(input.getName(), object_description),
  133|   190k|               object_description,
  134|   190k|               tokenizer,
  135|   190k|               decrypter,
  136|   190k|               &context,
  137|   190k|               true,
  138|   190k|               0,
  139|   190k|               0,
  140|   190k|               sanity_checks)
  141|   190k|        .parse();
  142|   190k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  23.3k|{
  148|  23.3k|    return Parser(
  149|  23.3k|               input,
  150|  23.3k|               std::make_shared<QPDFObject::Description>(
  151|  23.3k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  23.3k|               "",
  153|  23.3k|               tokenizer,
  154|  23.3k|               nullptr,
  155|  23.3k|               &context,
  156|  23.3k|               true,
  157|  23.3k|               stream_id,
  158|  23.3k|               obj_id)
  159|  23.3k|        .parse();
  160|  23.3k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|  3.99M|{
  165|  3.99M|    try {
  166|  3.99M|        return parse_first(content_stream);
  167|  3.99M|    } catch (Error&) {
  168|  11.6k|        return {};
  169|  11.6k|    } catch (QPDFExc& e) {
  170|  4.09k|        throw e;
  171|  4.09k|    } catch (std::logic_error& e) {
  172|      4|        throw e;
  173|  2.22k|    } catch (std::exception& e) {
  174|  2.22k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  2.22k|        return {};
  176|  2.22k|    }
  177|  3.99M|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|  3.99M|{
  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|  3.99M|    QPDF::Doc::ParseGuard pg(context_);
  188|  3.99M|    start_ = input_.tell();
  189|  3.99M|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 5.43k, False: 3.99M]
  ------------------
  190|  5.43k|        warn(tokenizer_.getErrorMessage());
  191|  5.43k|    }
  192|       |
  193|  3.99M|    switch (tokenizer_.getType()) {
  194|  6.72k|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 6.72k, False: 3.99M]
  ------------------
  195|  6.72k|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 6.01k, False: 705]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|  6.01k|            empty_ = true;
  198|  6.01k|            return {};
  199|  6.01k|        }
  200|    705|        warn("unexpected EOF");
  201|    705|        return {};
  202|       |
  203|  5.08k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 5.08k, False: 3.99M]
  ------------------
  204|  5.08k|        return {};
  205|       |
  206|    304|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 304, False: 3.99M]
  ------------------
  207|    557|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 253, False: 3.99M]
  ------------------
  208|    557|        warn("treating unexpected brace token as null");
  209|    557|        return {};
  210|       |
  211|  1.26k|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 1.26k, False: 3.99M]
  ------------------
  212|  1.26k|        warn("treating unexpected array close token as null");
  213|  1.26k|        return {};
  214|       |
  215|    811|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 811, False: 3.99M]
  ------------------
  216|    811|        warn("unexpected dictionary close token");
  217|    811|        return {};
  218|       |
  219|  68.4k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 68.4k, False: 3.93M]
  ------------------
  220|   247k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 178k, False: 3.82M]
  ------------------
  221|   247k|        stack_.clear();
  222|   247k|        stack_.emplace_back(
  223|   247k|            input_,
  224|   247k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 68.4k, False: 178k]
  ------------------
  225|   247k|        frame_ = &stack_.back();
  226|   247k|        return parse_remainder(content_stream);
  227|       |
  228|  1.25k|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 1.25k, False: 3.99M]
  ------------------
  229|  1.25k|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    351|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 351, False: 3.99M]
  ------------------
  232|    351|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|   753k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 753k, False: 3.24M]
  ------------------
  235|   753k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|   271k|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 271k, False: 3.72M]
  ------------------
  238|   271k|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.42M|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.42M, False: 2.57M]
  ------------------
  241|  1.42M|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  1.23M|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 1.23M, False: 2.76M]
  ------------------
  244|  1.23M|        {
  245|  1.23M|            auto const& value = tokenizer_.getValue();
  246|  1.23M|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 1.22M, False: 8.06k]
  ------------------
  247|  1.22M|                return with_description<QPDF_Operator>(value);
  248|  1.22M|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 351, False: 7.71k]
  ------------------
  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|    351|                empty_ = true;
  254|    351|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    351|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 351, False: 0]
  ------------------
  256|    351|                    warn("empty object treated as null");
  257|    351|                }
  258|    351|                return {};
  259|  7.71k|            } else {
  260|  7.71k|                warn("unknown token while reading object; treating as string");
  261|  7.71k|                return with_description<QPDF_String>(value);
  262|  7.71k|            }
  263|  1.23M|        }
  264|       |
  265|  54.9k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 54.9k, False: 3.94M]
  ------------------
  266|  54.9k|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 244, False: 54.7k]
  ------------------
  267|    244|            std::string s{tokenizer_.getValue()};
  268|    244|            decrypter_->decryptString(s);
  269|    244|            return with_description<QPDF_String>(s);
  270|  54.7k|        } else {
  271|  54.7k|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|  54.7k|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 3.99M]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|  3.99M|    }
  278|  3.99M|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   247k|{
  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|   247k|    bad_count_ = 0;
  289|   247k|    bool b_contents = false;
  290|       |
  291|  10.9M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 10.9M, Folded]
  ------------------
  292|  10.9M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 64.5k, False: 10.8M]
  ------------------
  293|  64.5k|            warn(tokenizer_.getErrorMessage());
  294|  64.5k|        }
  295|  10.9M|        ++good_count_; // optimistically
  296|       |
  297|  10.9M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 4.91M, False: 5.99M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  4.91M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 3.86M, False: 1.04M]
  ------------------
  301|  3.86M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 3.08M, False: 785k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  3.08M|                    add_int(int_count_);
  304|  3.08M|                }
  305|  3.86M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  3.86M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  3.86M|                continue;
  308|       |
  309|  3.86M|            } else if (
  310|  1.04M|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 785k, False: 257k]
  |  Branch (310:36): [True: 710k, False: 74.7k]
  ------------------
  311|   710k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 674k, False: 36.6k]
  ------------------
  312|   674k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 674k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   674k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   674k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   674k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 4.60k, False: 669k]
  |  Branch (319:33): [True: 284, False: 669k]
  |  Branch (319:44): [True: 440, False: 668k]
  ------------------
  320|   668k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   668k|                } else {
  322|  5.32k|                    add_bad_null(
  323|  5.32k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  5.32k|                        std::to_string(gen) + " R) as null");
  325|  5.32k|                }
  326|   674k|                int_count_ = 0;
  327|   674k|                continue;
  328|       |
  329|   674k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 369k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   369k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 111k, False: 257k]
  ------------------
  332|   111k|                    add_int(int_count_ - 1);
  333|   111k|                }
  334|   369k|                add_int(int_count_);
  335|   369k|                int_count_ = 0;
  336|   369k|            }
  337|  4.91M|        }
  338|       |
  339|  6.36M|        switch (tokenizer_.getType()) {
  340|  8.01k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 8.01k, False: 6.35M]
  ------------------
  341|  8.01k|            warn("parse error while reading object");
  342|  8.01k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 260, False: 7.75k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|    260|                return {};
  345|    260|            }
  346|  7.75k|            warn("unexpected EOF");
  347|  7.75k|            return {};
  348|       |
  349|  55.4k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 55.4k, False: 6.30M]
  ------------------
  350|  55.4k|            check_too_many_bad_tokens();
  351|  55.4k|            add_null();
  352|  55.4k|            continue;
  353|       |
  354|  3.00k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 3.00k, False: 6.35M]
  ------------------
  355|  5.44k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 2.43k, False: 6.35M]
  ------------------
  356|  5.44k|            add_bad_null("treating unexpected brace token as null");
  357|  5.44k|            continue;
  358|       |
  359|   355k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 355k, False: 6.00M]
  ------------------
  360|   355k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 352k, False: 3.02k]
  ------------------
  361|   352k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 447, False: 352k]
  ------------------
  362|   352k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|   352k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|   352k|                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|   352k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 60.4k, False: 292k]
  ------------------
  370|  60.4k|                    return object;
  371|  60.4k|                }
  372|   292k|                stack_.pop_back();
  373|   292k|                frame_ = &stack_.back();
  374|   292k|                add(std::move(object));
  375|   292k|            } else {
  376|  3.02k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 2.38k, False: 640]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  2.38k|                    warn("unexpected array close token; giving up on reading object");
  380|  2.38k|                    return {};
  381|  2.38k|                }
  382|    640|                add_bad_null("treating unexpected array close token as null");
  383|    640|            }
  384|   292k|            continue;
  385|       |
  386|   292k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 273k, False: 6.08M]
  ------------------
  387|   273k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 270k, False: 3.01k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   270k|                auto& dict = frame_->dict;
  390|       |
  391|   270k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 10.4k, False: 260k]
  ------------------
  392|  10.4k|                    warn(
  393|  10.4k|                        frame_->offset,
  394|  10.4k|                        "dictionary ended prematurely; using null as value for last key");
  395|  10.4k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  10.4k|                }
  397|   270k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 81.9k, False: 188k]
  ------------------
  398|  81.9k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 79.6k, False: 2.25k]
  ------------------
  399|  79.6k|                        warn(
  400|  79.6k|                            frame_->offset,
  401|  79.6k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  79.6k|                    } else {
  403|  2.25k|                        fix_missing_keys();
  404|  2.25k|                    }
  405|  81.9k|                }
  406|       |
  407|   270k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 245, False: 270k]
  |  Branch (407:21): [True: 19, False: 270k]
  |  Branch (407:57): [True: 176, False: 69]
  ------------------
  408|    176|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 97, False: 79]
  |  Branch (408:62): [True: 29, False: 68]
  ------------------
  409|     29|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 19, False: 10]
  |  Branch (409:51): [True: 19, False: 0]
  ------------------
  410|     19|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     19|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     19|                }
  413|   270k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   270k|                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|   270k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 153k, False: 116k]
  ------------------
  420|   153k|                    return object;
  421|   153k|                }
  422|   116k|                stack_.pop_back();
  423|   116k|                frame_ = &stack_.back();
  424|   116k|                add(std::move(object));
  425|   116k|            } else {
  426|  3.01k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 2.52k, False: 488]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|  2.52k|                    warn("unexpected dictionary close token; giving up on reading object");
  430|  2.52k|                    return {};
  431|  2.52k|                }
  432|    488|                add_bad_null("unexpected dictionary close token");
  433|    488|            }
  434|   117k|            continue;
  435|       |
  436|   364k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 364k, False: 5.99M]
  ------------------
  437|   534k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 170k, False: 6.19M]
  ------------------
  438|   534k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 102, False: 534k]
  ------------------
  439|    102|                limits_error(
  440|    102|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|    102|            }
  442|   534k|            b_contents = false;
  443|   534k|            stack_.emplace_back(
  444|   534k|                input_,
  445|   534k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 364k, False: 170k]
  ------------------
  446|   534k|                                                                       : st_dictionary_key);
  447|   534k|            frame_ = &stack_.back();
  448|   534k|            continue;
  449|       |
  450|  19.6k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 19.6k, False: 6.34M]
  ------------------
  451|  19.6k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  19.6k|            continue;
  453|       |
  454|  95.5k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 95.5k, False: 6.26M]
  ------------------
  455|  95.5k|            add_null();
  456|  95.5k|            continue;
  457|       |
  458|  1.51M|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 1.51M, False: 4.84M]
  ------------------
  459|  1.51M|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 1.04M, False: 470k]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|  1.04M|                last_offset_buffer_[1] = input_.getLastOffset();
  462|  1.04M|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|  1.04M|                int_count_ = 1;
  464|  1.04M|            } else {
  465|   470k|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|   470k|            }
  467|  1.51M|            continue;
  468|       |
  469|   200k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 200k, False: 6.16M]
  ------------------
  470|   200k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|   200k|            continue;
  472|       |
  473|  2.18M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 2.18M, False: 4.18M]
  ------------------
  474|  2.18M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 1.13M, False: 1.05M]
  ------------------
  475|  1.13M|                frame_->key = tokenizer_.getValue();
  476|  1.13M|                frame_->state = st_dictionary_value;
  477|  1.13M|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 49.1k, False: 1.08M]
  |  Branch (477:44): [True: 938, False: 48.1k]
  ------------------
  478|  1.13M|                continue;
  479|  1.13M|            } else {
  480|  1.05M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  1.05M|            }
  482|  1.05M|            continue;
  483|       |
  484|  1.05M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 601k, False: 5.76M]
  ------------------
  485|   601k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 268k, False: 333k]
  ------------------
  486|   268k|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|   268k|                continue;
  488|   268k|            }
  489|       |
  490|   333k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 328k, False: 5.20k]
  ------------------
  491|   328k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 3.80k, False: 324k]
  |  Branch (491:58): [True: 893, False: 323k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  4.69k|                    warn(
  495|  4.69k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  4.69k|                        "reading object");
  497|  4.69k|                    return {};
  498|  4.69k|                }
  499|       |
  500|   323k|                add_bad_null("unknown token while reading object; treating as null");
  501|   323k|                continue;
  502|   328k|            }
  503|       |
  504|  5.20k|            warn("unknown token while reading object; treating as string");
  505|  5.20k|            check_too_many_bad_tokens();
  506|  5.20k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  5.20k|            continue;
  509|       |
  510|   515k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 515k, False: 5.84M]
  ------------------
  511|   515k|            {
  512|   515k|                auto const& val = tokenizer_.getValue();
  513|   515k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 72.0k, False: 443k]
  ------------------
  514|  72.0k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 454, False: 71.6k]
  ------------------
  515|    454|                        frame_->contents_string = val;
  516|    454|                        frame_->contents_offset = input_.getLastOffset();
  517|    454|                        b_contents = false;
  518|    454|                    }
  519|  72.0k|                    std::string s{val};
  520|  72.0k|                    decrypter_->decryptString(s);
  521|  72.0k|                    add_scalar<QPDF_String>(s);
  522|   443k|                } else {
  523|   443k|                    add_scalar<QPDF_String>(val);
  524|   443k|                }
  525|   515k|            }
  526|   515k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 6.36M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  6.36M|        }
  531|  6.36M|    }
  532|   247k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  7.17M|{
  537|  7.17M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 6.11M, False: 1.05M]
  ------------------
  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|  6.11M|        frame_->olist.emplace_back(std::move(obj));
  541|  6.11M|    } else {
  542|  1.05M|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 11.1k, False: 1.04M]
  ------------------
  543|  11.1k|            warn_duplicate_key();
  544|  11.1k|        }
  545|  1.05M|        frame_->state = st_dictionary_key;
  546|  1.05M|    }
  547|  7.17M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   473k|{
  552|   473k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   473k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 422k, False: 50.7k]
  ------------------
  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|   422k|        frame_->olist.emplace_back(null_obj);
  558|   422k|    } else {
  559|  50.7k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 1.27k, False: 49.5k]
  ------------------
  560|  1.27k|            warn_duplicate_key();
  561|  1.27k|        }
  562|  50.7k|        frame_->state = st_dictionary_key;
  563|  50.7k|    }
  564|   473k|    ++frame_->null_count;
  565|   473k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   334k|{
  570|   334k|    warn(msg);
  571|   334k|    check_too_many_bad_tokens();
  572|   334k|    add_null();
  573|   334k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  3.56M|{
  578|  3.56M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  3.56M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  3.56M|    add(std::move(obj));
  581|  3.56M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   622k|{
  611|   622k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 622k, False: 0]
  ------------------
  612|   622k|        obj->setDescription(context_, description_, parsed_offset);
  613|   622k|    }
  614|   622k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  2.25k|{
  619|  2.25k|    std::set<std::string> names;
  620|  7.87k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 7.87k, False: 2.25k]
  ------------------
  621|  7.87k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 202, False: 7.67k]
  ------------------
  622|    202|            names.insert(obj.getName());
  623|    202|        }
  624|  7.87k|    }
  625|  2.25k|    int next_fake_key = 1;
  626|  7.26k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 7.26k, False: 2.25k]
  ------------------
  627|  7.28k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 7.28k, Folded]
  ------------------
  628|  7.28k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  7.28k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 7.26k, False: 18]
  |  Branch (629:68): [True: 7.26k, False: 0]
  ------------------
  630|  7.28k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 7.26k, False: 18]
  ------------------
  631|  7.28k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 7.26k, False: 18]
  ------------------
  632|  7.26k|                warn(
  633|  7.26k|                    frame_->offset,
  634|  7.26k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  7.26k|                frame_->dict[key] = item;
  636|  7.26k|                break;
  637|  7.26k|            }
  638|  7.28k|        }
  639|  7.26k|    }
  640|  2.25k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   405k|{
  645|   405k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 306k, False: 99.3k]
  |  Branch (645:66): [True: 96.7k, False: 2.64k]
  ------------------
  646|   405k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 457, False: 405k]
  |  Branch (646:42): [True: 0, False: 405k]
  ------------------
  647|    457|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 377, False: 80]
  ------------------
  648|    377|            limits_error(
  649|    377|                "parser-max-container-size-damaged",
  650|    377|                "encountered errors while parsing an array or dictionary with more than " +
  651|    377|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    377|        }
  653|    457|        limits_error(
  654|    457|            "parser-max-container-size",
  655|    457|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    457|                " elements during xref recovery; giving up on reading object");
  657|    457|    }
  658|   405k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 405k, False: 457]
  |  Branch (658:27): [True: 1.72k, False: 403k]
  ------------------
  659|  1.72k|        limits_error(
  660|  1.72k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  1.72k|    }
  662|   405k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 161k, False: 244k]
  ------------------
  663|   161k|        good_count_ = 0;
  664|   161k|        bad_count_ = 1;
  665|   161k|        return;
  666|   161k|    }
  667|   244k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 9.06k, False: 235k]
  ------------------
  668|   235k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 137k, False: 97.5k]
  |  Branch (668:39): [True: 2.49k, False: 135k]
  ------------------
  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|  9.38k|        warn("too many errors; giving up on reading object");
  672|  9.38k|        throw Error();
  673|  9.38k|    }
  674|   235k|    good_count_ = 0;
  675|   235k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.28k|{
  680|  2.28k|    Limits::error();
  681|  2.28k|    warn("limits error("s + limit + "): " + msg);
  682|  2.28k|    throw Error();
  683|  2.28k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   570k|{
  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|   570k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 570k, False: 0]
  ------------------
  692|   570k|        context_->warn(e);
  693|   570k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   570k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  12.3k|{
  701|  12.3k|    warn(
  702|  12.3k|        frame_->offset,
  703|  12.3k|        "dictionary has duplicated key " + frame_->key +
  704|  12.3k|            "; last occurrence overrides earlier ones");
  705|  12.3k|    check_too_many_bad_tokens();
  706|  12.3k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   570k|{
  711|   570k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 15.9k, False: 554k]
  ------------------
  712|  15.9k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  15.9k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  15.9k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   554k|    } else {
  716|   554k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   554k|    }
  718|   570k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   460k|{
  723|   460k|    warn(input_.getLastOffset(), msg);
  724|   460k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|  3.99M|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 3.99M, False: 0]
  ------------------
   27|  3.99M|    {
   28|  3.99M|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 3.99M, False: 0]
  ------------------
   29|  3.99M|            objects->inParse(true);
   30|  3.99M|        }
   31|  3.99M|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|  3.99M|    {
   41|  3.99M|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 3.99M, False: 0]
  ------------------
   42|  3.99M|            objects->inParse(false);
   43|  3.99M|        }
   44|  3.99M|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   668k|    {
   36|   668k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   668k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|  1.25k|{
  603|  1.25k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.25k|    obj->setDescription(context_, description_, start_);
  605|  1.25k|    return {obj};
  606|  1.25k|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|   752k|{
  603|   752k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|   752k|    obj->setDescription(context_, description_, start_);
  605|   752k|    return {obj};
  606|   752k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|   271k|{
  603|   271k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|   271k|    obj->setDescription(context_, description_, start_);
  605|   271k|    return {obj};
  606|   271k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.42M|{
  603|  1.42M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.42M|    obj->setDescription(context_, description_, start_);
  605|  1.42M|    return {obj};
  606|  1.42M|}
_ZN4qpdf4impl6Parser16with_descriptionI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.22M|{
  603|  1.22M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.22M|    obj->setDescription(context_, description_, start_);
  605|  1.22M|    return {obj};
  606|  1.22M|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  62.0k|{
  603|  62.0k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  62.0k|    obj->setDescription(context_, description_, start_);
  605|  62.0k|    return {obj};
  606|  62.0k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    244|{
  603|    244|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    244|    obj->setDescription(context_, description_, start_);
  605|    244|    return {obj};
  606|    244|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_BoolJbEEEvDpOT0_:
  586|  19.6k|{
  587|  19.6k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 13.3k, False: 6.29k]
  |  Branch (587:66): [True: 5.12k, False: 1.16k]
  ------------------
  588|  19.6k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 96, False: 19.5k]
  |  Branch (588:42): [True: 0, False: 19.5k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     96|        max_bad_count_ = 1;
  592|     96|        check_too_many_bad_tokens(); // always throws Error()
  593|     96|    }
  594|  19.6k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  19.6k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  19.6k|    add(std::move(obj));
  597|  19.6k|}
_ZN4qpdf4impl6Parser10add_scalarI12QPDF_IntegerJxEEEvDpOT0_:
  586|   470k|{
  587|   470k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 12.7k, False: 457k]
  |  Branch (587:66): [True: 457k, False: 562]
  ------------------
  588|   470k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 26, False: 470k]
  |  Branch (588:42): [True: 0, False: 470k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     26|        max_bad_count_ = 1;
  592|     26|        check_too_many_bad_tokens(); // always throws Error()
  593|     26|    }
  594|   470k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   470k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   470k|    add(std::move(obj));
  597|   470k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   200k|{
  587|   200k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 49.1k, False: 151k]
  |  Branch (587:66): [True: 139k, False: 11.7k]
  ------------------
  588|   200k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 76, False: 200k]
  |  Branch (588:42): [True: 0, False: 200k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     76|        max_bad_count_ = 1;
  592|     76|        check_too_many_bad_tokens(); // always throws Error()
  593|     76|    }
  594|   200k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   200k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   200k|    add(std::move(obj));
  597|   200k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  1.05M|{
  587|  1.05M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 479k, False: 571k]
  |  Branch (587:66): [True: 342k, False: 229k]
  ------------------
  588|  1.05M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 89, False: 1.05M]
  |  Branch (588:42): [True: 0, False: 1.05M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     89|        max_bad_count_ = 1;
  592|     89|        check_too_many_bad_tokens(); // always throws Error()
  593|     89|    }
  594|  1.05M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  1.05M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  1.05M|    add(std::move(obj));
  597|  1.05M|}
_ZN4qpdf4impl6Parser10add_scalarI13QPDF_OperatorJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   268k|{
  587|   268k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 66.5k, False: 201k]
  |  Branch (587:66): [True: 201k, False: 222]
  ------------------
  588|   268k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 39, False: 268k]
  |  Branch (588:42): [True: 0, False: 268k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     39|        max_bad_count_ = 1;
  592|     39|        check_too_many_bad_tokens(); // always throws Error()
  593|     39|    }
  594|   268k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   268k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   268k|    add(std::move(obj));
  597|   268k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|   448k|{
  587|   448k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 110k, False: 337k]
  |  Branch (587:66): [True: 330k, False: 6.99k]
  ------------------
  588|   448k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 90, False: 447k]
  |  Branch (588:42): [True: 0, False: 447k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     90|        max_bad_count_ = 1;
  592|     90|        check_too_many_bad_tokens(); // always throws Error()
  593|     90|    }
  594|   448k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|   448k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|   448k|    add(std::move(obj));
  597|   448k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  72.0k|{
  587|  72.0k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 61.7k, False: 10.3k]
  |  Branch (587:66): [True: 10.2k, False: 124]
  ------------------
  588|  72.0k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 10, False: 72.0k]
  |  Branch (588:42): [True: 0, False: 72.0k]
  ------------------
  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|  72.0k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  72.0k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  72.0k|    add(std::move(obj));
  597|  72.0k|}

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

_ZN4qpdf9Tokenizer5resetEv:
   85|  34.3M|{
   86|  34.3M|    state = st_before_token;
   87|  34.3M|    type = tt::tt_bad;
   88|  34.3M|    val.clear();
   89|  34.3M|    raw_val.clear();
   90|  34.3M|    error_message = "";
   91|  34.3M|    before_token = true;
   92|  34.3M|    in_token = false;
   93|  34.3M|    char_to_unread = '\0';
   94|  34.3M|    inline_image_bytes = 0;
   95|  34.3M|    string_depth = 0;
   96|  34.3M|    bad = false;
   97|  34.3M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  100|    250|    type(type),
  101|    250|    value(value),
  102|    250|    raw_value(value)
  103|    250|{
  104|    250|    if (type == tt_string) {
  ------------------
  |  Branch (104:9): [True: 0, False: 250]
  ------------------
  105|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
  106|    250|    } else if (type == tt_name) {
  ------------------
  |  Branch (106:16): [True: 0, False: 250]
  ------------------
  107|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  108|      0|    }
  109|    250|}
_ZN13QPDFTokenizerC2Ev:
  112|  28.3k|    m(std::make_unique<qpdf::Tokenizer>())
  113|  28.3k|{
  114|  28.3k|}
_ZN13QPDFTokenizerD2Ev:
  116|  28.3k|QPDFTokenizer::~QPDFTokenizer() = default;
_ZN4qpdf9TokenizerC2Ev:
  119|  2.24M|{
  120|  2.24M|    reset();
  121|  2.24M|}
_ZN13QPDFTokenizer8allowEOFEv:
  125|  28.3k|{
  126|  28.3k|    m->allowEOF();
  127|  28.3k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  73.7k|{
  132|  73.7k|    allow_eof = true;
  133|  73.7k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  137|  28.3k|{
  138|  28.3k|    m->includeIgnorable();
  139|  28.3k|}
_ZN4qpdf9Tokenizer16includeIgnorableEv:
  143|  28.3k|{
  144|  28.3k|    include_ignorable = true;
  145|  28.3k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  46.8M|{
  150|  46.8M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 2.71M, False: 44.1M]
  |  Branch (150:27): [True: 17.5M, False: 26.5M]
  ------------------
  151|  46.8M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   261M|{
  156|   261M|    return is_delimiter(ch);
  157|   261M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  29.8k|{
  168|  29.8k|    handleCharacter(ch);
  169|       |
  170|  29.8k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 29.8k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  29.8k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   878M|{
  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|   878M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 878M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|  1.01M|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 1.01M, False: 877M]
  ------------------
  187|  1.01M|        inSpace(ch);
  188|  1.01M|        return;
  189|       |
  190|  2.01M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 2.01M, False: 876M]
  ------------------
  191|  2.01M|        inComment(ch);
  192|  2.01M|        return;
  193|       |
  194|   613k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 613k, False: 878M]
  ------------------
  195|   613k|        inLt(ch);
  196|   613k|        return;
  197|       |
  198|   427k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 427k, False: 878M]
  ------------------
  199|   427k|        inGt(ch);
  200|   427k|        return;
  201|       |
  202|   303M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 303M, False: 575M]
  ------------------
  203|   303M|        inString(ch);
  204|   303M|        return;
  205|       |
  206|   103M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 103M, False: 775M]
  ------------------
  207|   103M|        inName(ch);
  208|   103M|        return;
  209|       |
  210|  20.2M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 20.2M, False: 858M]
  ------------------
  211|  20.2M|        inNumber(ch);
  212|  20.2M|        return;
  213|       |
  214|  5.17M|    case st_real:
  ------------------
  |  Branch (214:5): [True: 5.17M, False: 873M]
  ------------------
  215|  5.17M|        inReal(ch);
  216|  5.17M|        return;
  217|       |
  218|   153k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 153k, False: 878M]
  ------------------
  219|   153k|        inStringAfterCR(ch);
  220|   153k|        return;
  221|       |
  222|   447k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 447k, False: 878M]
  ------------------
  223|   447k|        inStringEscape(ch);
  224|   447k|        return;
  225|       |
  226|   122k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 122k, False: 878M]
  ------------------
  227|   122k|        inCharCode(ch);
  228|   122k|        return;
  229|       |
  230|   148M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 148M, False: 730M]
  ------------------
  231|   148M|        inLiteral(ch);
  232|   148M|        return;
  233|       |
  234|   244M|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 244M, False: 634M]
  ------------------
  235|   244M|        inInlineImage(ch);
  236|   244M|        return;
  237|       |
  238|  1.30M|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 1.30M, False: 877M]
  ------------------
  239|  1.30M|        inHexstring(ch);
  240|  1.30M|        return;
  241|       |
  242|  1.31M|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 1.31M, False: 877M]
  ------------------
  243|  1.31M|        inHexstring2nd(ch);
  244|  1.31M|        return;
  245|       |
  246|  49.2k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 49.2k, False: 878M]
  ------------------
  247|  49.2k|        inNameHex1(ch);
  248|  49.2k|        return;
  249|       |
  250|  23.5k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 23.5k, False: 878M]
  ------------------
  251|  23.5k|        inNameHex2(ch);
  252|  23.5k|        return;
  253|       |
  254|   451k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 451k, False: 878M]
  ------------------
  255|   451k|        inSign(ch);
  256|   451k|        return;
  257|       |
  258|   209k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 209k, False: 878M]
  ------------------
  259|   209k|        inDecimal(ch);
  260|   209k|        return;
  261|       |
  262|  45.6M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 45.6M, False: 833M]
  ------------------
  263|  45.6M|        inBeforeToken(ch);
  264|  45.6M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 878M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 878M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   878M|    }
  273|   878M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  45.6M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  45.6M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 19.7M, False: 25.8M]
  ------------------
  287|  19.7M|        before_token = !include_ignorable;
  288|  19.7M|        in_token = include_ignorable;
  289|  19.7M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 565k, False: 19.2M]
  ------------------
  290|   565k|            state = st_in_space;
  291|   565k|        }
  292|  25.8M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 38.5k, False: 25.8M]
  ------------------
  293|  38.5k|        before_token = !include_ignorable;
  294|  38.5k|        in_token = include_ignorable;
  295|  38.5k|        state = st_in_comment;
  296|  25.8M|    } else {
  297|  25.8M|        before_token = false;
  298|  25.8M|        in_token = true;
  299|  25.8M|        inTop(ch);
  300|  25.8M|    }
  301|  45.6M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  25.8M|{
  306|  25.8M|    switch (ch) {
  307|   631k|    case '(':
  ------------------
  |  Branch (307:5): [True: 631k, False: 25.2M]
  ------------------
  308|   631k|        string_depth = 1;
  309|   631k|        state = st_in_string;
  310|   631k|        return;
  311|       |
  312|   615k|    case '<':
  ------------------
  |  Branch (312:5): [True: 615k, False: 25.2M]
  ------------------
  313|   615k|        state = st_lt;
  314|   615k|        return;
  315|       |
  316|   428k|    case '>':
  ------------------
  |  Branch (316:5): [True: 428k, False: 25.4M]
  ------------------
  317|   428k|        state = st_gt;
  318|   428k|        return;
  319|       |
  320|  30.4k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 30.4k, False: 25.8M]
  ------------------
  321|  30.4k|        type = tt::tt_bad;
  322|  30.4k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|  30.4k|        error_message = "unexpected )";
  324|  30.4k|        state = st_token_ready;
  325|  30.4k|        return;
  326|       |
  327|   510k|    case '[':
  ------------------
  |  Branch (327:5): [True: 510k, False: 25.3M]
  ------------------
  328|   510k|        type = tt::tt_array_open;
  329|   510k|        state = st_token_ready;
  330|   510k|        return;
  331|       |
  332|   421k|    case ']':
  ------------------
  |  Branch (332:5): [True: 421k, False: 25.4M]
  ------------------
  333|   421k|        type = tt::tt_array_close;
  334|   421k|        state = st_token_ready;
  335|   421k|        return;
  336|       |
  337|  7.96k|    case '{':
  ------------------
  |  Branch (337:5): [True: 7.96k, False: 25.8M]
  ------------------
  338|  7.96k|        type = tt::tt_brace_open;
  339|  7.96k|        state = st_token_ready;
  340|  7.96k|        return;
  341|       |
  342|  7.38k|    case '}':
  ------------------
  |  Branch (342:5): [True: 7.38k, False: 25.8M]
  ------------------
  343|  7.38k|        type = tt::tt_brace_close;
  344|  7.38k|        state = st_token_ready;
  345|  7.38k|        return;
  346|       |
  347|  5.56M|    case '/':
  ------------------
  |  Branch (347:5): [True: 5.56M, False: 20.2M]
  ------------------
  348|  5.56M|        state = st_name;
  349|  5.56M|        val += ch;
  350|  5.56M|        return;
  351|       |
  352|  2.12M|    case '0':
  ------------------
  |  Branch (352:5): [True: 2.12M, False: 23.7M]
  ------------------
  353|  3.56M|    case '1':
  ------------------
  |  Branch (353:5): [True: 1.44M, False: 24.4M]
  ------------------
  354|  4.58M|    case '2':
  ------------------
  |  Branch (354:5): [True: 1.01M, False: 24.8M]
  ------------------
  355|  5.30M|    case '3':
  ------------------
  |  Branch (355:5): [True: 717k, False: 25.1M]
  ------------------
  356|  5.88M|    case '4':
  ------------------
  |  Branch (356:5): [True: 587k, False: 25.2M]
  ------------------
  357|  6.44M|    case '5':
  ------------------
  |  Branch (357:5): [True: 555k, False: 25.3M]
  ------------------
  358|  7.64M|    case '6':
  ------------------
  |  Branch (358:5): [True: 1.19M, False: 24.6M]
  ------------------
  359|  8.56M|    case '7':
  ------------------
  |  Branch (359:5): [True: 918k, False: 24.9M]
  ------------------
  360|  9.15M|    case '8':
  ------------------
  |  Branch (360:5): [True: 594k, False: 25.2M]
  ------------------
  361|  9.38M|    case '9':
  ------------------
  |  Branch (361:5): [True: 233k, False: 25.6M]
  ------------------
  362|  9.38M|        state = st_number;
  363|  9.38M|        return;
  364|       |
  365|  8.25k|    case '+':
  ------------------
  |  Branch (365:5): [True: 8.25k, False: 25.8M]
  ------------------
  366|   539k|    case '-':
  ------------------
  |  Branch (366:5): [True: 531k, False: 25.3M]
  ------------------
  367|   539k|        state = st_sign;
  368|   539k|        return;
  369|       |
  370|   256k|    case '.':
  ------------------
  |  Branch (370:5): [True: 256k, False: 25.6M]
  ------------------
  371|   256k|        state = st_decimal;
  372|   256k|        return;
  373|       |
  374|  7.45M|    default:
  ------------------
  |  Branch (374:5): [True: 7.45M, False: 18.4M]
  ------------------
  375|  7.45M|        state = st_literal;
  376|  7.45M|        return;
  377|  25.8M|    }
  378|  25.8M|}
_ZN4qpdf9Tokenizer7inSpaceEc:
  382|  1.01M|{
  383|       |    // We only enter this state if include_ignorable is true.
  384|  1.01M|    if (!isSpace(ch)) {
  ------------------
  |  Branch (384:9): [True: 553k, False: 465k]
  ------------------
  385|   553k|        type = tt::tt_space;
  386|   553k|        in_token = false;
  387|   553k|        char_to_unread = ch;
  388|   553k|        state = st_token_ready;
  389|   553k|    }
  390|  1.01M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  2.01M|{
  395|  2.01M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 6.31k, False: 2.01M]
  |  Branch (395:25): [True: 31.1k, False: 1.98M]
  ------------------
  396|  37.4k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 1.96k, False: 35.4k]
  ------------------
  397|  1.96k|            type = tt::tt_comment;
  398|  1.96k|            in_token = false;
  399|  1.96k|            char_to_unread = ch;
  400|  1.96k|            state = st_token_ready;
  401|  35.4k|        } else {
  402|  35.4k|            state = st_before_token;
  403|  35.4k|        }
  404|  37.4k|    }
  405|  2.01M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   303M|{
  410|   303M|    switch (ch) {
  411|   447k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 447k, False: 303M]
  ------------------
  412|   447k|        state = st_string_escape;
  413|   447k|        return;
  414|       |
  415|  3.09M|    case '(':
  ------------------
  |  Branch (415:5): [True: 3.09M, False: 300M]
  ------------------
  416|  3.09M|        val += ch;
  417|  3.09M|        ++string_depth;
  418|  3.09M|        return;
  419|       |
  420|  1.50M|    case ')':
  ------------------
  |  Branch (420:5): [True: 1.50M, False: 302M]
  ------------------
  421|  1.50M|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 568k, False: 939k]
  ------------------
  422|   568k|            type = tt::tt_string;
  423|   568k|            state = st_token_ready;
  424|   568k|            return;
  425|   568k|        }
  426|       |
  427|   939k|        val += ch;
  428|   939k|        return;
  429|       |
  430|   152k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 152k, False: 303M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   152k|        val += '\n';
  433|   152k|        state = st_string_after_cr;
  434|   152k|        return;
  435|       |
  436|  9.30M|    case '\n':
  ------------------
  |  Branch (436:5): [True: 9.30M, False: 294M]
  ------------------
  437|  9.30M|        val += ch;
  438|  9.30M|        return;
  439|       |
  440|   289M|    default:
  ------------------
  |  Branch (440:5): [True: 289M, False: 14.5M]
  ------------------
  441|   289M|        val += ch;
  442|   289M|        return;
  443|   303M|    }
  444|   303M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|   103M|{
  449|   103M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 4.10M, False: 99.6M]
  ------------------
  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|  4.10M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 544, False: 4.10M]
  ------------------
  457|  4.10M|        in_token = false;
  458|  4.10M|        char_to_unread = ch;
  459|  4.10M|        state = st_token_ready;
  460|  99.6M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 49.2k, False: 99.5M]
  ------------------
  461|  49.2k|        char_code = 0;
  462|  49.2k|        state = st_name_hex1;
  463|  99.5M|    } else {
  464|  99.5M|        val += ch;
  465|  99.5M|    }
  466|   103M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|  49.2k|{
  471|  49.2k|    hex_char = ch;
  472|       |
  473|  49.2k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 23.5k, False: 25.6k]
  ------------------
  474|  23.5k|        char_code = int(hval) << 4;
  475|  23.5k|        state = st_name_hex2;
  476|  25.6k|    } else {
  477|  25.6k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|  25.6k|        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|  25.6k|        val += '\0';
  481|  25.6k|        state = st_name;
  482|  25.6k|        inName(ch);
  483|  25.6k|    }
  484|  49.2k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  23.5k|{
  489|  23.5k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 8.21k, False: 15.2k]
  ------------------
  490|  8.21k|        char_code |= int(hval);
  491|  15.2k|    } else {
  492|  15.2k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  15.2k|        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|  15.2k|        val += '\0';
  496|  15.2k|        val += hex_char;
  497|  15.2k|        state = st_name;
  498|  15.2k|        inName(ch);
  499|  15.2k|        return;
  500|  15.2k|    }
  501|  8.21k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.10k, False: 7.11k]
  ------------------
  502|  1.10k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.10k|        error_message = "null character not allowed in name token";
  504|  1.10k|        val += "#00";
  505|  1.10k|        state = st_name;
  506|  1.10k|        bad = true;
  507|  7.11k|    } else {
  508|  7.11k|        val += char(char_code);
  509|  7.11k|        state = st_name;
  510|  7.11k|    }
  511|  8.21k|}
_ZN4qpdf9Tokenizer6inSignEc:
  515|   451k|{
  516|   451k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 436k, False: 14.3k]
  ------------------
  517|   436k|        state = st_number;
  518|   436k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 2.65k, False: 11.6k]
  ------------------
  519|  2.65k|        state = st_decimal;
  520|  11.6k|    } else {
  521|  11.6k|        state = st_literal;
  522|  11.6k|        inLiteral(ch);
  523|  11.6k|    }
  524|   451k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|   209k|{
  529|   209k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 17.6k, False: 191k]
  ------------------
  530|  17.6k|        state = st_real;
  531|   191k|    } else {
  532|   191k|        state = st_literal;
  533|   191k|        inLiteral(ch);
  534|   191k|    }
  535|   209k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  20.2M|{
  540|  20.2M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 11.4M, False: 8.78M]
  ------------------
  541|  11.4M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 570k, False: 8.21M]
  ------------------
  542|   570k|        state = st_real;
  543|  8.21M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 7.97M, False: 239k]
  ------------------
  544|  7.97M|        type = tt::tt_integer;
  545|  7.97M|        state = st_token_ready;
  546|  7.97M|        in_token = false;
  547|  7.97M|        char_to_unread = ch;
  548|  7.97M|    } else {
  549|   239k|        state = st_literal;
  550|   239k|    }
  551|  20.2M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|  5.17M|{
  556|  5.17M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 4.58M, False: 585k]
  ------------------
  557|  4.58M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 572k, False: 13.0k]
  ------------------
  558|   572k|        type = tt::tt_real;
  559|   572k|        state = st_token_ready;
  560|   572k|        in_token = false;
  561|   572k|        char_to_unread = ch;
  562|   572k|    } else {
  563|  13.0k|        state = st_literal;
  564|  13.0k|    }
  565|  5.17M|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|   447k|{
  569|   447k|    state = st_in_string;
  570|   447k|    switch (ch) {
  571|  9.08k|    case '0':
  ------------------
  |  Branch (571:5): [True: 9.08k, False: 438k]
  ------------------
  572|  9.48k|    case '1':
  ------------------
  |  Branch (572:5): [True: 404, False: 446k]
  ------------------
  573|  29.5k|    case '2':
  ------------------
  |  Branch (573:5): [True: 20.0k, False: 427k]
  ------------------
  574|  51.3k|    case '3':
  ------------------
  |  Branch (574:5): [True: 21.7k, False: 425k]
  ------------------
  575|  52.5k|    case '4':
  ------------------
  |  Branch (575:5): [True: 1.26k, False: 446k]
  ------------------
  576|  52.8k|    case '5':
  ------------------
  |  Branch (576:5): [True: 315, False: 446k]
  ------------------
  577|  68.4k|    case '6':
  ------------------
  |  Branch (577:5): [True: 15.5k, False: 431k]
  ------------------
  578|  71.0k|    case '7':
  ------------------
  |  Branch (578:5): [True: 2.63k, False: 444k]
  ------------------
  579|  71.0k|        state = st_char_code;
  580|  71.0k|        char_code = 0;
  581|  71.0k|        digit_count = 0;
  582|  71.0k|        inCharCode(ch);
  583|  71.0k|        return;
  584|       |
  585|  39.0k|    case 'n':
  ------------------
  |  Branch (585:5): [True: 39.0k, False: 408k]
  ------------------
  586|  39.0k|        val += '\n';
  587|  39.0k|        return;
  588|       |
  589|  9.19k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 9.19k, False: 438k]
  ------------------
  590|  9.19k|        val += '\r';
  591|  9.19k|        return;
  592|       |
  593|   123k|    case 't':
  ------------------
  |  Branch (593:5): [True: 123k, False: 323k]
  ------------------
  594|   123k|        val += '\t';
  595|   123k|        return;
  596|       |
  597|  2.15k|    case 'b':
  ------------------
  |  Branch (597:5): [True: 2.15k, False: 445k]
  ------------------
  598|  2.15k|        val += '\b';
  599|  2.15k|        return;
  600|       |
  601|   109k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 109k, False: 338k]
  ------------------
  602|   109k|        val += '\f';
  603|   109k|        return;
  604|       |
  605|  10.7k|    case '\n':
  ------------------
  |  Branch (605:5): [True: 10.7k, False: 436k]
  ------------------
  606|  10.7k|        return;
  607|       |
  608|    325|    case '\r':
  ------------------
  |  Branch (608:5): [True: 325, False: 446k]
  ------------------
  609|    325|        state = st_string_after_cr;
  610|    325|        return;
  611|       |
  612|  82.0k|    default:
  ------------------
  |  Branch (612:5): [True: 82.0k, False: 365k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  82.0k|        val += ch;
  615|  82.0k|        return;
  616|   447k|    }
  617|   447k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   153k|{
  622|   153k|    state = st_in_string;
  623|   153k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 105k, False: 47.3k]
  ------------------
  624|   105k|        inString(ch);
  625|   105k|    }
  626|   153k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   613k|{
  631|   613k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 528k, False: 85.2k]
  ------------------
  632|   528k|        type = tt::tt_dict_open;
  633|   528k|        state = st_token_ready;
  634|   528k|        return;
  635|   528k|    }
  636|       |
  637|  85.2k|    state = st_in_hexstring;
  638|  85.2k|    inHexstring(ch);
  639|  85.2k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   427k|{
  644|   427k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 383k, False: 44.0k]
  ------------------
  645|   383k|        type = tt::tt_dict_close;
  646|   383k|        state = st_token_ready;
  647|   383k|    } else {
  648|  44.0k|        type = tt::tt_bad;
  649|  44.0k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  44.0k|        error_message = "unexpected >";
  651|  44.0k|        in_token = false;
  652|  44.0k|        char_to_unread = ch;
  653|  44.0k|        state = st_token_ready;
  654|  44.0k|    }
  655|   427k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|   148M|{
  660|   148M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 4.63M, False: 143M]
  ------------------
  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|  4.63M|        in_token = false;
  667|  4.63M|        char_to_unread = ch;
  668|  4.63M|        state = st_token_ready;
  669|  4.63M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 18.2k, False: 4.61M]
  |  Branch (669:39): [True: 5.56k, False: 4.60M]
  ------------------
  670|  4.63M|            ? tt::tt_bool
  671|  4.63M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 97.8k, False: 4.51M]
  ------------------
  672|  4.63M|    }
  673|   148M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|  1.39M|{
  678|  1.39M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 1.31M, False: 81.9k]
  ------------------
  679|  1.31M|        char_code = int(hval) << 4;
  680|  1.31M|        state = st_in_hexstring_2nd;
  681|       |
  682|  1.31M|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 31.4k, False: 50.4k]
  ------------------
  683|  31.4k|        type = tt::tt_string;
  684|  31.4k|        state = st_token_ready;
  685|       |
  686|  50.4k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 23.0k, False: 27.4k]
  ------------------
  687|       |        // ignore
  688|       |
  689|  27.4k|    } else {
  690|  27.4k|        type = tt::tt_bad;
  691|  27.4k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  27.4k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  27.4k|        state = st_token_ready;
  694|  27.4k|    }
  695|  1.39M|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|  1.31M|{
  700|  1.31M|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 1.28M, False: 31.9k]
  ------------------
  701|  1.28M|        val += char(char_code) | hval;
  702|  1.28M|        state = st_in_hexstring;
  703|       |
  704|  1.28M|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 12.2k, False: 19.6k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  12.2k|        val += char(char_code);
  707|  12.2k|        type = tt::tt_string;
  708|  12.2k|        state = st_token_ready;
  709|       |
  710|  19.6k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 10.1k, False: 9.52k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  10.1k|    } else {
  714|  9.52k|        type = tt::tt_bad;
  715|  9.52k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  9.52k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  9.52k|        state = st_token_ready;
  718|  9.52k|    }
  719|  1.31M|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|   193k|{
  724|   193k|    bool handled = false;
  725|   193k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 182k, False: 11.4k]
  |  Branch (725:24): [True: 165k, False: 16.2k]
  ------------------
  726|   165k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|   165k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 122k, False: 43.2k]
  ------------------
  728|   122k|            return;
  729|   122k|        }
  730|  43.2k|        handled = true;
  731|  43.2k|    }
  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|  70.9k|    val += char(char_code % 256);
  735|  70.9k|    state = st_in_string;
  736|  70.9k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 27.6k, False: 43.2k]
  ------------------
  737|  27.6k|        inString(ch);
  738|  27.6k|    }
  739|  70.9k|}
_ZN4qpdf9Tokenizer13inInlineImageEc:
  743|   244M|{
  744|   244M|    if ((raw_val.length() + 1) == inline_image_bytes) {
  ------------------
  |  Branch (744:9): [True: 2.13k, False: 244M]
  ------------------
  745|  2.13k|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  746|  2.13k|        type = tt::tt_inline_image;
  747|  2.13k|        inline_image_bytes = 0;
  748|  2.13k|        state = st_token_ready;
  749|  2.13k|    }
  750|   244M|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|   104k|{
  761|   104k|    switch (state) {
  762|  2.66k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 2.66k, False: 101k]
  ------------------
  763|  2.82k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 168, False: 104k]
  ------------------
  764|  2.88k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 58, False: 104k]
  ------------------
  765|  9.25k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 6.36k, False: 97.8k]
  ------------------
  766|  9.49k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 241, False: 103k]
  ------------------
  767|  9.61k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 123, False: 104k]
  ------------------
  768|  9.74k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 127, False: 104k]
  ------------------
  769|  29.8k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 20.0k, False: 84.1k]
  ------------------
  770|  29.8k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  29.8k|        presentCharacter('\f');
  773|  29.8k|        in_token = true;
  774|  29.8k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 104k]
  ------------------
  777|  56.9k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 56.9k, False: 47.3k]
  ------------------
  778|  56.9k|        type = tt::tt_eof;
  779|  56.9k|        break;
  780|       |
  781|  11.4k|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 11.4k, False: 92.8k]
  ------------------
  782|  11.4k|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 11.4k, False: 0]
  ------------------
  783|  11.4k|        break;
  784|       |
  785|  1.09k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.09k, False: 103k]
  ------------------
  786|  1.09k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 149, False: 944]
  ------------------
  787|  1.09k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 104k]
  ------------------
  790|      0|        break;
  791|       |
  792|  4.96k|    default:
  ------------------
  |  Branch (792:5): [True: 4.96k, False: 99.2k]
  ------------------
  793|  4.96k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  4.96k|        type = tt::tt_bad;
  795|  4.96k|        error_message = "EOF while reading token";
  796|   104k|    }
  797|   104k|    state = st_token_ready;
  798|   104k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  808|    250|{
  809|    250|    m->expectInlineImage(input);
  810|    250|}
_ZN4qpdf9Tokenizer17expectInlineImageER11InputSource:
  814|  2.25k|{
  815|  2.25k|    if (state == st_token_ready) {
  ------------------
  |  Branch (815:9): [True: 2.00k, False: 250]
  ------------------
  816|  2.00k|        reset();
  817|  2.00k|    } else if (state != st_before_token) {
  ------------------
  |  Branch (817:16): [True: 0, False: 250]
  ------------------
  818|      0|        throw std::logic_error(
  819|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  820|      0|    }
  821|  2.25k|    findEI(input);
  822|  2.25k|    before_token = false;
  823|  2.25k|    in_token = true;
  824|  2.25k|    state = st_inline_image;
  825|  2.25k|}
_ZN4qpdf9Tokenizer6findEIER11InputSource:
  829|  2.25k|{
  830|  2.25k|    qpdf_offset_t last_offset = input.getLastOffset();
  831|  2.25k|    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|  2.25k|    bool okay = false;
  841|  2.25k|    bool first_try = true;
  842|  57.2k|    while (!okay) {
  ------------------
  |  Branch (842:12): [True: 55.8k, False: 1.40k]
  ------------------
  843|  55.8k|        QPDFWordTokenFinder f(input, "EI");
  844|  55.8k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (844:13): [True: 853, False: 54.9k]
  ------------------
  845|    853|            break;
  846|    853|        }
  847|  54.9k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  848|       |
  849|  54.9k|        Tokenizer check;
  850|  54.9k|        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|  87.5k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (856:25): [True: 86.1k, False: 1.40k]
  ------------------
  857|  86.1k|            check.nextToken(input, "checker");
  858|  86.1k|            auto typ = check.getType();
  859|  86.1k|            if (typ == tt::tt_eof) {
  ------------------
  |  Branch (859:17): [True: 0, False: 86.1k]
  ------------------
  860|      0|                okay = true;
  861|  86.1k|            } else if (typ == tt::tt_bad) {
  ------------------
  |  Branch (861:24): [True: 6.58k, False: 79.5k]
  ------------------
  862|  6.58k|                found_bad = true;
  863|  79.5k|            } else if (typ == tt::tt_word) {
  ------------------
  |  Branch (863:24): [True: 60.3k, False: 19.1k]
  ------------------
  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|  60.3k|                bool found_alpha = false;
  870|  60.3k|                bool found_non_printable = false;
  871|  60.3k|                bool found_other = false;
  872|   159k|                for (char ch: check.getValue()) {
  ------------------
  |  Branch (872:29): [True: 159k, False: 21.0k]
  ------------------
  873|   159k|                    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '*')) {
  ------------------
  |  Branch (873:26): [True: 7.00k, False: 152k]
  |  Branch (873:39): [True: 4.84k, False: 2.16k]
  |  Branch (873:54): [True: 70.9k, False: 83.8k]
  |  Branch (873:67): [True: 68.3k, False: 2.60k]
  |  Branch (873:81): [True: 517, False: 85.9k]
  ------------------
  874|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  875|       |                        // along with alphabetic characters.
  876|  73.6k|                        found_alpha = true;
  877|  85.9k|                    } else if (static_cast<signed char>(ch) < 32 && !isSpace(ch)) {
  ------------------
  |  Branch (877:32): [True: 39.2k, False: 46.6k]
  |  Branch (877:69): [True: 39.2k, False: 0]
  ------------------
  878|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  879|  39.2k|                        found_non_printable = true;
  880|  39.2k|                        break;
  881|  46.6k|                    } else {
  882|  46.6k|                        found_other = true;
  883|  46.6k|                    }
  884|   159k|                }
  885|  60.3k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (885:21): [True: 39.2k, False: 21.0k]
  |  Branch (885:45): [True: 20.2k, False: 771]
  |  Branch (885:60): [True: 7.68k, False: 12.5k]
  ------------------
  886|  46.9k|                    found_bad = true;
  887|  46.9k|                }
  888|  60.3k|            }
  889|  86.1k|            if (okay || found_bad) {
  ------------------
  |  Branch (889:17): [True: 0, False: 86.1k]
  |  Branch (889:25): [True: 53.5k, False: 32.5k]
  ------------------
  890|  53.5k|                break;
  891|  53.5k|            }
  892|  86.1k|        }
  893|  54.9k|        if (!found_bad) {
  ------------------
  |  Branch (893:13): [True: 1.40k, False: 53.5k]
  ------------------
  894|  1.40k|            okay = true;
  895|  1.40k|        }
  896|  54.9k|        if (!okay) {
  ------------------
  |  Branch (896:13): [True: 53.5k, False: 1.40k]
  ------------------
  897|  53.5k|            first_try = false;
  898|  53.5k|        }
  899|  54.9k|    }
  900|  2.25k|    if (okay && (!first_try)) {
  ------------------
  |  Branch (900:9): [True: 1.40k, False: 853]
  |  Branch (900:17): [True: 333, False: 1.07k]
  ------------------
  901|    333|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  902|    333|    }
  903|       |
  904|       |    input.seek(pos, SEEK_SET);
  905|  2.25k|    input.setLastOffset(last_offset);
  906|  2.25k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  5.59M|{
  917|  5.59M|    bool ready = (state == st_token_ready);
  918|  5.59M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 4.82M, False: 767k]
  |  Branch (918:32): [True: 4.78M, False: 36.8k]
  ------------------
  919|  5.59M|    ch = char_to_unread;
  920|  5.59M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 5.59M, False: 0]
  ------------------
  921|  5.59M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 494k, False: 5.09M]
  |  Branch (921:43): [True: 40.6k, False: 5.05M]
  ------------------
  922|  5.59M|            ? Token(type, raw_val, raw_val, error_message)
  923|  5.59M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  5.59M|        reset();
  926|  5.59M|    }
  927|  5.59M|    return ready;
  928|  5.59M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  945|  1.30M|{
  946|  1.30M|    return m->readToken(input, context, allow_bad, max_len);
  947|  1.30M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  5.59M|{
  959|  5.59M|    nextToken(input, context, max_len);
  960|       |
  961|  5.59M|    Token token;
  962|  5.59M|    bool unread_char;
  963|  5.59M|    char char_to_unread;
  964|  5.59M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  5.59M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 343k, False: 5.24M]
  ------------------
  967|   343k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 343k, False: 0]
  ------------------
  968|   343k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   343k|        } 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|   343k|    }
  978|  5.59M|    return token;
  979|  5.59M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  26.4M|{
  984|  26.4M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 26.4M, False: 2.25k]
  ------------------
  985|  26.4M|        reset();
  986|  26.4M|    }
  987|  26.4M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   905M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 879M, False: 26.4M]
  ------------------
  990|   879M|        char ch;
  991|   879M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 104k, False: 878M]
  ------------------
  992|   104k|            presentEOF();
  993|       |
  994|   104k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 56.9k, False: 47.3k]
  |  Branch (994:41): [True: 95, False: 56.8k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|     95|                type = tt::tt_bad;
  998|     95|                error_message = "unexpected EOF";
  999|     95|                offset = input.getLastOffset();
 1000|     95|            }
 1001|   878M|        } else {
 1002|   878M|            handleCharacter(ch);
 1003|   878M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 21.2M, False: 857M]
  ------------------
 1004|  21.2M|                ++offset;
 1005|  21.2M|            }
 1006|   878M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 839M, False: 39.0M]
  ------------------
 1007|   839M|                raw_val += ch;
 1008|   839M|            }
 1009|   878M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 36.4M, False: 842M]
  |  Branch (1009:28): [True: 6.04M, False: 30.3M]
  |  Branch (1009:61): [True: 5.98M, False: 61.7k]
  ------------------
 1010|       |                // terminate this token now
 1011|  5.98M|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|  5.98M|                type = tt::tt_bad;
 1013|  5.98M|                state = st_token_ready;
 1014|  5.98M|                error_message = "exceeded allowable length while reading token";
 1015|  5.98M|            }
 1016|   878M|        }
 1017|   879M|    }
 1018|       |
 1019|  26.4M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 17.9M, False: 8.57M]
  |  Branch (1019:35): [True: 17.8M, False: 57.8k]
  ------------------
 1020|       |
 1021|  26.4M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 26.4M, False: 56.8k]
  ------------------
 1022|  26.4M|        input.setLastOffset(offset);
 1023|  26.4M|    }
 1024|       |
 1025|  26.4M|    return error_message.empty();
 1026|  26.4M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   261M|{
   26|   261M|    return (
   27|   261M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 9.79M, False: 251M]
  |  Branch (27:22): [True: 2.11M, False: 249M]
  |  Branch (27:36): [True: 2.62M, False: 246M]
  |  Branch (27:49): [True: 325k, False: 246M]
  |  Branch (27:62): [True: 29.6k, False: 246M]
  |  Branch (27:75): [True: 13.2k, False: 246M]
  |  Branch (27:88): [True: 14.2k, False: 246M]
  ------------------
   28|   246M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 210k, False: 246M]
  |  Branch (28:22): [True: 161k, False: 245M]
  |  Branch (28:35): [True: 233k, False: 245M]
  |  Branch (28:48): [True: 267k, False: 245M]
  |  Branch (28:61): [True: 30.6k, False: 245M]
  |  Branch (28:74): [True: 25.9k, False: 245M]
  |  Branch (28:88): [True: 748k, False: 244M]
  ------------------
   29|   244M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 28.7k, False: 244M]
  |  Branch (29:23): [True: 154k, False: 244M]
  |  Branch (29:37): [True: 555k, False: 243M]
  ------------------
   30|   261M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   38|  55.8k|            is(is),
   39|  55.8k|            str(str)
   40|  55.8k|        {
   41|  55.8k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   53|  2.11M|{
   54|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   55|       |    // delimiter or EOF.
   56|  2.11M|    Tokenizer tokenizer;
   57|  2.11M|    tokenizer.nextToken(is, "finder", str.size() + 2);
   58|  2.11M|    qpdf_offset_t pos = is.tell();
   59|  2.11M|    if (tokenizer.getType() != tt::tt_word || tokenizer.getValue() != str) {
  ------------------
  |  Branch (59:9): [True: 1.97M, False: 142k]
  |  Branch (59:47): [True: 87.3k, False: 54.9k]
  ------------------
   60|  2.06M|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   61|  2.06M|        return false;
   62|  2.06M|    }
   63|  54.9k|    qpdf_offset_t token_start = is.getLastOffset();
   64|  54.9k|    char next;
   65|  54.9k|    bool next_okay = false;
   66|  54.9k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (66:9): [True: 13, False: 54.9k]
  ------------------
   67|     13|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   68|     13|        next_okay = true;
   69|  54.9k|    } else {
   70|  54.9k|        next_okay = is_delimiter(next);
   71|  54.9k|    }
   72|  54.9k|    is.seek(pos, SEEK_SET);
   73|  54.9k|    if (!next_okay) {
  ------------------
  |  Branch (73:9): [True: 0, False: 54.9k]
  ------------------
   74|      0|        return false;
   75|      0|    }
   76|  54.9k|    if (token_start == 0) {
  ------------------
  |  Branch (76:9): [True: 0, False: 54.9k]
  ------------------
   77|       |        // Can't actually happen...we never start the search at the beginning of the input.
   78|      0|        return false;
   79|      0|    }
   80|  54.9k|    return true;
   81|  54.9k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   42|  55.8k|        ~QPDFWordTokenFinder() override = default;

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|  42.4k|{
   40|  42.4k|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 447, False: 41.9k]
  ------------------
   41|    447|        sp = std::make_unique<Sparse>();
   42|   104k|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 104k, False: 447]
  ------------------
   43|   104k|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 32.1k, False: 72.0k]
  |  Branch (43:54): [True: 242, False: 71.8k]
  ------------------
   44|  32.4k|                sp->elements[sp->size] = std::move(item);
   45|  32.4k|            }
   46|   104k|            ++sp->size;
   47|   104k|        }
   48|  41.9k|    } else {
   49|  41.9k|        elements = std::move(v);
   50|  41.9k|    }
   51|  42.4k|}
_ZNK4qpdf5Array5arrayEv:
   55|   148k|{
   56|   148k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 148k, False: 0]
  ------------------
   57|   148k|        return a;
   58|   148k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|   148k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  5.84k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  5.84k|{
   67|  5.84k|}
_ZN4qpdf5ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   70|  9.77k|    BaseHandle(QPDFObject::create<QPDF_Array>(std::move(items)))
   71|  9.77k|{
   72|  9.77k|}
_ZN4qpdf5Array5emptyEv:
   76|    886|{
   77|    886|    return Array(std::vector<QPDFObjectHandle>());
   78|    886|}
_ZN4qpdf5Array5beginEv:
   82|   222k|{
   83|   222k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 140k, False: 82.0k]
  ------------------
   84|   140k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 140k, False: 394]
  ------------------
   85|   140k|            return a->elements.begin();
   86|   140k|        }
   87|    394|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 394, False: 0]
  ------------------
   88|    394|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|    394|        }
   90|    394|        return sp_elements->begin();
   91|   140k|    }
   92|  82.0k|    return {};
   93|   222k|}
_ZN4qpdf5Array3endEv:
   97|   222k|{
   98|   222k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 140k, False: 82.0k]
  ------------------
   99|   140k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 140k, False: 394]
  ------------------
  100|   140k|            return a->elements.end();
  101|   140k|        }
  102|    394|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 394]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|    394|        return sp_elements->end();
  106|   140k|    }
  107|  82.0k|    return {};
  108|   222k|}
_ZNK4qpdf5Array4sizeEv:
  178|   316k|{
  179|   316k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 265k, False: 51.4k]
  ------------------
  180|   265k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 71.3k, False: 193k]
  ------------------
  181|   265k|    }
  182|  51.4k|    return 0;
  183|   316k|}
_ZNK4qpdf5ArrayixEm:
  187|  1.17M|{
  188|  1.17M|    static const QPDFObjectHandle null_obj;
  189|  1.17M|    auto a = as<QPDF_Array>();
  190|  1.17M|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 1.92k, False: 1.17M]
  ------------------
  191|  1.92k|        return null_obj;
  192|  1.92k|    }
  193|  1.17M|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 82.2k, False: 1.09M]
  ------------------
  194|  82.2k|        auto const& iter = a->sp->elements.find(n);
  195|  82.2k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 70.3k, False: 11.8k]
  ------------------
  196|  82.2k|    }
  197|  1.09M|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 1.57k, False: 1.09M]
  ------------------
  198|  1.17M|}
_ZNK4qpdf5ArrayixEi:
  202|   996k|{
  203|   996k|    static const QPDFObjectHandle null_obj;
  204|   996k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 2.80k, False: 993k]
  ------------------
  205|  2.80k|        return null_obj;
  206|  2.80k|    }
  207|   993k|    return (*this)[static_cast<size_t>(n)];
  208|   996k|}
_ZNK4qpdf5Array3getEm:
  212|    133|{
  213|    133|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 133]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    133|    auto a = array();
  217|    133|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 133, False: 0]
  ------------------
  218|    133|        return a->elements[n];
  219|    133|    }
  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|    133|}
_ZNK4qpdf5Array3getEi:
  226|    133|{
  227|    133|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 133]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    133|    return get(to_s(n));
  231|    133|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  9.18k|{
  236|  9.18k|    auto a = array();
  237|  9.18k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 397, False: 8.78k]
  ------------------
  238|    397|        std::vector<QPDFObjectHandle> v;
  239|    397|        v.reserve(size());
  240|  19.0k|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 19.0k, False: 397]
  ------------------
  241|  19.0k|            v.resize(item.first, null_oh);
  242|  19.0k|            v.emplace_back(item.second);
  243|  19.0k|        }
  244|    397|        v.resize(size(), null_oh);
  245|    397|        return v;
  246|  8.78k|    } else {
  247|  8.78k|        return a->elements;
  248|  8.78k|    }
  249|  9.18k|}
_ZN4qpdf5Array3setEmRK16QPDFObjectHandle:
  253|     68|{
  254|     68|    if (at >= size()) {
  ------------------
  |  Branch (254:9): [True: 0, False: 68]
  ------------------
  255|      0|        return false;
  256|      0|    }
  257|     68|    auto a = array();
  258|     68|    checkOwnership(oh);
  259|     68|    if (a->sp) {
  ------------------
  |  Branch (259:9): [True: 5, False: 63]
  ------------------
  260|      5|        a->sp->elements[at] = oh;
  261|     63|    } else {
  262|     63|        a->elements[at] = oh;
  263|     63|    }
  264|     68|    return true;
  265|     68|}
_ZN4qpdf5Array3setEiRK16QPDFObjectHandle:
  269|     68|{
  270|     68|    if (at < 0) {
  ------------------
  |  Branch (270:9): [True: 0, False: 68]
  ------------------
  271|      0|        return false;
  272|      0|    }
  273|     68|    return set(to_s(at), oh);
  274|     68|}
_ZN4qpdf5Array6insertEmRK16QPDFObjectHandle:
  290|  7.97k|{
  291|  7.97k|    auto a = array();
  292|  7.97k|    size_t sz = size();
  293|  7.97k|    if (at > sz) {
  ------------------
  |  Branch (293:9): [True: 0, False: 7.97k]
  ------------------
  294|      0|        return false;
  295|      0|    }
  296|  7.97k|    checkOwnership(item);
  297|  7.97k|    if (at == sz) {
  ------------------
  |  Branch (297:9): [True: 7.97k, False: 0]
  ------------------
  298|       |        // As special case, also allow insert beyond the end
  299|  7.97k|        push_back(item);
  300|  7.97k|        return true;
  301|  7.97k|    }
  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|  7.97k|{
  325|  7.97k|    if (at_i < 0) {
  ------------------
  |  Branch (325:9): [True: 0, False: 7.97k]
  ------------------
  326|      0|        return false;
  327|      0|    }
  328|  7.97k|    return insert(to_s(at_i), item);
  329|  7.97k|}
_ZN4qpdf5Array9push_backERK16QPDFObjectHandle:
  333|   127k|{
  334|   127k|    auto a = array();
  335|   127k|    checkOwnership(item);
  336|   127k|    if (a->sp) {
  ------------------
  |  Branch (336:9): [True: 200, False: 127k]
  ------------------
  337|    200|        a->sp->elements[(a->sp->size)++] = item;
  338|   127k|    } else {
  339|   127k|        a->elements.emplace_back(item);
  340|   127k|    }
  341|   127k|}
_ZN4qpdf5Array5eraseEm:
  345|  2.78k|{
  346|  2.78k|    auto a = array();
  347|  2.78k|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 0, False: 2.78k]
  ------------------
  348|      0|        return false;
  349|      0|    }
  350|  2.78k|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 2.78k, False: 0]
  ------------------
  351|  2.78k|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|  2.78k|        return true;
  353|  2.78k|    }
  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|  2.78k|}
_ZN4qpdf5Array5eraseEi:
  373|  2.78k|{
  374|  2.78k|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 2.78k]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|  2.78k|    return erase(to_s(at_i));
  378|  2.78k|}
_ZNK16QPDFObjectHandle14getArrayNItemsEv:
  382|   604k|{
  383|   604k|    auto s = size();
  384|   604k|    if (s > 1 || isArray()) {
  ------------------
  |  Branch (384:9): [True: 602k, False: 1.28k]
  |  Branch (384:18): [True: 1.28k, False: 0]
  ------------------
  385|   604k|        return to_i(s);
  386|   604k|    }
  387|      0|    typeWarning("array", "treating as empty");
  388|      0|    return 0;
  389|   604k|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|   615k|{
  394|   615k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 615k, False: 0]
  ------------------
  395|   615k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 545k, False: 70.0k]
  ------------------
  396|   545k|            return result;
  397|   545k|        }
  398|  70.0k|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 70.0k, False: 0]
  |  Branch (398:23): [True: 70.0k, False: 0]
  ------------------
  399|       |            // sparse array null
  400|  70.0k|            return newNull();
  401|  70.0k|        }
  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|   615k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  83.0k|{
  413|  83.0k|    Array array(*this);
  414|   242k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 242k, False: 80.5k]
  ------------------
  415|   242k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 2.57k, False: 240k]
  ------------------
  416|  2.57k|            return false;
  417|  2.57k|        }
  418|   242k|    }
  419|  80.5k|    return array.size() == 4;
  420|  83.0k|}
_ZNK16QPDFObjectHandle8isMatrixEv:
  424|  12.2k|{
  425|  12.2k|    Array array(*this);
  426|  12.2k|    for (auto const& oh: array) {
  ------------------
  |  Branch (426:24): [True: 2.74k, False: 12.0k]
  ------------------
  427|  2.74k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (427:13): [True: 151, False: 2.59k]
  ------------------
  428|    151|            return false;
  429|    151|        }
  430|  2.74k|    }
  431|  12.0k|    return array.size() == 6;
  432|  12.2k|}
_ZNK16QPDFObjectHandle19getArrayAsRectangleEv:
  436|  46.3k|{
  437|  46.3k|    Array array(*this);
  438|  46.3k|    if (array.size() != 4) {
  ------------------
  |  Branch (438:9): [True: 1.35k, False: 45.0k]
  ------------------
  439|  1.35k|        return {};
  440|  1.35k|    }
  441|  45.0k|    std::array<double, 4> items;
  442|   224k|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (442:24): [True: 179k, False: 44.5k]
  ------------------
  443|   179k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (443:13): [True: 408, False: 179k]
  ------------------
  444|    408|            return {};
  445|    408|        }
  446|   179k|    }
  447|  44.5k|    return {
  448|  44.5k|        std::min(items[0], items[2]),
  449|  44.5k|        std::min(items[1], items[3]),
  450|  44.5k|        std::max(items[0], items[2]),
  451|  44.5k|        std::max(items[1], items[3])};
  452|  45.0k|}
_ZNK16QPDFObjectHandle16getArrayAsMatrixEv:
  456|    332|{
  457|    332|    Array array(*this);
  458|    332|    if (array.size() != 6) {
  ------------------
  |  Branch (458:9): [True: 0, False: 332]
  ------------------
  459|      0|        return {};
  460|      0|    }
  461|    332|    std::array<double, 6> items;
  462|  2.32k|    for (size_t i = 0; i < 6; ++i) {
  ------------------
  |  Branch (462:24): [True: 1.99k, False: 332]
  ------------------
  463|  1.99k|        if (!array[i].getValueAsNumber(items[i])) {
  ------------------
  |  Branch (463:13): [True: 0, False: 1.99k]
  ------------------
  464|      0|            return {};
  465|      0|        }
  466|  1.99k|    }
  467|    332|    return {items[0], items[1], items[2], items[3], items[4], items[5]};
  468|    332|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  8.79k|{
  473|  8.79k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 8.79k, False: 0]
  ------------------
  474|  8.79k|        return array.getAsVector();
  475|  8.79k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  8.79k|}
_ZN16QPDFObjectHandle10appendItemERKS_:
  526|   117k|{
  527|   117k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (527:14): [True: 117k, False: 0]
  ------------------
  528|   117k|        array.push_back(item);
  529|   117k|    } else {
  530|      0|        typeWarning("array", "ignoring attempt to append item");
  531|      0|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item");
  532|      0|    }
  533|   117k|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|   658k|{
  567|   658k|    switch (resolved_type_code()) {
  568|   622k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 622k, False: 36.5k]
  ------------------
  569|   622k|        return as<QPDF_Array>()->size();
  570|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 0, False: 658k]
  ------------------
  571|      0|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 658k]
  ------------------
  572|  9.85k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 9.85k, False: 649k]
  ------------------
  573|  9.85k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 658k]
  ------------------
  574|  9.85k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 658k]
  ------------------
  575|  9.85k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 658k]
  ------------------
  576|  9.85k|        return 0;
  577|    210|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 210, False: 658k]
  ------------------
  578|  3.40k|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 3.19k, False: 655k]
  ------------------
  579|  3.98k|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 582, False: 658k]
  ------------------
  580|  4.00k|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 15, False: 658k]
  ------------------
  581|  26.2k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 22.2k, False: 636k]
  ------------------
  582|  26.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 262, False: 658k]
  ------------------
  583|  26.7k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 210, False: 658k]
  ------------------
  584|  26.7k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 658k]
  ------------------
  585|  26.7k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 658k]
  ------------------
  586|  26.7k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 658k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|   658k|    }
  591|   658k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  2.30k|{
  596|  2.30k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 2.30k, False: 0]
  ------------------
  597|  2.30k|        return Array(obj)[n];
  598|  2.30k|    }
  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.30k|{
  608|  2.30k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 2.30k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  2.30k|    return (*this)[static_cast<size_t>(n)];
  612|  2.30k|}
QPDF_Array.cc:_ZL4to_si:
   15|  10.9k|{
   16|  10.9k|    return static_cast<size_t>(n);
   17|  10.9k|}
_ZNK4qpdf5Array14checkOwnershipERK16QPDFObjectHandle:
   27|   135k|{
   28|   135k|    if (!item) {
  ------------------
  |  Branch (28:9): [True: 0, False: 135k]
  ------------------
   29|      0|        throw std::logic_error("Attempting to add an uninitialized object to a QPDF_Array.");
   30|      0|    }
   31|   135k|    if (qpdf() && item.qpdf() && qpdf() != item.qpdf()) {
  ------------------
  |  Branch (31:9): [True: 750, False: 135k]
  |  Branch (31:19): [True: 654, False: 96]
  |  Branch (31:34): [True: 0, False: 654]
  ------------------
   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|   135k|}
QPDF_Array.cc:_ZL4to_im:
   21|   606k|{
   22|   606k|    return static_cast<int>(n);
   23|   606k|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  16.2k|{
   13|  16.2k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 16.2k, False: 0]
  ------------------
   14|  16.2k|        return d;
   15|  16.2k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  16.2k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|  2.71M|{
   23|  2.71M|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 2.65M, False: 57.7k]
  ------------------
   24|  2.65M|        auto it = d->items.find(key);
   25|  2.65M|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 1.83M, False: 823k]
  ------------------
   26|  1.83M|            return it->second;
   27|  1.83M|        }
   28|  2.65M|    }
   29|   881k|    static const QPDFObjectHandle null_obj;
   30|   881k|    return null_obj;
   31|  2.71M|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|   406k|{
   64|   406k|    return !(*this)[key].null();
   65|   406k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  16.2k|{
  100|  16.2k|    std::set<std::string> result;
  101|  50.2k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 50.2k, False: 16.2k]
  ------------------
  102|  50.2k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 47.1k, False: 3.09k]
  ------------------
  103|  47.1k|            result.insert(iter.first);
  104|  47.1k|        }
  105|  50.2k|    }
  106|  16.2k|    return result;
  107|  16.2k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|  26.7k|{
  118|       |    // no-op if key does not exist
  119|  26.7k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 26.7k, False: 0]
  ------------------
  120|  26.7k|        return d->items.erase(key);
  121|  26.7k|    }
  122|      0|    return 0;
  123|  26.7k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|   293k|{
  141|   293k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 293k, False: 22]
  ------------------
  142|   293k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 77.9k, False: 215k]
  |  Branch (142:29): [True: 64.0k, False: 13.8k]
  ------------------
  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|  64.0k|            d->items.erase(key);
  147|   229k|        } else {
  148|       |            // add or replace value
  149|   229k|            d->items[key] = value;
  150|   229k|        }
  151|   293k|        return true;
  152|   293k|    }
  153|     22|    return false;
  154|   293k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|   277k|{
  173|   277k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 277k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|   277k|}
_ZN4qpdf10DictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  179|  84.7k|    BaseDictionary(std::move(dict))
  180|  84.7k|{
  181|  84.7k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|   395k|    BaseDictionary(obj)
  185|   395k|{
  186|   395k|}
_ZN4qpdf10Dictionary5emptyEv:
  190|  30.1k|{
  191|  30.1k|    return Dictionary(std::map<std::string, QPDFObjectHandle>());
  192|  30.1k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|   235k|{
  197|   235k|    auto qpdf = getOwningQPDF();
  198|   235k|    auto item_qpdf = item.getOwningQPDF();
  199|   235k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 150k, False: 85.1k]
  |  Branch (199:17): [True: 32.3k, False: 117k]
  |  Branch (199:30): [True: 0, False: 32.3k]
  ------------------
  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|   235k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|   317k|{
  209|   317k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 317k, False: 224]
  ------------------
  210|   317k|        return dict.contains(key);
  211|   317k|    } else {
  212|    224|        typeWarning("dictionary", "returning false for a key containment request");
  213|    224|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    224|        return false;
  215|    224|    }
  216|   317k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   941k|{
  221|   941k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 633k, False: 308k]
  ------------------
  222|   633k|        return result;
  223|   633k|    }
  224|   308k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 308k, False: 249]
  ------------------
  225|   308k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|   308k|        return QPDF_Null::create(obj, msg, key);
  227|   308k|    }
  228|    249|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|    249|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|    249|    return QPDF_Null::create(obj, msg, "");
  231|   308k|}
_ZNK16QPDFObjectHandle12getKeyIfDictERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  235|  19.4k|{
  236|  19.4k|    return isNull() ? newNull() : getKey(key);
  ------------------
  |  Branch (236:12): [True: 224, False: 19.2k]
  ------------------
  237|  19.4k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  16.4k|{
  242|  16.4k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 16.2k, False: 258]
  ------------------
  243|  16.2k|        return dict.getKeys();
  244|  16.2k|    }
  245|    258|    typeWarning("dictionary", "treating as empty");
  246|    258|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    258|    return {};
  248|  16.4k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|   245k|{
  264|   245k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 235k, False: 9.95k]
  ------------------
  265|   235k|        checkOwnership(value);
  266|   235k|        dict.replace(key, value);
  267|   235k|        return;
  268|   235k|    }
  269|  9.95k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  9.95k|}
_ZN16QPDFObjectHandle19replaceKeyAndGetNewERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  274|  11.9k|{
  275|  11.9k|    replaceKey(key, value);
  276|  11.9k|    return value;
  277|  11.9k|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|  21.8k|{
  290|  21.8k|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 11.3k, False: 10.4k]
  |  Branch (290:23): [True: 10.4k, False: 0]
  ------------------
  291|  21.8k|        return;
  292|  21.8k|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  26.8k|    Common(common),
  127|  26.8k|    copier_(std::make_shared<Copier>(*this))
  128|  26.8k|{
  129|  26.8k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  41.9k|{
  226|  41.9k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 41.9k]
  ------------------
  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|  41.9k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 20.0k, False: 21.9k]
  ------------------
  236|  20.0k|        return SF_FlateLzwDecode::flate_factory;
  237|  20.0k|    }
  238|  21.9k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 401, False: 21.5k]
  ------------------
  239|    401|        return []() { return std::make_shared<SF_Crypt>(); };
  240|    401|    }
  241|  21.5k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 1.44k, False: 20.1k]
  ------------------
  242|  1.44k|        return SF_FlateLzwDecode::lzw_factory;
  243|  1.44k|    }
  244|  20.1k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 713, False: 19.3k]
  ------------------
  245|    713|        return SF_RunLengthDecode::factory;
  246|    713|    }
  247|  19.3k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 2.68k, False: 16.7k]
  ------------------
  248|  2.68k|        return SF_DCTDecode::factory;
  249|  2.68k|    }
  250|  16.7k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 4.51k, False: 12.1k]
  ------------------
  251|  4.51k|        return SF_ASCII85Decode::factory;
  252|  4.51k|    }
  253|  12.1k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 86, False: 12.1k]
  ------------------
  254|     86|        return SF_ASCIIHexDecode::factory;
  255|     86|    }
  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|  12.1k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 2.07k, False: 10.0k]
  ------------------
  261|  2.07k|        return SF_FlateLzwDecode::flate_factory;
  262|  2.07k|    }
  263|  10.0k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 643, False: 9.38k]
  ------------------
  264|    643|        return SF_ASCIIHexDecode::factory;
  265|    643|    }
  266|  9.38k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 235, False: 9.15k]
  ------------------
  267|    235|        return SF_ASCII85Decode::factory;
  268|    235|    }
  269|  9.15k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 7.50k, False: 1.64k]
  ------------------
  270|  7.50k|        return SF_FlateLzwDecode::lzw_factory;
  271|  7.50k|    }
  272|  1.64k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 1.20k, False: 439]
  ------------------
  273|  1.20k|        return SF_RunLengthDecode::factory;
  274|  1.20k|    }
  275|    439|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 41, False: 398]
  ------------------
  276|     41|        return SF_DCTDecode::factory;
  277|     41|    }
  278|    398|    return nullptr;
  279|    439|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  53.8k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  53.8k|{
  285|  53.8k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  53.8k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  53.8k|    obj->setDescription(&qpdf, descr, offset);
  288|  53.8k|    setDictDescription();
  289|  53.8k|}
_ZN4qpdf6Stream4copyEv:
  293|  1.01k|{
  294|  1.01k|    Stream result = qpdf()->newStream();
  295|  1.01k|    result.stream()->stream_dict = getDict().copy();
  296|  1.01k|    copy_data_to(result);
  297|  1.01k|    return result;
  298|  1.01k|}
_ZN4qpdf6Stream12copy_data_toERS0_:
  302|  1.01k|{
  303|  1.01k|    qpdf_expect(dest);
  ------------------
  |  |   13|  1.01k|#define qpdf_expect assert
  ------------------
  |  Branch (303:5): [True: 1.01k, False: 0]
  ------------------
  304|  1.01k|    auto s = stream();
  305|  1.01k|    auto& d_streams = dest.qpdf()->doc().objects().streams();
  306|       |
  307|  1.01k|    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|  1.01k|    if (qpdf()->doc().config().immediate_copy_from() && !s->stream_data) {
  ------------------
  |  Branch (311:9): [True: 0, False: 1.01k]
  |  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|  1.01k|    if (s->stream_data) {
  ------------------
  |  Branch (318:9): [True: 22, False: 990]
  ------------------
  319|     22|        dest.replaceStreamData(s->stream_data, dict["/Filter"], dict["/DecodeParms"]);
  320|    990|    } else {
  321|    990|        d_streams.copier()->register_copy(dest, *this, s->stream_provider.get());
  322|    990|        dest.replaceStreamData(d_streams.copier(), dict["/Filter"], dict["/DecodeParms"]);
  323|    990|    }
  324|  1.01k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  61.6k|{
  452|  61.6k|    auto s = stream();
  453|  61.6k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 29.1k, False: 32.4k]
  ------------------
  454|  29.1k|        s->stream_dict.setObjectDescription(
  455|  29.1k|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|  29.1k|    }
  457|  61.6k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  24.8k|{
  462|  24.8k|    std::string result;
  463|  24.8k|    pl::String buf(result);
  464|  24.8k|    bool filtered;
  465|  24.8k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  24.8k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 3.96k, False: 20.8k]
  ------------------
  467|  3.96k|        throw QPDFExc(
  468|  3.96k|            qpdf_e_unsupported,
  469|  3.96k|            qpdf()->getFilename(),
  470|  3.96k|            "",
  471|  3.96k|            offset(),
  472|  3.96k|            "getStreamData called on unfilterable stream");
  473|  3.96k|    }
  474|  20.8k|    return result;
  475|  24.8k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  41.3k|{
  496|  41.3k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 41.2k, False: 97]
  ------------------
  497|  41.2k|        return false;
  498|  41.2k|    }
  499|     97|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  41.3k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  64.8k|{
  507|  64.8k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  64.8k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  64.8k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 36.6k, False: 28.2k]
  ------------------
  513|       |        // No filters
  514|  36.6k|        return true;
  515|  36.6k|    }
  516|  28.2k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 44, False: 28.1k]
  ------------------
  517|     44|        global::Limits::error();
  518|     44|        warn(
  519|     44|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|     44|            "not filterable");
  521|     44|        return false;
  522|     44|    }
  523|  28.1k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 21.3k, False: 6.84k]
  ------------------
  524|       |        // One filter
  525|  21.3k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  21.3k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 180, False: 21.1k]
  ------------------
  527|    180|            return false;
  528|    180|        }
  529|  21.1k|        filters.emplace_back(ff());
  530|  21.1k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 6.82k, False: 17]
  ------------------
  531|       |        // Potentially multiple filters
  532|  20.6k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 20.6k, False: 6.58k]
  ------------------
  533|  20.6k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 29, False: 20.6k]
  ------------------
  534|     29|                warn("stream filter type is not name or array");
  535|     29|                return false;
  536|     29|            }
  537|  20.6k|            auto ff = s->filter_factory(item);
  538|  20.6k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 218, False: 20.4k]
  ------------------
  539|    218|                filters.clear();
  540|    218|                return false;
  541|    218|            }
  542|  20.4k|            filters.emplace_back(ff());
  543|  20.4k|        }
  544|  6.82k|    } else {
  545|     17|        warn("stream filter type is not name or array");
  546|     17|        return false;
  547|     17|    }
  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|  27.7k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  27.7k|    auto can_filter = // linebreak
  555|  27.7k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  27.7k|        if (!filter.setDecodeParms(d_obj) ||
  557|  27.7k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  27.7k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  27.7k|            return false;
  560|  27.7k|        }
  561|  27.7k|        return true;
  562|  27.7k|    };
  563|       |
  564|  27.7k|    auto decode_array = decode_obj.as_array(strict);
  565|  27.7k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 27.6k, False: 121]
  |  Branch (565:26): [True: 14, False: 107]
  ------------------
  566|  27.6k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 14, False: 27.6k]
  ------------------
  567|     14|            decode_obj = QPDFObjectHandle::newNull();
  568|     14|        }
  569|       |
  570|  40.3k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 40.3k, False: 27.2k]
  ------------------
  571|  40.3k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 378, False: 39.9k]
  ------------------
  572|    378|                return false;
  573|    378|            }
  574|  40.3k|        }
  575|  27.6k|    } 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|    107|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 103, False: 4]
  |  Branch (578:13): [True: 11, False: 96]
  |  Branch (578:33): [True: 11, False: 92]
  ------------------
  579|     11|            warn("stream /DecodeParms length is inconsistent with filters");
  580|     11|            return false;
  581|     11|        }
  582|       |
  583|     96|        int i = -1;
  584|    133|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 133, False: 82]
  ------------------
  585|    133|            auto d_obj = decode_array.get(++i);
  586|    133|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 14, False: 119]
  ------------------
  587|     14|                return false;
  588|     14|            }
  589|    133|        }
  590|     96|    }
  591|       |
  592|  27.3k|    return true;
  593|  27.7k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  64.8k|{
  604|  64.8k|    auto s = stream();
  605|  64.8k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  64.8k|    bool ignored;
  607|  64.8k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 64.8k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  64.8k|    bool& filter = *filterp;
  611|       |
  612|  64.8k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 60.2k, False: 4.64k]
  |  Branch (612:54): [True: 40.4k, False: 19.8k]
  |  Branch (612:73): [True: 4.13k, False: 36.2k]
  ------------------
  613|  64.8k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 19.8k, False: 45.0k]
  |  Branch (613:54): [True: 221, False: 19.6k]
  ------------------
  614|  64.8k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 4.13k, False: 60.7k]
  |  Branch (614:40): [True: 221, False: 60.5k]
  ------------------
  615|       |
  616|  64.8k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 4.13k, False: 60.7k]
  |  Branch (616:25): [True: 221, False: 60.5k]
  ------------------
  617|  4.35k|        filter = true;
  618|  4.35k|    }
  619|       |
  620|  64.8k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 4.35k, False: 60.5k]
  |  Branch (620:23): [True: 0, False: 60.5k]
  |  Branch (620:39): [True: 60.5k, False: 0]
  ------------------
  621|  64.8k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 64.8k, False: 0]
  ------------------
  622|  64.8k|        filter = filterable(decode_level, filters);
  623|  64.8k|    }
  624|       |
  625|  64.8k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 64.8k]
  ------------------
  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|  64.8k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  64.8k|    ContentNormalizer normalizer;
  637|  64.8k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 63.9k, False: 894]
  ------------------
  638|  63.9k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 63.9k]
  ------------------
  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|  63.9k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 0, False: 63.9k]
  ------------------
  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|  63.9k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 63.9k]
  ------------------
  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|   104k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 40.0k, False: 63.9k]
  ------------------
  660|  40.0k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 39.8k, False: 234]
  ------------------
  661|  39.8k|                pipeline = decode_pipeline;
  662|  39.8k|            }
  663|  40.0k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  40.0k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 21.9k, False: 18.1k]
  ------------------
  665|  21.9k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  21.9k|            }
  667|  40.0k|        }
  668|  63.9k|    }
  669|       |
  670|  64.8k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 19.8k, False: 45.0k]
  ------------------
  671|  19.8k|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  672|  19.8k|        pipeline->write(s->stream_data->getBuffer(), s->stream_data->getSize());
  673|  19.8k|        pipeline->finish();
  674|  45.0k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 4.64k, False: 40.4k]
  ------------------
  675|  4.64k|        Pl_Count count("stream provider count", pipeline);
  676|  4.64k|        if (s->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (676:13): [True: 0, False: 4.64k]
  ------------------
  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.64k|        } else {
  683|  4.64k|            s->stream_provider->provideStreamData(obj->getObjGen(), &count);
  684|  4.64k|        }
  685|  4.64k|        qpdf_offset_t actual_length = count.getCount();
  686|  4.64k|        if (auto desired_length = Length()) {
  ------------------
  |  Branch (686:18): [True: 0, False: 4.64k]
  ------------------
  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.64k|        } else {
  696|  4.64k|            Length(actual_length);
  697|  4.64k|        }
  698|  40.4k|    } else {
  699|  40.4k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 40.4k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  40.4k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 4.19k, False: 36.2k]
  ------------------
  703|  40.4k|                qpdf(),
  704|  40.4k|                id_gen(),
  705|  40.4k|                offset(),
  706|  40.4k|                s->length,
  707|  40.4k|                s->stream_dict,
  708|  40.4k|                isRootMetadata(),
  709|  40.4k|                pipeline,
  710|  40.4k|                suppress_warnings,
  711|  40.4k|                will_retry)) {
  712|  4.19k|            filter = false;
  713|  4.19k|            return false;
  714|  4.19k|        }
  715|  40.4k|    }
  716|       |
  717|  60.6k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 59.3k, False: 1.30k]
  |  Branch (717:19): [True: 59.3k, False: 0]
  |  Branch (717:41): [True: 0, False: 59.3k]
  ------------------
  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|  60.6k|    return true;
  733|  64.8k|}
_ZN4qpdf6Stream17replaceStreamDataEONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERK16QPDFObjectHandleSB_:
  738|  30.2k|{
  739|  30.2k|    auto s = stream();
  740|  30.2k|    s->stream_data = std::make_shared<Buffer>(std::move(data));
  741|  30.2k|    s->stream_provider = nullptr;
  742|  30.2k|    replaceFilterData(filter, decode_parms, s->stream_data->getSize());
  743|  30.2k|}
_ZN4qpdf6Stream17replaceStreamDataENSt3__110shared_ptrI6BufferEERK16QPDFObjectHandleS7_:
  750|     22|{
  751|     22|    auto s = stream();
  752|     22|    s->stream_data = data;
  753|     22|    s->stream_provider = nullptr;
  754|     22|    replaceFilterData(filter, decode_parms, data->size());
  755|     22|}
_ZN4qpdf6Stream17replaceStreamDataENSt3__110shared_ptrIN16QPDFObjectHandle18StreamDataProviderEEERKS3_S7_:
  762|  5.63k|{
  763|  5.63k|    auto s = stream();
  764|  5.63k|    s->stream_provider = provider;
  765|  5.63k|    s->stream_data = nullptr;
  766|  5.63k|    replaceFilterData(filter, decode_parms, 0);
  767|  5.63k|}
_ZN4qpdf6Stream17replaceFilterDataERK16QPDFObjectHandleS3_m:
  772|  35.9k|{
  773|  35.9k|    auto s = stream();
  774|  35.9k|    if (filter) {
  ------------------
  |  Branch (774:9): [True: 20.1k, False: 15.8k]
  ------------------
  775|  20.1k|        s->stream_dict.replaceKey("/Filter", filter);
  776|  20.1k|    }
  777|  35.9k|    if (decode_parms) {
  ------------------
  |  Branch (777:9): [True: 19.2k, False: 16.7k]
  ------------------
  778|  19.2k|        s->stream_dict.replaceKey("/DecodeParms", decode_parms);
  779|  19.2k|    }
  780|  35.9k|    if (length == 0) {
  ------------------
  |  Branch (780:9): [True: 5.87k, False: 30.0k]
  ------------------
  781|  5.87k|        s->stream_dict.removeKey("/Length");
  782|  30.0k|    } else {
  783|  30.0k|        Length(length);
  784|  30.0k|    }
  785|  35.9k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  13.4k|{
  790|  13.4k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  13.4k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  54.9k|{
  796|  54.9k|    return as_stream(error).getDict();
  797|  54.9k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  6.89k|{
  832|  6.89k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  6.89k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
  861|  40.0k|{
  862|  40.0k|    bool filtering_attempted;
  863|  40.0k|    as_stream(error).pipeStreamData(
  864|  40.0k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
  865|  40.0k|    return filtering_attempted;
  866|  40.0k|}
_ZN16QPDFObjectHandle17replaceStreamDataERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_SA_:
  897|  15.7k|{
  898|  15.7k|    std::string s(data);
  899|  15.7k|    as_stream(error).replaceStreamData(std::move(s), filter, decode_parms);
  900|  15.7k|}
_ZN16QPDFObjectHandle17replaceStreamDataENSt3__110shared_ptrINS_18StreamDataProviderEEERKS_S5_:
  907|  4.64k|{
  908|  4.64k|    as_stream(error).replaceStreamData(provider, filter, decode_parms);
  909|  4.64k|}
_ZN4QPDF3Doc7Objects7Streams6Copier13register_copyERN4qpdf6StreamES6_b:
  109|    990|    {
  110|    990|        qpdf_expect(source);
  ------------------
  |  |   13|    990|#define qpdf_expect assert
  ------------------
  |  Branch (110:9): [True: 990, False: 0]
  ------------------
  111|    990|        qpdf_expect(dest);
  ------------------
  |  |   13|    990|#define qpdf_expect assert
  ------------------
  |  Branch (111:9): [True: 990, False: 0]
  ------------------
  112|    990|        if (provider) {
  ------------------
  |  Branch (112:13): [True: 0, False: 990]
  ------------------
  113|      0|            copied_streams.insert_or_assign(dest, source);
  114|    990|        } else {
  115|    990|            copied_data.insert_or_assign(dest, Data(source, dest.getDict()));
  116|    990|        }
  117|    990|    }
_ZN4QPDF3Doc7Objects7Streams6Copier4DataC2ERN4qpdf6StreamERKNS5_10DictionaryE:
   38|    990|            encp(source.qpdf()->m->encp),
   39|    990|            file(source.qpdf()->m->file),
   40|    990|            source_og(source.id_gen()),
   41|    990|            offset(source.offset()),
   42|    990|            length(source.getLength()),
   43|    990|            dest_dict(dest_dict),
   44|    990|            is_root_metadata(source.isRootMetadata())
   45|    990|        {
   46|    990|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  40.4k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  40.4k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 379, False: 40.1k]
  |  Branch (556:13): [True: 392, False: 40.0k]
  ------------------
  557|  40.1k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 36.0k, False: 4.06k]
  |  Branch (557:39): [True: 16, False: 36.0k]
  ------------------
  558|  40.0k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 0, False: 40.0k]
  |  Branch (558:47): [True: 0, False: 0]
  ------------------
  559|    392|            return false;
  560|    392|        }
  561|  40.0k|        return true;
  562|  40.4k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  26.8k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  26.8k|        streams(streams)
   69|  26.8k|    {
   70|  26.8k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  26.8k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|    401|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|    401|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|    366|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|    366|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 287, False: 79]
  ------------------
  144|  1.07k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 1.07k, False: 107]
  ------------------
  145|  1.07k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 134, False: 937]
  |  Branch (145:25): [True: 79, False: 992]
  ------------------
  146|    134|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 11, False: 123]
  |  Branch (146:42): [True: 68, False: 55]
  ------------------
  147|     79|                        continue;
  148|     79|                    }
  149|    992|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 135, False: 857]
  ------------------
  150|    135|                        continue;
  151|    135|                    }
  152|    857|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 180, False: 677]
  ------------------
  153|    180|                        return false;
  154|    180|                    }
  155|    857|                }
  156|    107|                return true;
  157|    287|            }
  158|     79|            return decode_parms.null();
  159|    366|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|    175|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|    175|            return nullptr;
  166|    175|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  13.3k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZN11QPDF_String9writeJSONEiRN4JSON6WriterE:
   18|  25.4k|{
   19|  25.4k|    if (json_version == 1) {
  ------------------
  |  Branch (19:9): [True: 0, False: 25.4k]
  ------------------
   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|  25.4k|    if (util::is_utf16(val)) {
  ------------------
  |  Branch (34:9): [True: 1.51k, False: 23.8k]
  ------------------
   35|  1.51k|        p << "\"u:" << JSON::Writer::encode_string(QUtil::utf16_to_utf8(val)) << "\"";
   36|  1.51k|        return;
   37|  1.51k|    }
   38|       |    // See if we can unambiguously represent as Unicode.
   39|  23.8k|    if (util::is_explicit_utf8(val)) {
  ------------------
  |  Branch (39:9): [True: 971, False: 22.9k]
  ------------------
   40|    971|        p << "\"u:" << JSON::Writer::encode_string(val.substr(3)) << "\"";
   41|    971|        return;
   42|    971|    }
   43|  22.9k|    if (!useHexString()) {
  ------------------
  |  Branch (43:9): [True: 10.0k, False: 12.8k]
  ------------------
   44|  10.0k|        auto candidate = QUtil::pdf_doc_to_utf8(val);
   45|  10.0k|        std::string test;
   46|  10.0k|        if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && test == val) {
  ------------------
  |  Branch (46:13): [True: 10.0k, False: 0]
  |  Branch (46:61): [True: 9.79k, False: 292]
  ------------------
   47|       |            // This is a PDF-doc string that can be losslessly encoded as Unicode.
   48|  9.79k|            p << "\"u:" << JSON::Writer::encode_string(candidate) << "\"";
   49|  9.79k|            return;
   50|  9.79k|        }
   51|  10.0k|    }
   52|  13.1k|    p << "\"b:" << QUtil::hex_encode(val) << "\"";
   53|  13.1k|}
_ZNK11QPDF_String12useHexStringEv:
   57|   154k|{
   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|   154k|    unsigned int non_ascii = 0;
   62|  55.0M|    for (auto const ch: val) {
  ------------------
  |  Branch (62:23): [True: 55.0M, False: 102k]
  ------------------
   63|  55.0M|        if (ch > 126) {
  ------------------
  |  Branch (63:13): [True: 179k, False: 54.8M]
  ------------------
   64|   179k|            ++non_ascii;
   65|  54.8M|        } else if (ch >= 32) {
  ------------------
  |  Branch (65:20): [True: 8.50M, False: 46.3M]
  ------------------
   66|  8.50M|            continue;
   67|  46.3M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (67:20): [True: 3.96M, False: 42.3M]
  |  Branch (67:30): [True: 20.5k, False: 42.3M]
  ------------------
   68|  3.98M|            ++non_ascii;
   69|  42.3M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (69:22): [True: 499k, False: 41.8M]
  |  Branch (69:36): [True: 6.56k, False: 41.8M]
  |  Branch (69:50): [True: 41.5M, False: 285k]
  |  Branch (69:64): [True: 38.4k, False: 246k]
  |  Branch (69:78): [True: 193k, False: 52.7k]
  ------------------
   70|  52.7k|            return true;
   71|  52.7k|        }
   72|  55.0M|    }
   73|   102k|    return 5 * non_ascii > val.length();
   74|   154k|}
_ZN11QPDF_String7unparseEb:
   78|   131k|{
   79|   131k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (79:26): [True: 0, False: 131k]
  |  Branch (79:42): [True: 60.5k, False: 71.3k]
  ------------------
   80|   131k|    std::string result;
   81|   131k|    if (use_hexstring) {
  ------------------
  |  Branch (81:9): [True: 60.5k, False: 71.3k]
  ------------------
   82|  60.5k|        static auto constexpr hexchars = "0123456789abcdef";
   83|  60.5k|        result.reserve(2 * val.length() + 2);
   84|  60.5k|        result += '<';
   85|  22.7M|        for (const char c: val) {
  ------------------
  |  Branch (85:26): [True: 22.7M, False: 60.5k]
  ------------------
   86|  22.7M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
   87|  22.7M|            result += hexchars[c & 0x0f];
   88|  22.7M|        }
   89|  60.5k|        result += '>';
   90|  71.3k|    } else {
   91|  71.3k|        result += "(";
   92|  42.3M|        for (unsigned int i = 0; i < val.length(); ++i) {
  ------------------
  |  Branch (92:34): [True: 42.3M, False: 71.3k]
  ------------------
   93|  42.3M|            char ch = val.at(i);
   94|  42.3M|            switch (ch) {
   95|   288k|            case '\n':
  ------------------
  |  Branch (95:13): [True: 288k, False: 42.0M]
  ------------------
   96|   288k|                result += "\\n";
   97|   288k|                break;
   98|       |
   99|  4.34k|            case '\r':
  ------------------
  |  Branch (99:13): [True: 4.34k, False: 42.3M]
  ------------------
  100|  4.34k|                result += "\\r";
  101|  4.34k|                break;
  102|       |
  103|  33.5M|            case '\t':
  ------------------
  |  Branch (103:13): [True: 33.5M, False: 8.79M]
  ------------------
  104|  33.5M|                result += "\\t";
  105|  33.5M|                break;
  106|       |
  107|  23.0k|            case '\b':
  ------------------
  |  Branch (107:13): [True: 23.0k, False: 42.3M]
  ------------------
  108|  23.0k|                result += "\\b";
  109|  23.0k|                break;
  110|       |
  111|   121k|            case '\f':
  ------------------
  |  Branch (111:13): [True: 121k, False: 42.2M]
  ------------------
  112|   121k|                result += "\\f";
  113|   121k|                break;
  114|       |
  115|  13.7k|            case '(':
  ------------------
  |  Branch (115:13): [True: 13.7k, False: 42.3M]
  ------------------
  116|  13.7k|                result += "\\(";
  117|  13.7k|                break;
  118|       |
  119|  13.9k|            case ')':
  ------------------
  |  Branch (119:13): [True: 13.9k, False: 42.3M]
  ------------------
  120|  13.9k|                result += "\\)";
  121|  13.9k|                break;
  122|       |
  123|  13.9k|            case '\\':
  ------------------
  |  Branch (123:13): [True: 13.9k, False: 42.3M]
  ------------------
  124|  13.9k|                result += "\\\\";
  125|  13.9k|                break;
  126|       |
  127|  8.31M|            default:
  ------------------
  |  Branch (127:13): [True: 8.31M, False: 34.0M]
  ------------------
  128|  8.31M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (128:21): [True: 5.77M, False: 2.54M]
  ------------------
  129|  5.77M|                    result += val.at(i);
  130|  5.77M|                } else {
  131|  2.54M|                    result += "\\" +
  132|  2.54M|                        QUtil::int_to_string_base(
  133|  2.54M|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  134|  2.54M|                }
  135|  8.31M|                break;
  136|  42.3M|            }
  137|  42.3M|        }
  138|  71.3k|        result += ")";
  139|  71.3k|    }
  140|       |
  141|   131k|    return result;
  142|   131k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   12|  8.31M|{
   13|  8.31M|    return (ch >= 32 && ch <= 126) || static_cast<unsigned char>(ch) >= 160;
  ------------------
  |  Branch (13:13): [True: 5.80M, False: 2.51M]
  |  Branch (13:25): [True: 5.65M, False: 146k]
  |  Branch (13:39): [True: 119k, False: 2.54M]
  ------------------
   14|  8.31M|}

_ZNK4QPDF3Doc10Encryption4getVEv:
  131|  4.76k|{
  132|  4.76k|    return this->V;
  133|  4.76k|}
_ZNK4QPDF3Doc10Encryption4getREv:
  137|  8.06k|{
  138|  8.06k|    return this->R;
  139|  8.06k|}
_ZNK4QPDF3Doc10Encryption14getLengthBytesEv:
  143|  3.90k|{
  144|  3.90k|    return this->Length_bytes;
  145|  3.90k|}
_ZNK4QPDF3Doc10Encryption4getPEv:
  149|  1.78k|{
  150|  1.78k|    return static_cast<int>(P.to_ulong());
  151|  1.78k|}
_ZNK4QPDF3Doc10Encryption4getOEv:
  169|  2.85k|{
  170|  2.85k|    return this->O;
  171|  2.85k|}
_ZNK4QPDF3Doc10Encryption4getUEv:
  175|  3.19k|{
  176|  3.19k|    return this->U;
  177|  3.19k|}
_ZNK4QPDF3Doc10Encryption5getOEEv:
  181|      5|{
  182|      5|    return this->OE;
  183|      5|}
_ZNK4QPDF3Doc10Encryption5getUEEv:
  187|    191|{
  188|    191|    return this->UE;
  189|    191|}
_ZNK4QPDF3Doc10Encryption8getPermsEv:
  193|    196|{
  194|    196|    return this->Perms;
  195|    196|}
_ZNK4QPDF3Doc10Encryption6getId1Ev:
  199|  2.66k|{
  200|  2.66k|    return this->id1;
  201|  2.66k|}
_ZNK4QPDF3Doc10Encryption18getEncryptMetadataEv:
  205|  1.68k|{
  206|  1.68k|    return this->encrypt_metadata;
  207|  1.68k|}
_ZN4QPDF18trim_user_passwordERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  257|     56|{
  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|     56|    if (user_password.size() < key_bytes) {
  ------------------
  |  Branch (260:9): [True: 0, False: 56]
  ------------------
  261|      0|        return;
  262|      0|    }
  263|       |
  264|     56|    auto idx = user_password.find('\x28');
  265|       |
  266|     58|    while (idx != user_password.npos) {
  ------------------
  |  Branch (266:12): [True: 2, False: 56]
  ------------------
  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|     56|}
_ZNK4QPDF3Doc10Encryption7hash_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_:
  346|  1.44k|{
  347|  1.44k|    Pl_SHA2 hash(256);
  348|  1.44k|    hash.writeString(password);
  349|  1.44k|    hash.writeString(salt);
  350|  1.44k|    hash.writeString(udata);
  351|  1.44k|    hash.finish();
  352|  1.44k|    std::string K = hash.getRawDigest();
  353|       |
  354|  1.44k|    std::string result;
  355|  1.44k|    if (getR() < 6) {
  ------------------
  |  Branch (355:9): [True: 72, False: 1.37k]
  ------------------
  356|     72|        result = K;
  357|  1.37k|    } else {
  358|       |        // Algorithm 2.B from ISO 32000-1 chapter 7: Computing a hash
  359|       |
  360|  1.37k|        int round_number = 0;
  361|  1.37k|        bool done = false;
  362|  98.1k|        while (!done) {
  ------------------
  |  Branch (362:16): [True: 96.7k, False: 1.37k]
  ------------------
  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|  96.7k|            ++round_number;
  376|  96.7k|            std::string K1 = password + K + udata;
  377|  96.7k|            qpdf_assert_debug(K.length() >= 32);
  ------------------
  |  |   11|  96.7k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (377:13): [True: 96.7k, False: 0]
  ------------------
  378|  96.7k|            std::string E = process_with_aes(
  379|  96.7k|                K.substr(0, 16),
  380|  96.7k|                true,
  381|  96.7k|                K1,
  382|  96.7k|                0,
  383|  96.7k|                64,
  384|  96.7k|                QUtil::unsigned_char_pointer(K.substr(16, 16)),
  385|  96.7k|                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|  96.7k|            int E_mod_3 = 0;
  392|  1.64M|            for (unsigned int i = 0; i < 16; ++i) {
  ------------------
  |  Branch (392:38): [True: 1.54M, False: 96.7k]
  ------------------
  393|  1.54M|                E_mod_3 += static_cast<unsigned char>(E.at(i));
  394|  1.54M|            }
  395|  96.7k|            E_mod_3 %= 3;
  396|  96.7k|            int next_hash = ((E_mod_3 == 0) ? 256 : (E_mod_3 == 1) ? 384 : 512);
  ------------------
  |  Branch (396:30): [True: 32.0k, False: 64.7k]
  |  Branch (396:53): [True: 35.3k, False: 29.3k]
  ------------------
  397|  96.7k|            Pl_SHA2 sha2(next_hash);
  398|  96.7k|            sha2.writeString(E);
  399|  96.7k|            sha2.finish();
  400|  96.7k|            K = sha2.getRawDigest();
  401|       |
  402|  96.7k|            if (round_number >= 64) {
  ------------------
  |  Branch (402:17): [True: 10.2k, False: 86.4k]
  ------------------
  403|  10.2k|                unsigned int ch = static_cast<unsigned char>(*(E.rbegin()));
  404|       |
  405|  10.2k|                if (ch <= QIntC::to_uint(round_number - 32)) {
  ------------------
  |  Branch (405:21): [True: 1.37k, False: 8.89k]
  ------------------
  406|  1.37k|                    done = true;
  407|  1.37k|                }
  408|  10.2k|            }
  409|  96.7k|        }
  410|  1.37k|        result = K.substr(0, 32);
  411|  1.37k|    }
  412|       |
  413|  1.44k|    return result;
  414|  1.44k|}
_ZN4QPDF16compute_data_keyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiibii:
  433|  4.41k|{
  434|       |    // Algorithm 3.1 from the PDF 1.7 Reference Manual
  435|       |
  436|  4.41k|    std::string result = encryption_key;
  437|       |
  438|  4.41k|    if (encryption_V >= 5) {
  ------------------
  |  Branch (438:9): [True: 2.02k, False: 2.39k]
  ------------------
  439|       |        // Algorithm 3.1a (PDF 1.7 extension level 3): just use encryption key straight.
  440|  2.02k|        return result;
  441|  2.02k|    }
  442|       |
  443|       |    // Append low three bytes of object ID and low two bytes of generation
  444|  2.39k|    result.append(1, static_cast<char>(objid & 0xff));
  445|  2.39k|    result.append(1, static_cast<char>((objid >> 8) & 0xff));
  446|  2.39k|    result.append(1, static_cast<char>((objid >> 16) & 0xff));
  447|  2.39k|    result.append(1, static_cast<char>(generation & 0xff));
  448|  2.39k|    result.append(1, static_cast<char>((generation >> 8) & 0xff));
  449|  2.39k|    if (use_aes) {
  ------------------
  |  Branch (449:9): [True: 1.05k, False: 1.33k]
  ------------------
  450|  1.05k|        result += "sAlT";
  451|  1.05k|    }
  452|  2.39k|    return MD5::digest(result).substr(0, result.size());
  453|  4.41k|}
_ZNK4QPDF3Doc10Encryption22compute_encryption_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  475|  1.59k|{
  476|  1.59k|    if (getV() >= 5) {
  ------------------
  |  Branch (476:9): [True: 0, False: 1.59k]
  ------------------
  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.59k|    } else {
  481|       |        // For V < 5, the encryption key is derived from the user
  482|       |        // password.
  483|  1.59k|        return compute_encryption_key_from_password(password);
  484|  1.59k|    }
  485|  1.59k|}
_ZNK4QPDF3Doc10Encryption36compute_encryption_key_from_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  489|  1.59k|{
  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.59k|    MD5 md5;
  498|  1.59k|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  499|  1.59k|    md5.encodeDataIncrementally(getO());
  500|  1.59k|    char pbytes[4];
  501|  1.59k|    int p = getP();
  502|  1.59k|    pbytes[0] = static_cast<char>(p & 0xff);
  503|  1.59k|    pbytes[1] = static_cast<char>((p >> 8) & 0xff);
  504|  1.59k|    pbytes[2] = static_cast<char>((p >> 16) & 0xff);
  505|  1.59k|    pbytes[3] = static_cast<char>((p >> 24) & 0xff);
  506|  1.59k|    md5.encodeDataIncrementally(pbytes, 4);
  507|  1.59k|    md5.encodeDataIncrementally(getId1());
  508|  1.59k|    if (getR() >= 4 && !getEncryptMetadata()) {
  ------------------
  |  Branch (508:9): [True: 1.48k, False: 104]
  |  Branch (508:24): [True: 2, False: 1.48k]
  ------------------
  509|      2|        md5.encodeDataIncrementally("\xff\xff\xff\xff");
  510|      2|    }
  511|  1.59k|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (511:37): [True: 1.52k, False: 63]
  ------------------
  512|  1.59k|}
_ZNK4QPDF3Doc10Encryption17compute_O_rc4_keyERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  517|    592|{
  518|    592|    if (getV() >= 5) {
  ------------------
  |  Branch (518:9): [True: 0, False: 592]
  ------------------
  519|      0|        throw std::logic_error("compute_O_rc4_key called for file with V >= 5");
  520|      0|    }
  521|    592|    std::string password = owner_password.empty() ? user_password : owner_password;
  ------------------
  |  Branch (521:28): [True: 592, False: 0]
  ------------------
  522|    592|    MD5 md5;
  523|    592|    md5.encodeDataIncrementally(pad_or_truncate_password_V4(password));
  524|    592|    return iterate_md5_digest(md5, (getR() >= 3 ? 50 : 0), getLengthBytes());
  ------------------
  |  Branch (524:37): [True: 566, False: 26]
  ------------------
  525|    592|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  542|     51|{
  543|       |    // Algorithm 3.4 from the PDF 1.7 Reference Manual
  544|       |
  545|     51|    std::string k1 = compute_encryption_key(user_password);
  546|     51|    auto udata = padding_string;
  547|     51|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  548|     51|    iterate_rc4(udata, k1, 1, false);
  549|     51|    return udata;
  550|     51|}
_ZNK4QPDF3Doc10Encryption18compute_U_value_R3ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  554|  1.07k|{
  555|       |    // Algorithm 3.5 from the PDF 1.7 Reference Manual
  556|       |
  557|  1.07k|    std::string k1 = compute_encryption_key(user_password);
  558|  1.07k|    MD5 md5;
  559|  1.07k|    md5.encodeDataIncrementally(padding_string);
  560|  1.07k|    md5.encodeDataIncrementally(getId1());
  561|  1.07k|    auto result = md5.digest();
  562|  1.07k|    pad_short_parameter(k1, QIntC::to_size(getLengthBytes()));
  563|  1.07k|    iterate_rc4(result, k1, 20, false);
  564|       |    // pad with arbitrary data -- make it consistent for the sake of testing
  565|  1.07k|    result += "\x0\x21\x44\x69\x90\xb9\xe4\x11\x40\x71\xa4\xd9\x10\x49\x84\xc1"s;
  566|  1.07k|    return result;
  567|  1.07k|}
_ZNK4QPDF3Doc10Encryption15compute_U_valueERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  571|  1.12k|{
  572|  1.12k|    if (getR() >= 3) {
  ------------------
  |  Branch (572:9): [True: 1.07k, False: 51]
  ------------------
  573|  1.07k|        return compute_U_value_R3(user_password);
  574|  1.07k|    }
  575|       |
  576|     51|    return compute_U_value_R2(user_password);
  577|  1.12k|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V4ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  581|  1.12k|{
  582|       |    // Algorithm 3.6 from the PDF 1.7 Reference Manual
  583|       |
  584|  1.12k|    std::string u_value = compute_U_value(user_password);
  585|  1.12k|    size_t to_compare = (getR() >= 3 ? sizeof(MD5::Digest) : key_bytes);
  ------------------
  |  Branch (585:26): [True: 1.07k, False: 51]
  ------------------
  586|  1.12k|    return memcmp(getU().c_str(), u_value.c_str(), to_compare) == 0;
  587|  1.12k|}
_ZNK4QPDF3Doc10Encryption22check_user_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  591|    622|{
  592|       |    // Algorithm 3.11 from the PDF 1.7 extension level 3
  593|       |
  594|    622|    std::string user_data = getU().substr(0, 32);
  595|    622|    std::string validation_salt = getU().substr(32, 8);
  596|    622|    std::string password = user_password.substr(0, 127);
  597|    622|    return hash_V5(user_password.substr(0, 127), validation_salt, "") == user_data;
  598|    622|}
_ZNK4QPDF3Doc10Encryption19check_user_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  602|  1.55k|{
  603|  1.55k|    if (getV() < 5) {
  ------------------
  |  Branch (603:9): [True: 1.12k, False: 431]
  ------------------
  604|  1.12k|        return check_user_password_V4(user_password);
  605|  1.12k|    } else {
  606|    431|        return check_user_password_V5(user_password);
  607|    431|    }
  608|  1.55k|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V4ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  613|    592|{
  614|       |    // Algorithm 3.7 from the PDF 1.7 Reference Manual
  615|       |
  616|    592|    auto key = compute_O_rc4_key(user_password, owner_password);
  617|    592|    pad_short_parameter(key, QIntC::to_size(getLengthBytes()));
  618|    592|    auto new_user_password = O.substr(0, key_bytes);
  619|    592|    iterate_rc4(new_user_password, key, (getR() >= 3) ? 20 : 1, true);
  ------------------
  |  Branch (619:41): [True: 566, False: 26]
  ------------------
  620|    592|    if (check_user_password(new_user_password)) {
  ------------------
  |  Branch (620:9): [True: 56, False: 536]
  ------------------
  621|     56|        user_password = new_user_password;
  622|     56|        return true;
  623|     56|    }
  624|    536|    return false;
  625|    592|}
_ZNK4QPDF3Doc10Encryption23check_owner_password_V5ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  629|    627|{
  630|       |    // Algorithm 3.12 from the PDF 1.7 extension level 3
  631|       |
  632|    627|    std::string user_data = getU().substr(0, 48);
  633|    627|    std::string owner_data = getO().substr(0, 32);
  634|    627|    std::string validation_salt = getO().substr(32, 8);
  635|    627|    return hash_V5(owner_password.substr(0, 127), validation_salt, user_data) == owner_data;
  636|    627|}
_ZNK4QPDF3Doc10Encryption20check_owner_passwordERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_:
  641|  1.02k|{
  642|  1.02k|    if (getV() < 5) {
  ------------------
  |  Branch (642:9): [True: 592, False: 431]
  ------------------
  643|    592|        return check_owner_password_V4(user_password, owner_password);
  644|    592|    } else {
  645|    431|        return check_owner_password_V5(owner_password);
  646|    431|    }
  647|  1.02k|}
_ZNK4QPDF3Doc10Encryption28compute_Perms_value_V5_clearEv:
  659|    196|{
  660|       |    // From algorithm 3.10 from the PDF 1.7 extension level 3
  661|       |    // cSpell:ignore Tadb
  662|    196|    std::string k = "    \xff\xff\xff\xffTadb    ";
  663|    196|    int perms = getP();
  664|    980|    for (size_t i = 0; i < 4; ++i) {
  ------------------
  |  Branch (664:24): [True: 784, False: 196]
  ------------------
  665|    784|        k[i] = static_cast<char>(perms & 0xff);
  666|    784|        perms >>= 8;
  667|    784|    }
  668|    196|    if (!getEncryptMetadata()) {
  ------------------
  |  Branch (668:9): [True: 0, False: 196]
  ------------------
  669|      0|        k[8] = 'F';
  670|      0|    }
  671|    196|    QUtil::initializeWithRandomBytes(reinterpret_cast<unsigned char*>(&k[12]), 4);
  672|    196|    return k;
  673|    196|}
_ZNK4QPDF3Doc10Encryption36recover_encryption_key_with_passwordERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERb:
  678|    196|{
  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|    196|    perms_valid = false;
  686|    196|    std::string key_password = password.substr(0, 127);
  687|    196|    std::string key_salt;
  688|    196|    std::string user_data;
  689|    196|    std::string encrypted_file_key;
  690|    196|    if (check_owner_password_V5(key_password)) {
  ------------------
  |  Branch (690:9): [True: 5, False: 191]
  ------------------
  691|      5|        key_salt = getO().substr(40, 8);
  692|      5|        user_data = getU().substr(0, 48);
  693|      5|        encrypted_file_key = getOE().substr(0, 32);
  694|    191|    } else if (check_user_password_V5(key_password)) {
  ------------------
  |  Branch (694:16): [True: 191, False: 0]
  ------------------
  695|    191|        key_salt = getU().substr(40, 8);
  696|    191|        encrypted_file_key = getUE().substr(0, 32);
  697|    191|    }
  698|    196|    std::string intermediate_key = hash_V5(key_password, key_salt, user_data);
  699|    196|    std::string file_key = process_with_aes(intermediate_key, false, encrypted_file_key);
  700|       |
  701|       |    // Decrypt Perms and check against expected value
  702|    196|    auto perms_check = process_with_aes(file_key, false, getPerms()).substr(0, 12);
  703|    196|    perms_valid = compute_Perms_value_V5_clear().substr(0, 12) == perms_check;
  704|    196|    return file_key;
  705|    196|}
_ZNK4QPDF20EncryptionParameters11interpretCFERKN4qpdf4NameE:
  709|  1.71k|{
  710|  1.71k|    if (!cf) {
  ------------------
  |  Branch (710:9): [True: 756, False: 960]
  ------------------
  711|       |        // Default: /Identity
  712|    756|        return e_none;
  713|    756|    }
  714|    960|    auto it = crypt_filters.find(cf);
  715|    960|    if (it != crypt_filters.end()) {
  ------------------
  |  Branch (715:9): [True: 268, False: 692]
  ------------------
  716|    268|        return it->second;
  717|    268|    }
  718|    692|    if (cf == "/Identity") {
  ------------------
  |  Branch (718:9): [True: 14, False: 678]
  ------------------
  719|     14|        return e_none;
  720|     14|    }
  721|    678|    return e_unknown;
  722|    692|}
_ZN4QPDF20EncryptionParameters10initializeERS_:
  732|  12.5k|{
  733|  12.5k|    if (encryption_initialized) {
  ------------------
  |  Branch (733:9): [True: 7, False: 12.5k]
  ------------------
  734|      7|        return;
  735|      7|    }
  736|  12.5k|    encryption_initialized = true;
  737|       |
  738|  12.5k|    auto& c = qpdf.m->c;
  739|  12.5k|    auto& qm = *qpdf.m;
  740|  12.5k|    auto& trailer = qm.trailer;
  741|  12.5k|    auto& file = qm.file;
  742|       |
  743|  12.5k|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|  12.5k|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|  12.5k|    };
  746|  12.5k|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|  12.5k|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|  12.5k|    };
  749|  12.5k|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|  12.5k|        return {
  751|  12.5k|            qpdf_e_unsupported,
  752|  12.5k|            file->getName(),
  753|  12.5k|            "encryption dictionary",
  754|  12.5k|            file->getLastOffset(),
  755|  12.5k|            msg};
  756|  12.5k|    };
  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|  12.5k|    if (!trailer.contains("/Encrypt")) {
  ------------------
  |  Branch (762:9): [True: 11.3k, False: 1.16k]
  ------------------
  763|  11.3k|        return;
  764|  11.3k|    }
  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.16k|    encrypted = true;
  769|       |
  770|  1.16k|    std::string id1;
  771|  1.16k|    auto id_obj = trailer.getKey("/ID");
  772|  1.16k|    if (id_obj.size() != 2 || !id_obj.getArrayItem(0).isString()) {
  ------------------
  |  Branch (772:9): [True: 800, False: 363]
  |  Branch (772:9): [True: 806, False: 357]
  |  Branch (772:31): [True: 7, False: 356]
  ------------------
  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|    806|        qpdf.warn(qpdf.m->c.damagedPDF("trailer", "invalid /ID in trailer dictionary"));
  776|    806|    } else {
  777|    357|        id1 = id_obj.getArrayItem(0).getStringValue();
  778|    357|    }
  779|       |
  780|  1.16k|    auto encryption_dict = trailer.getKey("/Encrypt");
  781|  1.16k|    if (!encryption_dict.isDictionary()) {
  ------------------
  |  Branch (781:9): [True: 4, False: 1.15k]
  ------------------
  782|      4|        throw qpdf.m->c.damagedPDF("/Encrypt in trailer dictionary is not a dictionary");
  783|      4|    }
  784|       |
  785|  1.15k|    if (Name(encryption_dict["/Filter"]) != "/Standard") {
  ------------------
  |  Branch (785:9): [True: 6, False: 1.15k]
  ------------------
  786|      6|        throw unsupported("unsupported encryption filter");
  787|      6|    }
  788|  1.15k|    if (!encryption_dict.getKey("/SubFilter").null()) {
  ------------------
  |  Branch (788:9): [True: 3, False: 1.15k]
  ------------------
  789|      3|        qpdf.warn(unsupported("file uses encryption SubFilters, which qpdf does not support"));
  790|      3|    }
  791|       |
  792|  1.15k|    if (!(encryption_dict.getKey("/V").isInteger() && encryption_dict.getKey("/R").isInteger() &&
  ------------------
  |  Branch (792:9): [True: 62, False: 1.09k]
  |  Branch (792:11): [True: 1.09k, False: 62]
  |  Branch (792:55): [True: 1.09k, False: 1]
  ------------------
  793|  1.09k|          encryption_dict.getKey("/O").isString() && encryption_dict.getKey("/U").isString() &&
  ------------------
  |  Branch (793:11): [True: 1.08k, False: 1]
  |  Branch (793:54): [True: 1.08k, False: 2]
  ------------------
  794|  1.08k|          encryption_dict.getKey("/P").isInteger())) {
  ------------------
  |  Branch (794:11): [True: 1.08k, False: 2]
  ------------------
  795|     62|        throw_damaged_pdf("some encryption dictionary parameters are missing or the wrong type");
  796|     62|    }
  797|       |
  798|  1.15k|    int V = encryption_dict.getKey("/V").getIntValueAsInt();
  799|  1.15k|    int R = encryption_dict.getKey("/R").getIntValueAsInt();
  800|  1.15k|    std::string O = encryption_dict.getKey("/O").getStringValue();
  801|  1.15k|    std::string U = encryption_dict.getKey("/U").getStringValue();
  802|  1.15k|    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.15k|    if (!(2 <= R && R <= 6 && (V == 1 || V == 2 || V == 4 || V == 5))) {
  ------------------
  |  Branch (806:11): [True: 1.08k, False: 69]
  |  Branch (806:21): [True: 1.08k, False: 1]
  |  Branch (806:32): [True: 96, False: 987]
  |  Branch (806:42): [True: 149, False: 838]
  |  Branch (806:52): [True: 359, False: 479]
  |  Branch (806:62): [True: 437, False: 42]
  ------------------
  807|     44|        throw unsupported(
  808|     44|            "Unsupported /R or /V in encryption dictionary; R = " + std::to_string(R) +
  809|     44|            " (max 6), V = " + std::to_string(V) + " (max 5)");
  810|     44|    }
  811|       |
  812|  1.10k|    P_ = std::bitset<32>(static_cast<unsigned long long>(p));
  813|  1.10k|    encryption_V = V;
  814|  1.10k|    R_ = R;
  815|       |
  816|       |    // OE, UE, and Perms are only present if V >= 5.
  817|  1.10k|    std::string OE;
  818|  1.10k|    std::string UE;
  819|  1.10k|    std::string Perms;
  820|       |
  821|  1.10k|    if (V < 5) {
  ------------------
  |  Branch (821:9): [True: 604, False: 505]
  ------------------
  822|       |        // These must be exactly the right number of bytes.
  823|    604|        pad_short_parameter(O, key_bytes);
  824|    604|        pad_short_parameter(U, key_bytes);
  825|    604|        if (!(O.length() == key_bytes && U.length() == key_bytes)) {
  ------------------
  |  Branch (825:15): [True: 603, False: 1]
  |  Branch (825:42): [True: 592, False: 11]
  ------------------
  826|     12|            throw_damaged_pdf("incorrect length for /O and/or /U in encryption dictionary");
  827|     12|        }
  828|    604|    } else {
  829|    505|        if (!(encryption_dict.getKey("/OE").isString() &&
  ------------------
  |  Branch (829:13): [True: 4, False: 501]
  |  Branch (829:15): [True: 436, False: 69]
  ------------------
  830|    436|              encryption_dict.getKey("/UE").isString() &&
  ------------------
  |  Branch (830:15): [True: 435, False: 1]
  ------------------
  831|    435|              encryption_dict.getKey("/Perms").isString())) {
  ------------------
  |  Branch (831:15): [True: 433, False: 2]
  ------------------
  832|      4|            throw_damaged_pdf(
  833|      4|                "some V=5 encryption dictionary parameters are missing or the wrong type");
  834|      4|        }
  835|    505|        OE = encryption_dict.getKey("/OE").getStringValue();
  836|    505|        UE = encryption_dict.getKey("/UE").getStringValue();
  837|    505|        Perms = encryption_dict.getKey("/Perms").getStringValue();
  838|       |
  839|       |        // These may be longer than the minimum number of bytes.
  840|    505|        pad_short_parameter(O, OU_key_bytes_V5);
  841|    505|        pad_short_parameter(U, OU_key_bytes_V5);
  842|    505|        pad_short_parameter(OE, OUE_key_bytes_V5);
  843|    505|        pad_short_parameter(UE, OUE_key_bytes_V5);
  844|    505|        pad_short_parameter(Perms, Perms_key_bytes_V5);
  845|    505|    }
  846|       |
  847|  1.10k|    int Length = 128; // Just take a guess.
  848|  1.10k|    if (V <= 1) {
  ------------------
  |  Branch (848:9): [True: 94, False: 1.01k]
  ------------------
  849|     94|        Length = 40;
  850|  1.01k|    } else if (V == 4) {
  ------------------
  |  Branch (850:16): [True: 350, False: 665]
  ------------------
  851|    350|        Length = 128;
  852|    665|    } else if (V == 5) {
  ------------------
  |  Branch (852:16): [True: 433, False: 232]
  ------------------
  853|    433|        Length = 256;
  854|    433|    } else {
  855|    232|        if (encryption_dict.getKey("/Length").isInteger()) {
  ------------------
  |  Branch (855:13): [True: 39, False: 193]
  ------------------
  856|     39|            Length = encryption_dict.getKey("/Length").getIntValueAsInt();
  857|     39|            if (Length % 8 || Length < 40 || Length > 128) {
  ------------------
  |  Branch (857:17): [True: 16, False: 23]
  |  Branch (857:31): [True: 1, False: 22]
  |  Branch (857:46): [True: 1, False: 21]
  ------------------
  858|     18|                Length = 128; // Just take a guess.
  859|     18|            }
  860|     39|        }
  861|    232|    }
  862|       |
  863|  1.10k|    encrypt_metadata = true;
  864|  1.10k|    if (V >= 4 && encryption_dict.getKey("/EncryptMetadata").isBool()) {
  ------------------
  |  Branch (864:9): [True: 783, False: 326]
  |  Branch (864:9): [True: 2, False: 1.10k]
  |  Branch (864:19): [True: 2, False: 781]
  ------------------
  865|      2|        encrypt_metadata = encryption_dict.getKey("/EncryptMetadata").getBoolValue();
  866|      2|    }
  867|       |
  868|  1.10k|    if (V == 4 || V == 5) {
  ------------------
  |  Branch (868:9): [True: 434, False: 675]
  |  Branch (868:19): [True: 433, False: 242]
  ------------------
  869|    783|        auto CF = encryption_dict.getKey("/CF");
  870|  3.15k|        for (auto const& [filter, cdict]: CF.as_dictionary()) {
  ------------------
  |  Branch (870:41): [True: 3.15k, False: 783]
  ------------------
  871|  3.15k|            if (cdict.isDictionary()) {
  ------------------
  |  Branch (871:17): [True: 1.64k, False: 1.50k]
  ------------------
  872|  1.64k|                encryption_method_e method = e_none;
  873|  1.64k|                if (Name const& CFM = cdict["/CFM"]) {
  ------------------
  |  Branch (873:33): [True: 757, False: 890]
  ------------------
  874|    757|                    if (CFM == "/V2") {
  ------------------
  |  Branch (874:25): [True: 47, False: 710]
  ------------------
  875|     47|                        method = e_rc4;
  876|    710|                    } else if (CFM == "/AESV2") {
  ------------------
  |  Branch (876:32): [True: 69, False: 641]
  ------------------
  877|     69|                        method = e_aes;
  878|    641|                    } else if (CFM == "/AESV3") {
  ------------------
  |  Branch (878:32): [True: 174, False: 467]
  ------------------
  879|    174|                        method = e_aesv3;
  880|    467|                    } else {
  881|       |                        // Don't complain now -- maybe we won't need to reference this type.
  882|    467|                        method = e_unknown;
  883|    467|                    }
  884|    757|                }
  885|  1.64k|                crypt_filters[filter] = method;
  886|  1.64k|            }
  887|  3.15k|        }
  888|       |
  889|    783|        cf_stream = interpretCF(encryption_dict["/StmF"]);
  890|    783|        cf_string = interpretCF(encryption_dict["/StrF"]);
  891|    783|        if (Name const& EFF = encryption_dict["/EFF"]) {
  ------------------
  |  Branch (891:25): [True: 74, False: 709]
  ------------------
  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|     74|            cf_file = interpretCF(EFF);
  902|    709|        } else {
  903|    709|            cf_file = cf_stream;
  904|    709|        }
  905|    783|    }
  906|       |
  907|  1.10k|    Encryption data(V, R, Length / 8, p, O, U, OE, UE, Perms, id1, encrypt_metadata);
  908|  1.10k|    if (qm.cf.password_is_hex_key()) {
  ------------------
  |  Branch (908:9): [True: 0, False: 1.10k]
  ------------------
  909|       |        // ignore passwords in file
  910|      0|        encryption_key = QUtil::hex_decode(provided_password);
  911|      0|        return;
  912|      0|    }
  913|       |
  914|  1.10k|    owner_password_matched = data.check_owner_password(user_password, provided_password);
  915|  1.10k|    if (owner_password_matched && V < 5) {
  ------------------
  |  Branch (915:9): [True: 61, False: 1.04k]
  |  Branch (915:35): [True: 56, False: 5]
  ------------------
  916|       |        // password supplied was owner password; user_password has been initialized for V < 5
  917|     56|        if (qpdf.getTrimmedUserPassword() == provided_password) {
  ------------------
  |  Branch (917:13): [True: 0, False: 56]
  ------------------
  918|      0|            user_password_matched = true;
  919|      0|            QTC::TC("qpdf", "QPDF_encryption user matches owner V < 5");
  920|      0|        }
  921|  1.05k|    } else {
  922|  1.05k|        user_password_matched = data.check_user_password(provided_password);
  923|  1.05k|        if (user_password_matched) {
  ------------------
  |  Branch (923:13): [True: 598, False: 455]
  ------------------
  924|    598|            user_password = provided_password;
  925|    598|        }
  926|  1.05k|    }
  927|  1.10k|    if (user_password_matched && owner_password_matched) {
  ------------------
  |  Branch (927:9): [True: 598, False: 511]
  |  Branch (927:34): [True: 0, False: 598]
  ------------------
  928|      0|        QTC::TC("qpdf", "QPDF_encryption same password", (V < 5) ? 0 : 1);
  ------------------
  |  Branch (928:58): [True: 0, False: 0]
  ------------------
  929|      0|    }
  930|  1.10k|    if (!(owner_password_matched || user_password_matched)) {
  ------------------
  |  Branch (930:11): [True: 147, False: 962]
  |  Branch (930:37): [True: 598, False: 364]
  ------------------
  931|    364|        throw QPDFExc(qpdf_e_password, file->getName(), "", 0, "invalid password");
  932|    364|    }
  933|       |
  934|    745|    if (V < 5) {
  ------------------
  |  Branch (934:9): [True: 463, False: 282]
  ------------------
  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|    463|        encryption_key = data.compute_encryption_key(user_password);
  938|    463|    } 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|    282|        bool perms_valid;
  942|    282|        encryption_key = data.recover_encryption_key_with_password(provided_password, perms_valid);
  943|    282|        if (!perms_valid) {
  ------------------
  |  Branch (943:13): [True: 195, False: 87]
  ------------------
  944|    195|            warn_damaged_pdf("/Perms field in encryption dictionary doesn't match expected value");
  945|    195|        }
  946|    282|    }
  947|    745|}
_ZN4QPDF15getKeyForObjectENSt3__110shared_ptrINS_20EncryptionParametersEEE10QPDFObjGenb:
  951|  73.3k|{
  952|  73.3k|    if (!encp->encrypted) {
  ------------------
  |  Branch (952:9): [True: 0, False: 73.3k]
  ------------------
  953|      0|        throw std::logic_error("request for encryption key in non-encrypted PDF");
  954|      0|    }
  955|       |
  956|  73.3k|    if (og != encp->cached_key_og) {
  ------------------
  |  Branch (956:9): [True: 4.41k, False: 68.9k]
  ------------------
  957|  4.41k|        encp->cached_object_encryption_key = compute_data_key(
  958|  4.41k|            encp->encryption_key, og.getObj(), og.getGen(), use_aes, encp->encryption_V, encp->R());
  959|  4.41k|        encp->cached_key_og = og;
  960|  4.41k|    }
  961|       |
  962|  73.3k|    return encp->cached_object_encryption_key;
  963|  73.3k|}
_ZN4QPDF13decryptStringERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE10QPDFObjGen:
  967|  72.3k|{
  968|  72.3k|    if (!og.isIndirect()) {
  ------------------
  |  Branch (968:9): [True: 0, False: 72.3k]
  ------------------
  969|      0|        return;
  970|      0|    }
  971|  72.3k|    bool use_aes = false;
  972|  72.3k|    if (m->encp->encryption_V >= 4) {
  ------------------
  |  Branch (972:9): [True: 64.7k, False: 7.59k]
  ------------------
  973|  64.7k|        switch (m->encp->cf_string) {
  974|    580|        case e_none:
  ------------------
  |  Branch (974:9): [True: 580, False: 64.1k]
  ------------------
  975|    580|            return;
  976|       |
  977|  63.0k|        case e_aes:
  ------------------
  |  Branch (977:9): [True: 63.0k, False: 1.65k]
  ------------------
  978|  63.0k|            use_aes = true;
  979|  63.0k|            break;
  980|       |
  981|    736|        case e_aesv3:
  ------------------
  |  Branch (981:9): [True: 736, False: 63.9k]
  ------------------
  982|    736|            use_aes = true;
  983|    736|            break;
  984|       |
  985|    204|        case e_rc4:
  ------------------
  |  Branch (985:9): [True: 204, False: 64.5k]
  ------------------
  986|    204|            break;
  987|       |
  988|    132|        default:
  ------------------
  |  Branch (988:9): [True: 132, False: 64.5k]
  ------------------
  989|    132|            warn(m->c.damagedPDF(
  990|    132|                "unknown encryption filter for strings (check /StrF in "
  991|    132|                "/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|    132|            m->encp->cf_string = e_aes;
  994|    132|            use_aes = true;
  995|    132|            break;
  996|  64.7k|        }
  997|  64.7k|    }
  998|       |
  999|  71.7k|    std::string key = getKeyForObject(m->encp, og, use_aes);
 1000|  71.7k|    try {
 1001|  71.7k|        if (use_aes) {
  ------------------
  |  Branch (1001:13): [True: 63.9k, False: 7.79k]
  ------------------
 1002|  63.9k|            QTC::TC("qpdf", "QPDF_encryption aes decode string");
 1003|  63.9k|            Pl_Buffer bufpl("decrypted string");
 1004|  63.9k|            Pl_AES_PDF pl("aes decrypt string", &bufpl, false, key);
 1005|  63.9k|            pl.writeString(str);
 1006|  63.9k|            pl.finish();
 1007|  63.9k|            str = bufpl.getString();
 1008|  63.9k|        } else {
 1009|  7.79k|            QTC::TC("qpdf", "QPDF_encryption rc4 decode string");
 1010|  7.79k|            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|  7.79k|            auto tmp = QUtil::make_unique_cstr(str);
 1014|  7.79k|            RC4 rc4(QUtil::unsigned_char_pointer(key), QIntC::to_int(key.length()));
 1015|  7.79k|            auto data = QUtil::unsigned_char_pointer(tmp.get());
 1016|  7.79k|            rc4.process(data, vlen, data);
 1017|  7.79k|            str = std::string(tmp.get(), vlen);
 1018|  7.79k|        }
 1019|  71.7k|    } catch (QPDFExc&) {
 1020|      0|        throw;
 1021|      0|    } catch (std::runtime_error& e) {
 1022|      0|        throw m->c.damagedPDF(
 1023|      0|            "error decrypting string for object " + og.unparse() + ": " + e.what());
 1024|      0|    }
 1025|  71.7k|}
_ZN4QPDF13decryptStreamENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_RP8Pipeline10QPDFObjGenR16QPDFObjectHandlebRNS0_10unique_ptrIS7_NS0_14default_deleteIS7_EEEE:
 1040|  3.10k|{
 1041|  3.10k|    if (Name(stream_dict["/Type"]) == "/XRef") {
  ------------------
  |  Branch (1041:9): [True: 526, False: 2.58k]
  ------------------
 1042|    526|        return;
 1043|    526|    }
 1044|  2.58k|    bool use_aes = false;
 1045|  2.58k|    if (encp->encryption_V >= 4) {
  ------------------
  |  Branch (1045:9): [True: 2.26k, False: 317]
  ------------------
 1046|  2.26k|        encryption_method_e method = e_unknown;
 1047|  2.26k|        std::string method_source = "/StmF from /Encrypt dictionary";
 1048|       |
 1049|  2.26k|        if (stream_dict.getKey("/Filter").isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1049:13): [True: 140, False: 2.12k]
  ------------------
 1050|    140|            if (Dictionary decode_parms = stream_dict["/DecodeParms"]) {
  ------------------
  |  Branch (1050:28): [True: 107, False: 33]
  ------------------
 1051|    107|                if (Name(decode_parms["/Type"]) == "/CryptFilterDecodeParms") {
  ------------------
  |  Branch (1051:21): [True: 80, False: 27]
  ------------------
 1052|     80|                    method = encp->interpretCF(decode_parms["/Name"]);
 1053|     80|                    method_source = "stream's Crypt decode parameters";
 1054|     80|                }
 1055|    107|            } else {
 1056|     33|                Array filter = stream_dict["/Filter"];
 1057|     33|                Array decode = stream_dict.getKey("/DecodeParms");
 1058|     33|                if (filter.size() == decode.size()) {
  ------------------
  |  Branch (1058:21): [True: 19, False: 14]
  ------------------
 1059|     19|                    size_t i = 0;
 1060|     19|                    for (Name item: filter) {
  ------------------
  |  Branch (1060:35): [True: 0, False: 19]
  ------------------
 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|     19|                }
 1071|     33|            }
 1072|    140|        }
 1073|       |
 1074|  2.26k|        if (method == e_unknown) {
  ------------------
  |  Branch (1074:13): [True: 2.23k, False: 25]
  ------------------
 1075|  2.23k|            if (!encp->encrypt_metadata && is_root_metadata) {
  ------------------
  |  Branch (1075:17): [True: 0, False: 2.23k]
  |  Branch (1075:44): [True: 0, False: 0]
  ------------------
 1076|      0|                method = e_none;
 1077|  2.23k|            } else {
 1078|  2.23k|                method = encp->cf_stream;
 1079|  2.23k|            }
 1080|  2.23k|        }
 1081|  2.26k|        use_aes = false;
 1082|  2.26k|        switch (method) {
 1083|    966|        case e_none:
  ------------------
  |  Branch (1083:9): [True: 966, False: 1.29k]
  ------------------
 1084|    966|            return;
 1085|      0|            break;
 1086|       |
 1087|  1.09k|        case e_aes:
  ------------------
  |  Branch (1087:9): [True: 1.09k, False: 1.16k]
  ------------------
 1088|  1.09k|            use_aes = true;
 1089|  1.09k|            break;
 1090|       |
 1091|      6|        case e_aesv3:
  ------------------
  |  Branch (1091:9): [True: 6, False: 2.25k]
  ------------------
 1092|      6|            use_aes = true;
 1093|      6|            break;
 1094|       |
 1095|     18|        case e_rc4:
  ------------------
  |  Branch (1095:9): [True: 18, False: 2.24k]
  ------------------
 1096|     18|            break;
 1097|       |
 1098|    179|        default:
  ------------------
  |  Branch (1098:9): [True: 179, False: 2.08k]
  ------------------
 1099|       |            // filter local to this stream.
 1100|    179|            qpdf_for_warning.warn(
 1101|    179|                {qpdf_e_damaged_pdf,
 1102|    179|                 file->getName(),
 1103|    179|                 "",
 1104|    179|                 file->getLastOffset(),
 1105|    179|                 "unknown encryption filter for streams (check " + method_source +
 1106|    179|                     "); streams may be decrypted improperly"});
 1107|       |            // To avoid repeated warnings, reset cf_stream.  Assume we'd want to use AES if V == 4.
 1108|    179|            encp->cf_stream = e_aes;
 1109|    179|            use_aes = true;
 1110|    179|            break;
 1111|  2.26k|        }
 1112|  2.26k|    }
 1113|  1.61k|    std::string key = getKeyForObject(encp, og, use_aes);
 1114|  1.61k|    if (use_aes) {
  ------------------
  |  Branch (1114:9): [True: 1.27k, False: 335]
  ------------------
 1115|  1.27k|        decrypt_pipeline =
 1116|  1.27k|            std::make_unique<Pl_AES_PDF>("AES stream decryption", pipeline, false, key);
 1117|  1.27k|    } else {
 1118|    335|        decrypt_pipeline = std::make_unique<Pl_RC4>("RC4 stream decryption", pipeline, key);
 1119|    335|    }
 1120|  1.61k|    pipeline = decrypt_pipeline.get();
 1121|  1.61k|}
_ZNK4QPDF22getTrimmedUserPasswordEv:
 1219|     56|{
 1220|     56|    std::string result = m->encp->user_password;
 1221|     56|    trim_user_password(result);
 1222|     56|    return result;
 1223|     56|}
QPDF_encryption.cc:_ZL16process_with_aesRKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEbS7_mjPKhm:
  323|  97.1k|{
  324|  97.1k|    Pl_Buffer buffer("buffer");
  325|  97.1k|    Pl_AES_PDF aes("aes", &buffer, encrypt, key);
  326|  97.1k|    if (iv) {
  ------------------
  |  Branch (326:9): [True: 96.7k, False: 392]
  ------------------
  327|  96.7k|        aes.setIV(iv, iv_length);
  328|  96.7k|    } else {
  329|    392|        aes.useZeroIV();
  330|    392|    }
  331|  97.1k|    aes.disablePadding();
  332|  6.29M|    for (unsigned int i = 0; i < repetitions; ++i) {
  ------------------
  |  Branch (332:30): [True: 6.19M, False: 97.1k]
  ------------------
  333|  6.19M|        aes.writeString(data);
  334|  6.19M|    }
  335|  97.1k|    aes.finish();
  336|  97.1k|    if (outlength == 0) {
  ------------------
  |  Branch (336:9): [True: 97.1k, False: 0]
  ------------------
  337|  97.1k|        return buffer.getString();
  338|  97.1k|    } else {
  339|      0|        return buffer.getString().substr(0, outlength);
  340|      0|    }
  341|  97.1k|}
QPDF_encryption.cc:_ZL27pad_or_truncate_password_V4NSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE:
  278|  2.18k|{
  279|  2.18k|    if (password.size() < key_bytes) {
  ------------------
  |  Branch (279:9): [True: 1.53k, False: 648]
  ------------------
  280|  1.53k|        password.append(padding_string);
  281|  1.53k|    }
  282|  2.18k|    password.resize(key_bytes);
  283|  2.18k|    return password;
  284|  2.18k|}
QPDF_encryption.cc:_ZL18iterate_md5_digestR3MD5ii:
  288|  2.18k|{
  289|  2.18k|    MD5::Digest digest;
  290|  2.18k|    md5.digest(digest);
  291|  2.18k|    auto len = std::min(QIntC::to_size(key_len), sizeof(digest));
  292|   106k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (292:21): [True: 104k, False: 2.18k]
  ------------------
  293|   104k|        MD5 m;
  294|   104k|        m.encodeDataIncrementally(reinterpret_cast<char*>(digest), len);
  295|   104k|        m.digest(digest);
  296|   104k|    }
  297|  2.18k|    return {reinterpret_cast<char*>(digest), len};
  298|  2.18k|}
QPDF_encryption.cc:_ZL19pad_short_parameterRNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEm:
  418|  5.09k|{
  419|  5.09k|    if (param.length() < max_len) {
  ------------------
  |  Branch (419:9): [True: 2.21k, False: 2.88k]
  ------------------
  420|  2.21k|        QTC::TC("qpdf", "QPDF_encryption pad short parameter");
  421|  2.21k|        param.append(max_len - param.length(), '\0');
  422|  2.21k|    }
  423|  5.09k|}
QPDF_encryption.cc:_ZL11iterate_rc4RNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEENS_17basic_string_viewIcS2_EEib:
  302|  1.72k|{
  303|  1.72k|    auto len = okey.size();
  304|  1.72k|    std::string key(len, '\0');
  305|  34.6k|    for (int i = 0; i < iterations; ++i) {
  ------------------
  |  Branch (305:21): [True: 32.9k, False: 1.72k]
  ------------------
  306|  32.9k|        int const xor_value = (reverse ? iterations - 1 - i : i);
  ------------------
  |  Branch (306:32): [True: 11.3k, False: 21.5k]
  ------------------
  307|   521k|        for (size_t j = 0; j < len; ++j) {
  ------------------
  |  Branch (307:28): [True: 488k, False: 32.9k]
  ------------------
  308|   488k|            key[j] = static_cast<char>(okey[j] ^ xor_value);
  309|   488k|        }
  310|  32.9k|        RC4::process(key, data);
  311|  32.9k|    }
  312|  1.72k|}
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_2clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  749|     53|    auto unsupported = [&file](std::string const& msg) -> QPDFExc {
  750|     53|        return {
  751|     53|            qpdf_e_unsupported,
  752|     53|            file->getName(),
  753|     53|            "encryption dictionary",
  754|     53|            file->getLastOffset(),
  755|     53|            msg};
  756|     53|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_1clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  746|     78|    auto throw_damaged_pdf = [&qpdf](std::string const& msg) {
  747|     78|        throw qpdf.m->c.damagedPDF("encryption dictionary", msg);
  748|     78|    };
QPDF_encryption.cc:_ZZN4QPDF20EncryptionParameters10initializeERS_ENK3$_0clERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  743|    195|    auto warn_damaged_pdf = [&qpdf, c](std::string const& msg) {
  744|    195|        qpdf.warn(c.damagedPDF("encryption dictionary", msg));
  745|    195|    };

_ZN13QPDFXRefEntryC2Ev:
   30|   468k|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|  1.03M|{
   43|  1.03M|    return type;
   44|  1.03M|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|   685k|{
   49|   685k|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|   685k|    return this->field1;
   51|   685k|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|   132k|{
   56|   132k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|   132k|    return QIntC::to_int(field1);
   58|   132k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  6.29k|{
  166|  6.29k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 2.54k, False: 3.75k]
  ------------------
  167|  2.54k|        return false;
  168|  2.54k|    }
  169|  9.55k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 5.80k, False: 3.75k]
  ------------------
  170|  5.80k|        version.append(1, *p++);
  171|  5.80k|    }
  172|  3.75k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 2.96k, False: 788]
  |  Branch (172:24): [True: 2.36k, False: 599]
  ------------------
  173|  1.38k|        return false;
  174|  1.38k|    }
  175|  2.36k|    version.append(1, *p++);
  176|  5.45k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 3.09k, False: 2.36k]
  ------------------
  177|  3.09k|        version.append(1, *p++);
  178|  3.09k|    }
  179|  2.36k|    return true;
  180|  3.75k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  6.29k|{
  185|  6.29k|    qpdf_offset_t global_offset = m->file->tell();
  186|  6.29k|    std::string line = m->file->readLine(1024);
  187|  6.29k|    char const* p = line.data();
  188|  6.29k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  6.29k|    p += 5;
  190|  6.29k|    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|  6.29k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 3.92k, False: 2.37k]
  ------------------
  194|  3.92k|        return false;
  195|  3.92k|    }
  196|  2.37k|    m->pdf_version = version;
  197|  2.37k|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 1.44k, False: 929]
  ------------------
  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.44k|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|  1.44k|    }
  203|  2.37k|    return true;
  204|  6.29k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  7.54k|{
  209|  7.54k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 7.13k, False: 416]
  |  Branch (209:9): [True: 5.73k, False: 1.81k]
  |  Branch (209:52): [True: 5.73k, False: 1.39k]
  ------------------
  210|       |        // Position in front of offset token
  211|  5.73k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  5.73k|        return true;
  213|  5.73k|    }
  214|  1.81k|    return false;
  215|  7.54k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  26.8k|{
  220|  26.8k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 26.8k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  26.8k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  26.8k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 24.4k, False: 2.37k]
  ------------------
  227|  24.4k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  24.4k|        m->pdf_version = "1.2";
  230|  24.4k|    }
  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|  26.8k|    m->file->seek(0, SEEK_END);
  235|  26.8k|    qpdf_offset_t end_offset = m->file->tell();
  236|  26.8k|    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|  26.8k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 26.8k, False: 5]
  ------------------
  240|  26.8k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  26.8k|    }
  242|  26.8k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 7.42k, False: 19.4k]
  ------------------
  243|  26.8k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  26.8k|    qpdf_offset_t xref_offset = 0;
  245|  26.8k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 5.25k, False: 21.5k]
  ------------------
  246|  5.25k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  5.25k|    }
  248|       |
  249|  26.8k|    try {
  250|  26.8k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 21.6k, False: 5.21k]
  ------------------
  251|  21.6k|            throw damagedPDF("", -1, "can't find startxref");
  252|  21.6k|        }
  253|  5.21k|        try {
  254|  5.21k|            read_xref(xref_offset);
  255|  5.21k|        } catch (QPDFExc&) {
  256|  4.06k|            throw;
  257|  4.06k|        } catch (std::exception& e) {
  258|    622|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    622|        }
  260|  26.2k|    } catch (QPDFExc& e) {
  261|  26.2k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 26.2k]
  ------------------
  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|  26.2k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 26.2k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  26.2k|        reconstruct_xref(e, xref_offset > 0);
  276|  26.2k|    }
  277|       |
  278|  12.5k|    m->encp->initialize(qpdf);
  279|  12.5k|    m->parsed = true;
  280|  12.5k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 11.7k, False: 776]
  |  Branch (280:9): [True: 5, False: 12.5k]
  |  Branch (280:35): [True: 5, False: 11.7k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|      5|        throw damagedPDF("", -1, "unable to find page tree");
  283|      5|    }
  284|  12.5k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 11.8k, False: 661]
  ------------------
  285|  11.8k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 10, False: 11.8k]
  ------------------
  286|     10|            throw damagedPDF("", -1, "no pages found");
  287|     10|        }
  288|  11.8k|        (void)m->cf.max_warnings(0);
  289|  11.8k|    }
  290|  12.5k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|  7.99M|{
  295|  7.99M|    util::internal_error_if(
  296|  7.99M|        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|  7.99M|    );
  300|  7.99M|    m->in_parse = v;
  301|  7.99M|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  7.25k|{
  306|  7.25k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 277, False: 6.98k]
  ------------------
  307|    277|        return;
  308|    277|    }
  309|  6.98k|    m->trailer = obj;
  310|  6.98k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  26.8k|{
  315|  26.8k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 396, False: 26.4k]
  ------------------
  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|    396|        throw e;
  319|    396|    }
  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|  26.4k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  26.4k|    auto check_warnings = [this, max_warnings]() {
  325|  26.4k|        if (m->warnings.size() > max_warnings) {
  326|  26.4k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  26.4k|        }
  328|  26.4k|    };
  329|       |
  330|  26.4k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  26.4k|    m->fixed_dangling_refs = false;
  333|       |
  334|  26.4k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  26.4k|    warn(e);
  336|  26.4k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  26.4k|    std::vector<QPDFObjGen> to_delete;
  340|  69.6k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 69.6k, False: 26.4k]
  ------------------
  341|  69.6k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 52.0k, False: 17.5k]
  ------------------
  342|  52.0k|            to_delete.emplace_back(iter.first);
  343|  52.0k|        }
  344|  69.6k|    }
  345|  52.0k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 52.0k, False: 26.4k]
  ------------------
  346|  52.0k|        m->xref_table.erase(iter);
  347|  52.0k|    }
  348|       |
  349|  26.4k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  26.4k|    std::vector<qpdf_offset_t> trailers;
  351|  26.4k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  26.4k|    m->file->seek(0, SEEK_END);
  354|  26.4k|    qpdf_offset_t eof = m->file->tell();
  355|  26.4k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  26.4k|    static size_t const MAX_LEN = 10;
  358|  2.28M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 2.26M, False: 26.4k]
  ------------------
  359|  2.26M|        QPDFTokenizer::Token t1 = m->objects.readToken(*m->file, MAX_LEN);
  360|  2.26M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  361|  2.26M|        if (t1.isInteger()) {
  ------------------
  |  Branch (361:13): [True: 605k, False: 1.65M]
  ------------------
  362|   605k|            auto pos = m->file->tell();
  363|   605k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   605k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 520k, False: 85.1k]
  |  Branch (364:17): [True: 355k, False: 250k]
  |  Branch (364:35): [True: 355k, False: 165k]
  ------------------
  365|   355k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|   355k|                int gen = QUtil::string_to_int(t2.getValue().c_str());
  367|   355k|                if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (367:21): [True: 353k, False: 1.49k]
  ------------------
  368|   353k|                    found_objects.emplace_back(obj, gen, token_start);
  369|   353k|                } else {
  370|  1.49k|                    warn(damagedPDF(
  371|  1.49k|                        "", -1, "ignoring object with impossibly large id " + std::to_string(obj)));
  372|  1.49k|                }
  373|   355k|            }
  374|   605k|            m->file->seek(pos, SEEK_SET);
  375|  1.65M|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (375:20): [True: 1.59M, False: 62.1k]
  |  Branch (375:20): [True: 30.6k, False: 1.62M]
  |  Branch (375:35): [True: 30.6k, False: 1.56M]
  ------------------
  376|  30.6k|            trailers.emplace_back(m->file->tell());
  377|  1.62M|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (377:20): [True: 1.41M, False: 207k]
  |  Branch (377:20): [True: 23.2k, False: 1.60M]
  |  Branch (377:40): [True: 23.2k, False: 1.39M]
  ------------------
  378|  23.2k|            startxrefs.emplace_back(m->file->tell());
  379|  23.2k|        }
  380|  2.26M|        check_warnings();
  381|  2.26M|        m->file->findAndSkipNextEOL();
  382|  2.26M|    }
  383|       |
  384|  26.4k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (384:9): [True: 21.8k, False: 4.60k]
  |  Branch (384:29): [True: 722, False: 21.1k]
  |  Branch (384:52): [True: 585, False: 137]
  ------------------
  385|    585|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (385:9): [True: 319, False: 266]
  ------------------
  386|    319|        auto xref_backup{m->xref_table};
  387|    319|        try {
  388|    319|            m->file->seek(startxrefs.back(), SEEK_SET);
  389|    319|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (389:22): [True: 205, False: 114]
  ------------------
  390|    205|                read_xref(offset);
  391|       |
  392|    205|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (392:21): [True: 7, False: 198]
  ------------------
  393|      7|                    warn(damagedPDF(
  394|      7|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  395|      7|                    m->encp->initialize(qpdf);
  396|      7|                    m->parsed = true;
  397|      7|                    m->reconstructed_xref = false;
  398|      7|                    return;
  399|      7|                }
  400|    205|            }
  401|    319|        } catch (...) {
  402|       |            // ok, bad luck. Do recovery.
  403|    197|        }
  404|    312|        m->xref_table = std::move(xref_backup);
  405|    312|    }
  406|       |
  407|  26.4k|    auto rend = found_objects.rend();
  408|   379k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (408:44): [True: 353k, False: 26.4k]
  ------------------
  409|   353k|        auto [obj, gen, token_start] = *it;
  410|   353k|        insertXrefEntry(obj, 1, token_start, gen);
  411|   353k|        check_warnings();
  412|   353k|    }
  413|  26.4k|    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|  26.4k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (417:21): [True: 10, False: 26.4k]
  ------------------
  418|  44.1k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (418:39): [True: 20.9k, False: 23.2k]
  ------------------
  419|  20.9k|        m->file->seek(*it, SEEK_SET);
  420|  20.9k|        auto t = readTrailer();
  421|  20.9k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (421:13): [True: 16.7k, False: 4.21k]
  ------------------
  422|       |            // Oh well.  It was worth a try.
  423|  16.7k|        } else {
  424|  4.21k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (424:17): [True: 3.23k, False: 975]
  ------------------
  425|  3.23k|                m->trailer = t;
  426|  3.23k|                break;
  427|  3.23k|            }
  428|    975|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  429|    975|        }
  430|  17.7k|        check_warnings();
  431|  17.7k|    }
  432|       |
  433|  26.4k|    if (!m->trailer) {
  ------------------
  |  Branch (433:9): [True: 22.3k, False: 4.05k]
  ------------------
  434|  22.3k|        qpdf_offset_t max_offset{0};
  435|  22.3k|        size_t max_size{0};
  436|       |        // If there are any xref streams, take the last one to appear.
  437|   120k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (437:30): [True: 120k, False: 22.3k]
  ------------------
  438|   120k|            auto entry = iter.second;
  439|   120k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (439:17): [True: 4.40k, False: 115k]
  ------------------
  440|  4.40k|                continue;
  441|  4.40k|            }
  442|   115k|            auto oh = qpdf.getObject(iter.first);
  443|   115k|            try {
  444|   115k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (444:21): [True: 106k, False: 9.17k]
  ------------------
  445|   106k|                    continue;
  446|   106k|                }
  447|   115k|            } catch (std::exception&) {
  448|  3.01k|                continue;
  449|  3.01k|            }
  450|  6.16k|            auto offset = entry.getOffset();
  451|  6.16k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  452|  6.16k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (452:17): [True: 4.75k, False: 1.41k]
  |  Branch (452:37): [True: 1.41k, False: 0]
  |  Branch (452:57): [True: 1.36k, False: 50]
  ------------------
  453|  6.11k|                max_offset = offset;
  454|  6.11k|                setTrailer(oh.getDict());
  455|  6.11k|            }
  456|  6.16k|            check_warnings();
  457|  6.16k|        }
  458|  22.3k|        if (max_offset > 0) {
  ------------------
  |  Branch (458:13): [True: 5.83k, False: 16.5k]
  ------------------
  459|  5.83k|            try {
  460|  5.83k|                read_xref(max_offset, true);
  461|  5.83k|            } catch (std::exception&) {
  462|  3.71k|                warn(damagedPDF(
  463|  3.71k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  464|  3.71k|            }
  465|  5.83k|            QTC::TC("qpdf", "QPDF recover xref stream");
  466|  5.78k|        }
  467|  22.3k|    }
  468|       |
  469|  26.4k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (469:9): [True: 16.6k, False: 9.79k]
  |  Branch (469:9): [True: 22.9k, False: 3.50k]
  |  Branch (469:25): [True: 9.72k, False: 74]
  |  Branch (469:39): [True: 6.35k, False: 3.37k]
  ------------------
  470|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  471|  22.9k|        QPDFObjectHandle root;
  472|   326k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (472:30): [True: 326k, False: 22.9k]
  ------------------
  473|   326k|            try {
  474|   326k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (474:21): [True: 10.1k, False: 316k]
  ------------------
  475|  10.1k|                    root = iter.second.object;
  476|  10.1k|                }
  477|   326k|            } catch (std::exception&) {
  478|  4.75k|                continue;
  479|  4.75k|            }
  480|   326k|        }
  481|  22.9k|        if (root) {
  ------------------
  |  Branch (481:13): [True: 9.97k, False: 12.9k]
  ------------------
  482|  9.97k|            if (!m->trailer) {
  ------------------
  |  Branch (482:17): [True: 9.06k, False: 909]
  ------------------
  483|  9.06k|                warn(damagedPDF(
  484|  9.06k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  485|  9.06k|                m->trailer = QPDFObjectHandle::newDictionary();
  486|  9.06k|            }
  487|  9.97k|            m->trailer.replaceKey("/Root", root);
  488|  9.97k|        }
  489|  22.9k|    }
  490|       |
  491|  26.4k|    if (!m->trailer) {
  ------------------
  |  Branch (491:9): [True: 7.48k, False: 18.9k]
  ------------------
  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.48k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  497|  7.48k|    }
  498|  18.9k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (498:9): [True: 549, False: 18.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|    549|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  502|    549|    }
  503|  18.3k|    check_warnings();
  504|  18.3k|    if (!m->parsed) {
  ------------------
  |  Branch (504:9): [True: 18.2k, False: 147]
  ------------------
  505|  18.2k|        m->parsed = !m->pages.empty();
  506|  18.2k|        if (!m->parsed) {
  ------------------
  |  Branch (506:13): [True: 798, False: 17.4k]
  ------------------
  507|    798|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  508|    798|        }
  509|  17.4k|        check_warnings();
  510|  17.4k|    }
  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|  18.3k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  521|  11.2k|{
  522|  11.2k|    std::map<int, int> free_table;
  523|  11.2k|    std::set<qpdf_offset_t> visited;
  524|  23.1k|    while (xref_offset) {
  ------------------
  |  Branch (524:12): [True: 12.2k, False: 10.9k]
  ------------------
  525|  12.2k|        visited.insert(xref_offset);
  526|  12.2k|        char buf[7];
  527|  12.2k|        memset(buf, 0, sizeof(buf));
  528|  12.2k|        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|  12.2k|        bool done = false;
  534|  12.2k|        bool skipped_space = false;
  535|  35.0k|        while (!done) {
  ------------------
  |  Branch (535:16): [True: 22.8k, False: 12.2k]
  ------------------
  536|  22.8k|            char ch;
  537|  22.8k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (537:17): [True: 22.2k, False: 558]
  ------------------
  538|  22.2k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (538:21): [True: 11.0k, False: 11.2k]
  ------------------
  539|  11.0k|                    skipped_space = true;
  540|  11.2k|                } else {
  541|  11.2k|                    m->file->unreadCh(ch);
  542|  11.2k|                    done = true;
  543|  11.2k|                }
  544|  22.2k|            } else {
  545|    558|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (545:73): [True: 1, False: 557]
  ------------------
  546|    558|                done = true;
  547|    558|            }
  548|  22.8k|        }
  549|       |
  550|  12.2k|        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|  12.2k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (553:13): [True: 1.77k, False: 10.4k]
  |  Branch (553:47): [True: 1.75k, False: 14]
  ------------------
  554|  1.75k|            if (skipped_space) {
  ------------------
  |  Branch (554:17): [True: 120, False: 1.63k]
  ------------------
  555|    120|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  556|    120|            }
  557|  1.75k|            QTC::TC(
  558|  1.75k|                "qpdf",
  559|  1.75k|                "QPDF xref space",
  560|  1.75k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (560:18): [True: 136, False: 1.62k]
  ------------------
  561|  1.75k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (561:24): [True: 1.31k, False: 308]
  ------------------
  562|  1.62k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (562:24): [True: 130, False: 178]
  ------------------
  563|    308|                                        : 9999));
  564|  1.75k|            int skip = 4;
  565|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  566|  3.65k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (566:20): [True: 1.89k, False: 1.75k]
  ------------------
  567|  1.89k|                ++skip;
  568|  1.89k|            }
  569|  1.75k|            xref_offset = read_xrefTable(xref_offset + skip);
  570|  10.4k|        } else {
  571|  10.4k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  572|  10.4k|        }
  573|  12.2k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (573:13): [True: 289, False: 11.9k]
  ------------------
  574|    289|            throw damagedPDF("", -1, "loop detected following xref tables");
  575|    289|        }
  576|  12.2k|    }
  577|       |
  578|  10.9k|    if (!m->trailer) {
  ------------------
  |  Branch (578:9): [True: 0, False: 10.9k]
  ------------------
  579|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  580|      0|    }
  581|  10.9k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  582|  10.9k|    int max_obj = 0;
  583|  10.9k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (583:9): [True: 2.39k, False: 8.56k]
  ------------------
  584|  2.39k|        max_obj = m->xref_table.rbegin()->first.getObj();
  585|  2.39k|    }
  586|  10.9k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (586:9): [True: 722, False: 10.2k]
  ------------------
  587|    722|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  588|    722|    }
  589|  10.9k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (589:9): [True: 8.74k, False: 2.20k]
  |  Branch (589:21): [True: 1.75k, False: 449]
  ------------------
  590|  2.21k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (590:13): [True: 114, False: 2.10k]
  |  Branch (590:13): [True: 16, False: 2.20k]
  |  Branch (590:38): [True: 16, False: 98]
  ------------------
  591|     16|            warn(damagedPDF(
  592|     16|                "",
  593|     16|                -1,
  594|     16|                "xref entry for the xref stream itself is missing - a common error handled "
  595|     16|                "correctly by qpdf and most other applications"));
  596|  2.20k|        } else {
  597|  2.20k|            warn(damagedPDF(
  598|  2.20k|                "",
  599|  2.20k|                -1,
  600|  2.20k|                ("reported number of objects (" + std::to_string(size) +
  601|  2.20k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  602|  2.20k|        }
  603|  2.21k|    }
  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|  10.9k|    m->deleted_objects.clear();
  608|       |
  609|       |    // Make sure we keep only the highest generation for any object.
  610|  10.9k|    QPDFObjGen last_og{-1, 0};
  611|   242k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (611:26): [True: 242k, False: 10.9k]
  ------------------
  612|   242k|        auto id = item.first.getObj();
  613|   242k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (613:13): [True: 5.34k, False: 237k]
  |  Branch (613:39): [True: 5.34k, False: 0]
  ------------------
  614|  5.34k|            qpdf.removeObject(last_og);
  615|  5.34k|        }
  616|   242k|        last_og = item.first;
  617|   242k|    }
  618|  10.9k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  622|  8.87k|{
  623|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  624|       |    // buffer.
  625|  8.87k|    char const* p = line.c_str();
  626|  8.87k|    char const* start = line.c_str();
  627|       |
  628|       |    // Skip zero or more spaces
  629|  10.2k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (629:12): [True: 1.39k, False: 8.87k]
  ------------------
  630|  1.39k|        ++p;
  631|  1.39k|    }
  632|       |    // Require digit
  633|  8.87k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (633:9): [True: 224, False: 8.64k]
  ------------------
  634|    224|        return false;
  635|    224|    }
  636|       |    // Gather digits
  637|  8.64k|    std::string obj_str;
  638|  27.3k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (638:12): [True: 18.7k, False: 8.64k]
  ------------------
  639|  18.7k|        obj_str.append(1, *p++);
  640|  18.7k|    }
  641|       |    // Require space
  642|  8.64k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (642:9): [True: 134, False: 8.51k]
  ------------------
  643|    134|        return false;
  644|    134|    }
  645|       |    // Skip spaces
  646|  22.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (646:12): [True: 13.9k, False: 8.51k]
  ------------------
  647|  13.9k|        ++p;
  648|  13.9k|    }
  649|       |    // Require digit
  650|  8.51k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (650:9): [True: 116, False: 8.39k]
  ------------------
  651|    116|        return false;
  652|    116|    }
  653|       |    // Gather digits
  654|  8.39k|    std::string num_str;
  655|  24.1k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (655:12): [True: 15.7k, False: 8.39k]
  ------------------
  656|  15.7k|        num_str.append(1, *p++);
  657|  15.7k|    }
  658|       |    // Skip any space including line terminators
  659|  21.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (659:12): [True: 13.0k, False: 8.39k]
  ------------------
  660|  13.0k|        ++p;
  661|  13.0k|    }
  662|  8.39k|    bytes = toI(p - start);
  663|  8.39k|    obj = QUtil::string_to_int(obj_str.c_str());
  664|  8.39k|    num = QUtil::string_to_int(num_str.c_str());
  665|  8.39k|    return true;
  666|  8.51k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  670|  7.94k|{
  671|       |    // Reposition after initial read attempt and reread.
  672|  7.94k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  673|  7.94k|    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|  7.94k|    char const* p = line.data();
  678|       |
  679|       |    // Skip zero or more spaces. There aren't supposed to be any.
  680|  7.94k|    bool invalid = false;
  681|  10.9k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (681:12): [True: 2.97k, False: 7.94k]
  ------------------
  682|  2.97k|        ++p;
  683|  2.97k|        invalid = true;
  684|  2.97k|    }
  685|       |    // Require digit
  686|  7.94k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (686:9): [True: 17, False: 7.93k]
  ------------------
  687|     17|        return false;
  688|     17|    }
  689|       |    // Gather digits
  690|  7.93k|    std::string f1_str;
  691|  36.6k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (691:12): [True: 28.7k, False: 7.93k]
  ------------------
  692|  28.7k|        f1_str.append(1, *p++);
  693|  28.7k|    }
  694|       |    // Require space
  695|  7.93k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (695:9): [True: 38, False: 7.89k]
  ------------------
  696|     38|        return false;
  697|     38|    }
  698|  7.89k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (698:9): [True: 2.26k, False: 5.62k]
  ------------------
  699|  2.26k|        invalid = true;
  700|  2.26k|    }
  701|       |    // Skip spaces
  702|  19.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (702:12): [True: 11.5k, False: 7.89k]
  ------------------
  703|  11.5k|        ++p;
  704|  11.5k|    }
  705|       |    // Require digit
  706|  7.89k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (706:9): [True: 52, False: 7.84k]
  ------------------
  707|     52|        return false;
  708|     52|    }
  709|       |    // Gather digits
  710|  7.84k|    std::string f2_str;
  711|  30.0k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (711:12): [True: 22.1k, False: 7.84k]
  ------------------
  712|  22.1k|        f2_str.append(1, *p++);
  713|  22.1k|    }
  714|       |    // Require space
  715|  7.84k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (715:9): [True: 52, False: 7.78k]
  ------------------
  716|     52|        return false;
  717|     52|    }
  718|  7.78k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (718:9): [True: 1.16k, False: 6.62k]
  ------------------
  719|  1.16k|        invalid = true;
  720|  1.16k|    }
  721|       |    // Skip spaces
  722|  17.6k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (722:12): [True: 9.81k, False: 7.78k]
  ------------------
  723|  9.81k|        ++p;
  724|  9.81k|    }
  725|  7.78k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (725:9): [True: 2.42k, False: 5.36k]
  |  Branch (725:24): [True: 5.21k, False: 148]
  ------------------
  726|  7.64k|        type = *p;
  727|  7.64k|    } else {
  728|    148|        return false;
  729|    148|    }
  730|  7.64k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (730:9): [True: 6.20k, False: 1.43k]
  |  Branch (730:36): [True: 558, False: 881]
  ------------------
  731|  6.76k|        invalid = true;
  732|  6.76k|    }
  733|       |
  734|  7.64k|    if (invalid) {
  ------------------
  |  Branch (734:9): [True: 6.77k, False: 867]
  ------------------
  735|  6.77k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  736|  6.77k|    }
  737|       |
  738|  7.64k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  739|  7.64k|    f2 = QUtil::string_to_int(f2_str.c_str());
  740|       |
  741|  7.64k|    return true;
  742|  7.78k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  748|  17.3k|{
  749|  17.3k|    std::array<char, 21> line;
  750|  17.3k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (750:9): [True: 191, False: 17.1k]
  ------------------
  751|       |        // C++20: [[unlikely]]
  752|    191|        return false;
  753|    191|    }
  754|  17.1k|    line[20] = '\0';
  755|  17.1k|    char const* p = line.data();
  756|       |
  757|  17.1k|    int f1_len = 0;
  758|  17.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|  93.2k|    while (*p == '0') {
  ------------------
  |  Branch (764:12): [True: 76.1k, False: 17.1k]
  ------------------
  765|  76.1k|        ++f1_len;
  766|  76.1k|        ++p;
  767|  76.1k|    }
  768|  57.7k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (768:12): [True: 40.6k, False: 17.1k]
  |  Branch (768:34): [True: 40.6k, False: 10]
  ------------------
  769|  40.6k|        f1 *= 10;
  770|  40.6k|        f1 += *p++ - '0';
  771|  40.6k|    }
  772|       |    // Require space
  773|  17.1k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (773:9): [True: 115, False: 17.0k]
  ------------------
  774|       |        // Entry doesn't start with space or digit.
  775|       |        // C++20: [[unlikely]]
  776|    115|        return false;
  777|    115|    }
  778|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  779|  58.7k|    while (*p == '0') {
  ------------------
  |  Branch (779:12): [True: 41.7k, False: 17.0k]
  ------------------
  780|  41.7k|        ++f2_len;
  781|  41.7k|        ++p;
  782|  41.7k|    }
  783|  38.8k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (783:12): [True: 22.3k, False: 16.4k]
  |  Branch (783:34): [True: 21.7k, False: 521]
  ------------------
  784|  21.7k|        f2 *= 10;
  785|  21.7k|        f2 += static_cast<int>(*p++ - '0');
  786|  21.7k|    }
  787|  17.0k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (787:9): [True: 16.1k, False: 813]
  |  Branch (787:34): [True: 3.89k, False: 12.3k]
  |  Branch (787:47): [True: 8.92k, False: 3.38k]
  ------------------
  788|       |        // C++20: [[likely]]
  789|  12.8k|        type = *p;
  790|       |        // No test for valid line[19].
  791|  12.8k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (791:13): [True: 12.4k, False: 350]
  |  Branch (791:23): [True: 12.3k, False: 82]
  |  Branch (791:34): [True: 9.47k, False: 2.90k]
  |  Branch (791:48): [True: 535, False: 2.37k]
  |  Branch (791:63): [True: 9.19k, False: 807]
  |  Branch (791:79): [True: 9.06k, False: 139]
  ------------------
  792|       |            // C++20: [[likely]]
  793|  9.06k|            return true;
  794|  9.06k|        }
  795|  12.8k|    }
  796|  7.94k|    return read_bad_xrefEntry(f1, f2, type);
  797|  17.0k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  802|  1.75k|{
  803|  1.75k|    m->file->seek(xref_offset, SEEK_SET);
  804|  1.75k|    std::string line;
  805|  8.90k|    while (true) {
  ------------------
  |  Branch (805:12): [True: 8.87k, Folded]
  ------------------
  806|  8.87k|        line.assign(50, '\0');
  807|  8.87k|        m->file->read(line.data(), line.size());
  808|  8.87k|        int obj = 0;
  809|  8.87k|        int num = 0;
  810|  8.87k|        int bytes = 0;
  811|  8.87k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (811:13): [True: 474, False: 8.39k]
  ------------------
  812|    474|            throw damagedPDF("xref table", "xref syntax invalid");
  813|    474|        }
  814|  8.39k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  815|  25.0k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (815:37): [True: 17.3k, False: 7.78k]
  ------------------
  816|  17.3k|            if (i == 0) {
  ------------------
  |  Branch (816:17): [True: 1.73k, False: 15.5k]
  ------------------
  817|       |                // This is needed by checkLinearization()
  818|  1.73k|                first_xref_item_offset_ = m->file->tell();
  819|  1.73k|            }
  820|       |            // For xref_table, these will always be small enough to be ints
  821|  17.3k|            qpdf_offset_t f1 = 0;
  822|  17.3k|            int f2 = 0;
  823|  17.3k|            char type = '\0';
  824|  17.3k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (824:17): [True: 613, False: 16.7k]
  ------------------
  825|    613|                throw damagedPDF(
  826|    613|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  827|    613|            }
  828|  16.7k|            if (type == 'f') {
  ------------------
  |  Branch (828:17): [True: 5.13k, False: 11.5k]
  ------------------
  829|  5.13k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  830|  11.5k|            } else {
  831|  11.5k|                insertXrefEntry(toI(i), 1, f1, f2);
  832|  11.5k|            }
  833|  16.7k|        }
  834|  7.78k|        qpdf_offset_t pos = m->file->tell();
  835|  7.78k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (835:13): [True: 631, False: 7.15k]
  ------------------
  836|    631|            break;
  837|  7.15k|        } else {
  838|  7.15k|            m->file->seek(pos, SEEK_SET);
  839|  7.15k|        }
  840|  7.78k|    }
  841|       |
  842|       |    // Set offset to previous xref table if any
  843|    668|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  844|    668|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (844:9): [True: 82, False: 586]
  ------------------
  845|     82|        throw damagedPDF("", "expected trailer dictionary");
  846|     82|    }
  847|       |
  848|    586|    if (!m->trailer) {
  ------------------
  |  Branch (848:9): [True: 510, False: 76]
  ------------------
  849|    510|        setTrailer(cur_trailer);
  850|       |
  851|    510|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (851:13): [True: 153, False: 357]
  ------------------
  852|    153|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  853|    153|        }
  854|    357|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (854:13): [True: 3, False: 354]
  ------------------
  855|      3|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  856|      3|        }
  857|    357|    }
  858|       |
  859|    430|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (859:9): [True: 17, False: 413]
  ------------------
  860|     17|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (860:13): [True: 0, False: 17]
  ------------------
  861|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  862|     17|        } else {
  863|     17|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (863:17): [True: 16, 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|     16|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  867|     16|            } else {
  868|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  869|      1|            }
  870|     17|        }
  871|     17|    }
  872|       |
  873|    429|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (873:9): [True: 164, False: 265]
  ------------------
  874|    164|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (874:13): [True: 2, False: 162]
  ------------------
  875|      2|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  876|      2|        }
  877|    162|        return cur_trailer.getKey("/Prev").getIntValue();
  878|    164|    }
  879|       |
  880|    265|    return 0;
  881|    429|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  886|  10.0k|{
  887|  10.0k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (887:9): [True: 10.0k, False: 0]
  ------------------
  888|  10.0k|        QPDFObjectHandle xref_obj;
  889|  10.0k|        try {
  890|  10.0k|            m->in_read_xref_stream = true;
  891|  10.0k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  892|  10.0k|        } catch (QPDFExc&) {
  893|       |            // ignore -- report error below
  894|  1.44k|        }
  895|  10.0k|        m->in_read_xref_stream = false;
  896|  10.0k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (896:13): [True: 7.76k, False: 2.23k]
  ------------------
  897|  7.76k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  898|  7.76k|        }
  899|  10.0k|    }
  900|       |
  901|  2.23k|    throw damagedPDF("", xref_offset, "xref not found");
  902|      0|    return 0; // unreachable
  903|  10.0k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  908|  7.76k|{
  909|  7.76k|    auto W_obj = dict.getKey("/W");
  910|  7.76k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (910:9): [True: 244, False: 7.52k]
  |  Branch (910:11): [True: 7.57k, False: 196]
  |  Branch (910:32): [True: 7.55k, False: 14]
  ------------------
  911|  7.55k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (911:11): [True: 7.54k, False: 12]
  |  Branch (911:48): [True: 7.52k, False: 22]
  ------------------
  912|    244|        throw damaged("Cross-reference stream does not have a proper /W key");
  913|    244|    }
  914|       |
  915|  7.52k|    std::array<int, 3> W;
  916|  7.52k|    int entry_size = 0;
  917|  7.52k|    auto w_vector = W_obj.getArrayAsVector();
  918|  7.52k|    int max_bytes = sizeof(qpdf_offset_t);
  919|  29.8k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (919:24): [True: 22.4k, False: 7.43k]
  ------------------
  920|  22.4k|        W[i] = w_vector[i].getIntValueAsInt();
  921|  22.4k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (921:13): [True: 32, False: 22.4k]
  ------------------
  922|     32|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  923|     32|        }
  924|  22.4k|        if (W[i] < 0) {
  ------------------
  |  Branch (924:13): [True: 55, False: 22.3k]
  ------------------
  925|     55|            throw damaged("Cross-reference stream's /W contains negative values");
  926|     55|        }
  927|  22.3k|        entry_size += W[i];
  928|  22.3k|    }
  929|  7.43k|    if (entry_size == 0) {
  ------------------
  |  Branch (929:9): [True: 3, False: 7.43k]
  ------------------
  930|      3|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  931|      3|    }
  932|  7.43k|    return {entry_size, W};
  933|  7.43k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  939|  7.43k|{
  940|       |    // Number of entries is limited by the highest possible object id and stream size.
  941|  7.43k|    auto max_num_entries = std::numeric_limits<int>::max();
  942|  7.43k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (942:9): [True: 0, False: 7.43k]
  ------------------
  943|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  944|      0|    }
  945|       |
  946|  7.43k|    auto Size_obj = dict.getKey("/Size");
  947|  7.43k|    long long size;
  948|  7.43k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (948:9): [True: 76, False: 7.35k]
  ------------------
  949|     76|        throw damaged("Cross-reference stream does not have a proper /Size key");
  950|  7.35k|    } else if (size < 0) {
  ------------------
  |  Branch (950:16): [True: 72, False: 7.28k]
  ------------------
  951|     72|        throw damaged("Cross-reference stream has a negative /Size key");
  952|  7.28k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (952:16): [True: 78, False: 7.20k]
  ------------------
  953|     78|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  954|     78|    }
  955|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  956|  7.20k|    return max_num_entries;
  957|  7.43k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  963|  7.20k|{
  964|  7.20k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  965|  7.20k|    auto Index_obj = dict.getKey("/Index");
  966|       |
  967|  7.20k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (967:9): [True: 761, False: 6.44k]
  ------------------
  968|    761|        std::vector<std::pair<int, int>> indx;
  969|    761|        int num_entries = 0;
  970|    761|        auto index_vec = Index_obj.getArrayAsVector();
  971|    761|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (971:13): [True: 9, False: 752]
  |  Branch (971:39): [True: 5, False: 747]
  ------------------
  972|     14|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  973|     14|        }
  974|       |
  975|    747|        int i = 0;
  976|    747|        long long first = 0;
  977|  9.13k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (977:23): [True: 9.13k, False: 460]
  ------------------
  978|  9.13k|            if (val.isInteger()) {
  ------------------
  |  Branch (978:17): [True: 9.11k, False: 20]
  ------------------
  979|  9.11k|                if (i % 2) {
  ------------------
  |  Branch (979:21): [True: 4.50k, False: 4.61k]
  ------------------
  980|  4.50k|                    auto count = val.getIntValue();
  981|  4.50k|                    if (count <= 0) {
  ------------------
  |  Branch (981:25): [True: 67, False: 4.43k]
  ------------------
  982|     67|                        throw damaged(
  983|     67|                            "Cross-reference stream section claims to contain " +
  984|     67|                            std::to_string(count) + " entries");
  985|     67|                    }
  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|  4.43k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (991:25): [True: 80, False: 4.35k]
  ------------------
  992|  4.35k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (992:25): [True: 20, False: 4.33k]
  ------------------
  993|    100|                        throw damaged(
  994|    100|                            "Cross-reference stream claims to contain too many entries: " +
  995|    100|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
  996|    100|                            std::to_string(num_entries));
  997|    100|                    }
  998|  4.33k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
  999|  4.33k|                    num_entries += static_cast<int>(count);
 1000|  4.61k|                } else {
 1001|  4.61k|                    first = val.getIntValue();
 1002|  4.61k|                    if (first < 0) {
  ------------------
  |  Branch (1002:25): [True: 28, False: 4.58k]
  ------------------
 1003|     28|                        throw damaged(
 1004|     28|                            "Cross-reference stream's /Index contains a negative object id");
 1005|  4.58k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1005:32): [True: 72, False: 4.51k]
  ------------------
 1006|     72|                        throw damaged(
 1007|     72|                            "Cross-reference stream's /Index contains an impossibly "
 1008|     72|                            "large object id");
 1009|     72|                    }
 1010|  4.61k|                }
 1011|  9.11k|            } else {
 1012|     20|                throw damaged(
 1013|     20|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1014|     20|                    " is not an integer");
 1015|     20|            }
 1016|  8.85k|            i++;
 1017|  8.85k|        }
 1018|    460|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1018:54): [True: 292, False: 168]
  ------------------
 1019|    460|        return {num_entries, indx};
 1020|  6.44k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1020:16): [True: 6.43k, False: 4]
  ------------------
 1021|  6.43k|        return {size, {{0, size}}};
 1022|  6.43k|    } else {
 1023|      4|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1024|      4|    }
 1025|  7.20k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1030|  7.76k|{
 1031|  7.76k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1032|  7.76k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1033|  7.76k|    };
 1034|       |
 1035|  7.76k|    auto dict = xref_obj.getDict();
 1036|       |
 1037|  7.76k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1038|  7.76k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1039|  7.76k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1040|       |
 1041|  7.76k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1042|  7.76k|    size_t actual_size = bp->getSize();
 1043|  7.76k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1044|       |
 1045|  7.76k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1045:9): [True: 4.15k, False: 3.61k]
  ------------------
 1046|  4.15k|        QPDFExc x = damaged(
 1047|  4.15k|            "Cross-reference stream data has the wrong size; expected = " +
 1048|  4.15k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1049|  4.15k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1049:13): [True: 780, False: 3.37k]
  ------------------
 1050|    780|            throw x;
 1051|  3.37k|        } else {
 1052|  3.37k|            warn(x);
 1053|  3.37k|        }
 1054|  4.15k|    }
 1055|       |
 1056|  6.98k|    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|  6.98k|    auto p = bp->getBuffer();
 1061|  6.98k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1061:33): [True: 5.90k, False: 6.98k]
  ------------------
 1062|       |        // Process a subsection.
 1063|  1.29M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1063:25): [True: 1.29M, False: 5.90k]
  ------------------
 1064|       |            // Read this entry
 1065|  1.29M|            std::array<qpdf_offset_t, 3> fields{};
 1066|  1.29M|            if (W[0] == 0) {
  ------------------
  |  Branch (1066:17): [True: 267k, False: 1.02M]
  ------------------
 1067|   267k|                fields[0] = 1;
 1068|   267k|            }
 1069|  5.17M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1069:32): [True: 3.88M, False: 1.29M]
  ------------------
 1070|  8.57M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1070:33): [True: 4.69M, False: 3.88M]
  ------------------
 1071|  4.69M|                    fields[j] <<= 8;
 1072|  4.69M|                    fields[j] |= *p++;
 1073|  4.69M|                }
 1074|  3.88M|            }
 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.29M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1078:17): [True: 977k, False: 316k]
  ------------------
 1079|   977k|                if (fields[0] != 2) {
  ------------------
  |  Branch (1079:21): [True: 491k, False: 485k]
  ------------------
 1080|   491k|                    uncompressed_after_compressed_ = true;
 1081|   491k|                }
 1082|   977k|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1082:24): [True: 2.06k, False: 314k]
  ------------------
 1083|  2.06k|                saw_first_compressed_object = true;
 1084|  2.06k|            }
 1085|  1.29M|            if (obj == 0) {
  ------------------
  |  Branch (1085:17): [True: 3.46k, False: 1.29M]
  ------------------
 1086|       |                // This is needed by checkLinearization()
 1087|  3.46k|                first_xref_item_offset_ = xref_offset;
 1088|  1.29M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1088:24): [True: 174k, False: 1.11M]
  ------------------
 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|   174k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1093|  1.11M|            } else {
 1094|  1.11M|                auto typ = toI(fields[0]);
 1095|  1.11M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1095:21): [True: 234k, False: 880k]
  |  Branch (1095:44): [True: 428k, False: 451k]
  ------------------
 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|   663k|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1100|   663k|                }
 1101|  1.11M|            }
 1102|  1.29M|            ++obj;
 1103|  1.29M|        }
 1104|  5.90k|    }
 1105|       |
 1106|  6.98k|    if (!m->trailer) {
  ------------------
  |  Branch (1106:9): [True: 638, False: 6.34k]
  ------------------
 1107|    638|        setTrailer(dict);
 1108|    638|    }
 1109|       |
 1110|  6.98k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1110:9): [True: 1.18k, False: 5.80k]
  ------------------
 1111|  1.18k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1111:13): [True: 88, False: 1.09k]
  ------------------
 1112|     88|            throw damagedPDF(
 1113|     88|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1114|     88|        }
 1115|  1.09k|        return dict.getKey("/Prev").getIntValue();
 1116|  5.80k|    } else {
 1117|  5.80k|        return 0;
 1118|  5.80k|    }
 1119|  6.98k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1123|  1.02M|{
 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.02M|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1130:19): [True: 487k, False: 540k]
  ------------------
 1131|       |
 1132|  1.02M|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1132:11): [True: 520k, False: 507k]
  |  Branch (1132:22): [True: 487k, False: 20.0k]
  ------------------
 1133|  20.0k|        return;
 1134|  20.0k|    }
 1135|       |
 1136|  1.00M|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1136:11): [True: 878k, False: 128k]
  |  Branch (1136:22): [True: 571k, False: 307k]
  |  Branch (1136:53): [True: 570k, False: 531]
  |  Branch (1136:64): [True: 554k, False: 16.5k]
  ------------------
 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|   453k|        return;
 1142|   453k|    }
 1143|       |
 1144|   554k|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1144:9): [True: 414, False: 553k]
  ------------------
 1145|    414|        return;
 1146|    414|    }
 1147|       |
 1148|   553k|    if (f0 == 2) {
  ------------------
  |  Branch (1148:9): [True: 260k, False: 293k]
  ------------------
 1149|   260k|        if (f1 == obj) {
  ------------------
  |  Branch (1149:13): [True: 467, False: 260k]
  ------------------
 1150|    467|            warn(
 1151|    467|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1152|    467|            return;
 1153|    467|        }
 1154|   260k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1154:13): [True: 4.72k, False: 255k]
  ------------------
 1155|       |            // ignore impossibly large object stream ids
 1156|  4.72k|            warn(damagedPDF(
 1157|  4.72k|                "xref stream",
 1158|  4.72k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1159|  4.72k|                    " is impossibly large"));
 1160|  4.72k|            return;
 1161|  4.72k|        }
 1162|   260k|    }
 1163|       |
 1164|   548k|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1164:71): [True: 255k, False: 293k]
  ------------------
 1165|   548k|    if (!created) {
  ------------------
  |  Branch (1165:9): [True: 79.7k, False: 468k]
  ------------------
 1166|  79.7k|        return;
 1167|  79.7k|    }
 1168|       |
 1169|   468k|    switch (f0) {
 1170|   224k|    case 1:
  ------------------
  |  Branch (1170:5): [True: 224k, False: 243k]
  ------------------
 1171|       |        // f2 is generation
 1172|   224k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1172:47): [True: 30.8k, False: 193k]
  ------------------
 1173|   224k|        iter->second = QPDFXRefEntry(f1);
 1174|   224k|        break;
 1175|       |
 1176|   243k|    case 2:
  ------------------
  |  Branch (1176:5): [True: 243k, False: 224k]
  ------------------
 1177|   243k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1178|   243k|        break;
 1179|       |
 1180|      0|    default:
  ------------------
  |  Branch (1180:5): [True: 0, False: 468k]
  ------------------
 1181|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1182|      0|        break;
 1183|   468k|    }
 1184|   468k|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1188|   180k|{
 1189|   180k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1189:9): [True: 178k, False: 1.62k]
  |  Branch (1189:40): [True: 43.0k, False: 135k]
  ------------------
 1190|  43.0k|        m->deleted_objects.insert(og.getObj());
 1191|  43.0k|    }
 1192|   180k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1224|  5.24k|{
 1225|  5.24k|    bool may_change = !m->reconstructed_xref;
 1226|   162k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1226:20): [True: 162k, False: 5.22k]
  ------------------
 1227|   162k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1227:13): [True: 87.3k, False: 75.5k]
  ------------------
 1228|  87.3k|            resolve(iter.first);
 1229|  87.3k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1229:17): [True: 878, False: 86.4k]
  |  Branch (1229:31): [True: 19, False: 859]
  ------------------
 1230|     19|                return false;
 1231|     19|            }
 1232|  87.3k|        }
 1233|   162k|    }
 1234|  5.22k|    return true;
 1235|  5.24k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1241|  45.7k|{
 1242|  45.7k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1242:9): [True: 40.5k, False: 5.22k]
  ------------------
 1243|  40.5k|        return;
 1244|  40.5k|    }
 1245|  5.22k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1245:9): [True: 19, False: 5.20k]
  ------------------
 1246|     19|        m->objects.resolveXRefTable();
 1247|     19|    }
 1248|  5.22k|    m->fixed_dangling_refs = true;
 1249|  5.22k|}
_ZN4QPDF14getObjectCountEv:
 1253|  45.7k|{
 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|  45.7k|    fixDanglingReferences();
 1258|  45.7k|    QPDFObjGen og;
 1259|  45.7k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1259:9): [True: 45.7k, False: 7]
  ------------------
 1260|  45.7k|        og = (*(m->obj_cache.rbegin())).first;
 1261|  45.7k|    }
 1262|  45.7k|    return QIntC::to_size(og.getObj());
 1263|  45.7k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1279|   329k|{
 1280|   329k|    m->last_object_description.clear();
 1281|   329k|    if (!description.empty()) {
  ------------------
  |  Branch (1281:9): [True: 8.68k, False: 321k]
  ------------------
 1282|  8.68k|        m->last_object_description += description;
 1283|  8.68k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1283:13): [True: 8.68k, False: 0]
  ------------------
 1284|  8.68k|            m->last_object_description += ": ";
 1285|  8.68k|        }
 1286|  8.68k|    }
 1287|   329k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1287:9): [True: 329k, False: 0]
  ------------------
 1288|   329k|        m->last_object_description += "object " + og.unparse(' ');
 1289|   329k|    }
 1290|   329k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1294|  21.6k|{
 1295|  21.6k|    qpdf_offset_t offset = m->file->tell();
 1296|  21.6k|    auto object =
 1297|  21.6k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1298|  21.6k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1298:9): [True: 4.71k, False: 16.9k]
  |  Branch (1298:9): [True: 175, False: 21.4k]
  |  Branch (1298:34): [True: 175, False: 4.54k]
  ------------------
 1299|    175|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1300|    175|    }
 1301|       |    // Override last_offset so that it points to the beginning of the object we just read
 1302|  21.6k|    m->file->setLastOffset(offset);
 1303|  21.6k|    return object;
 1304|  21.6k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1308|   168k|{
 1309|   168k|    setLastObjectDescription(description, og);
 1310|   168k|    qpdf_offset_t offset = m->file->tell();
 1311|       |
 1312|   168k|    StringDecrypter decrypter{&qpdf, og};
 1313|   168k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1313:38): [True: 6.83k, False: 162k]
  ------------------
 1314|   168k|    auto object = Parser::parse(
 1315|   168k|        *m->file,
 1316|   168k|        m->last_object_description,
 1317|   168k|        m->tokenizer,
 1318|   168k|        decrypter_ptr,
 1319|   168k|        qpdf,
 1320|   168k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1320:9): [True: 163k, False: 5.71k]
  |  Branch (1320:34): [True: 2.54k, False: 3.16k]
  ------------------
 1321|   168k|    if (!object) {
  ------------------
  |  Branch (1321:9): [True: 17.0k, False: 151k]
  ------------------
 1322|  17.0k|        return {};
 1323|  17.0k|    }
 1324|   151k|    auto token = readToken(*m->file);
 1325|   151k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1325:9): [True: 136k, False: 15.5k]
  |  Branch (1325:9): [True: 34.9k, False: 116k]
  |  Branch (1325:34): [True: 34.9k, False: 101k]
  ------------------
 1326|  34.9k|        readStream(object, og, offset);
 1327|  34.9k|        token = readToken(*m->file);
 1328|  34.9k|    }
 1329|   151k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1329:9): [True: 52.2k, False: 99.6k]
  ------------------
 1330|  52.2k|        warn(damagedPDF("expected endobj"));
 1331|  52.2k|    }
 1332|   151k|    return object;
 1333|   168k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1338|  34.9k|{
 1339|  34.9k|    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|  34.9k|    qpdf_offset_t stream_offset = m->file->tell();
 1344|  34.9k|    size_t length = 0;
 1345|       |
 1346|  34.9k|    try {
 1347|  34.9k|        auto length_obj = object.getKey("/Length");
 1348|       |
 1349|  34.9k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1349:13): [True: 17.9k, False: 17.0k]
  ------------------
 1350|  17.9k|            if (length_obj.null()) {
  ------------------
  |  Branch (1350:17): [True: 17.6k, False: 254]
  ------------------
 1351|  17.6k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1352|  17.6k|            }
 1353|    254|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1354|  17.9k|        }
 1355|       |
 1356|  17.0k|        length = toS(length_obj.getUIntValue());
 1357|       |        // Seek in two steps to avoid potential integer overflow
 1358|  17.0k|        m->file->seek(stream_offset, SEEK_SET);
 1359|  17.0k|        m->file->seek(toO(length), SEEK_CUR);
 1360|  17.0k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1360:13): [True: 5.49k, False: 11.5k]
  ------------------
 1361|  5.49k|            throw damagedPDF("expected endstream");
 1362|  5.49k|        }
 1363|  24.9k|    } catch (QPDFExc& e) {
 1364|  24.9k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1364:13): [True: 24.9k, False: 0]
  ------------------
 1365|  24.9k|            warn(e);
 1366|  24.9k|            length = recoverStreamLength(m->file, og, stream_offset);
 1367|  24.9k|        } else {
 1368|      0|            throw;
 1369|      0|        }
 1370|  24.9k|    }
 1371|  32.4k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1372|  32.4k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1376|  34.9k|{
 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|  48.2k|    while (true) {
  ------------------
  |  Branch (1384:12): [True: 48.2k, Folded]
  ------------------
 1385|  48.2k|        char ch;
 1386|  48.2k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1386:13): [True: 285, False: 47.9k]
  ------------------
 1387|       |            // A premature EOF here will result in some other problem that will get reported at
 1388|       |            // another time.
 1389|    285|            return;
 1390|    285|        }
 1391|  47.9k|        if (ch == '\n') {
  ------------------
  |  Branch (1391:13): [True: 10.0k, False: 37.8k]
  ------------------
 1392|       |            // ready to read stream data
 1393|  10.0k|            return;
 1394|  10.0k|        }
 1395|  37.8k|        if (ch == '\r') {
  ------------------
  |  Branch (1395:13): [True: 19.2k, False: 18.6k]
  ------------------
 1396|       |            // Read another character
 1397|  19.2k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1397:17): [True: 19.2k, False: 11]
  ------------------
 1398|  19.2k|                if (ch == '\n') {
  ------------------
  |  Branch (1398:21): [True: 17.3k, False: 1.89k]
  ------------------
 1399|       |                    // Ready to read stream data
 1400|  17.3k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1401|  17.3k|                } 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|  1.89k|                    m->file->unreadCh(ch);
 1405|  1.89k|                    warn(damagedPDF(
 1406|  1.89k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1407|  1.89k|                }
 1408|  19.2k|            }
 1409|  19.2k|            return;
 1410|  19.2k|        }
 1411|  18.6k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1411:13): [True: 5.23k, False: 13.3k]
  ------------------
 1412|  5.23k|            m->file->unreadCh(ch);
 1413|  5.23k|            warn(damagedPDF(
 1414|  5.23k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1415|  5.23k|            return;
 1416|  5.23k|        }
 1417|  13.3k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1418|  13.3k|    }
 1419|  34.9k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1423|  31.2k|{
 1424|       |    // Find endstream or endobj. Position the input at that token.
 1425|  31.2k|    auto t = readToken(*m->file, 20);
 1426|  31.2k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1426:9): [True: 15.0k, False: 16.1k]
  |  Branch (1426:9): [True: 22.0k, False: 9.18k]
  |  Branch (1426:31): [True: 6.98k, False: 9.18k]
  ------------------
 1427|  22.0k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1428|  22.0k|        return true;
 1429|  22.0k|    }
 1430|  9.18k|    return false;
 1431|  31.2k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1436|  22.7k|{
 1437|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1438|  22.7k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1439|       |
 1440|  22.7k|    PatternFinder ef(*this, &Objects::findEndstream);
 1441|  22.7k|    size_t length = 0;
 1442|  22.7k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1442:9): [True: 22.0k, False: 660]
  ------------------
 1443|  22.0k|        length = toS(m->file->tell() - stream_offset);
 1444|       |        // Reread endstream but, if it was endobj, don't skip that.
 1445|  22.0k|        QPDFTokenizer::Token t = readToken(*m->file);
 1446|  22.0k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1446:13): [True: 15.0k, False: 6.98k]
  ------------------
 1447|  15.0k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1448|  15.0k|        }
 1449|  22.0k|    }
 1450|       |
 1451|  22.7k|    if (length) {
  ------------------
  |  Branch (1451:9): [True: 21.4k, False: 1.25k]
  ------------------
 1452|  21.4k|        auto end = stream_offset + toO(length);
 1453|  21.4k|        qpdf_offset_t found_offset = 0;
 1454|  21.4k|        QPDFObjGen found_og;
 1455|       |
 1456|       |        // Make sure this is inside this object
 1457|   550k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1457:45): [True: 550k, False: 21.4k]
  ------------------
 1458|   550k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1458:17): [True: 518k, False: 31.7k]
  ------------------
 1459|   518k|                qpdf_offset_t obj_offset = entry.getOffset();
 1460|   518k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1460:21): [True: 366k, False: 151k]
  |  Branch (1460:50): [True: 100k, False: 265k]
  ------------------
 1461|   100k|                    found_offset = obj_offset;
 1462|   100k|                    found_og = current_og;
 1463|   100k|                }
 1464|   518k|            }
 1465|   550k|        }
 1466|  21.4k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1466:13): [True: 1.68k, False: 19.7k]
  |  Branch (1466:30): [True: 18.0k, False: 1.73k]
  ------------------
 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|  19.7k|        } else {
 1472|  1.73k|            length = 0;
 1473|  1.73k|        }
 1474|  21.4k|    }
 1475|       |
 1476|  22.7k|    if (length == 0) {
  ------------------
  |  Branch (1476:9): [True: 2.98k, False: 19.7k]
  ------------------
 1477|  2.98k|        warn(damagedPDF(
 1478|  2.98k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1479|  19.7k|    } else {
 1480|  19.7k|        warn(damagedPDF(
 1481|  19.7k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1482|  19.7k|    }
 1483|       |
 1484|  22.7k|    return length;
 1485|  22.7k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1489|  4.28M|{
 1490|  4.28M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1491|  4.28M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1495|   170k|{
 1496|   170k|    m->file->seek(offset, SEEK_SET);
 1497|   170k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1498|   170k|    bool objidok = tobjid.isInteger();
 1499|   170k|    if (!objidok) {
  ------------------
  |  Branch (1499:9): [True: 1.45k, False: 169k]
  ------------------
 1500|  1.45k|        throw damagedPDF(offset, "expected n n obj");
 1501|  1.45k|    }
 1502|   169k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1503|   169k|    bool genok = tgen.isInteger();
 1504|   169k|    if (!genok) {
  ------------------
  |  Branch (1504:9): [True: 135, False: 169k]
  ------------------
 1505|    135|        throw damagedPDF(offset, "expected n n obj");
 1506|    135|    }
 1507|   169k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1508|       |
 1509|   169k|    bool objok = tobj.isWord("obj");
 1510|       |
 1511|   169k|    if (!objok) {
  ------------------
  |  Branch (1511:9): [True: 172, False: 169k]
  ------------------
 1512|    172|        throw damagedPDF(offset, "expected n n obj");
 1513|    172|    }
 1514|   169k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1515|   169k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1516|   169k|    if (objid == 0) {
  ------------------
  |  Branch (1516:9): [True: 11, False: 169k]
  ------------------
 1517|     11|        throw damagedPDF(offset, "object with ID 0");
 1518|     11|    }
 1519|   169k|    return {objid, generation};
 1520|   169k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1525|   160k|{
 1526|   160k|    QPDFObjGen og;
 1527|   160k|    setLastObjectDescription(description, exp_og);
 1528|       |
 1529|   160k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1529:9): [True: 0, False: 160k]
  ------------------
 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|   160k|    if (offset == 0) {
  ------------------
  |  Branch (1537:9): [True: 108, False: 160k]
  ------------------
 1538|    108|        warn(damagedPDF(
 1539|    108|            -1,
 1540|    108|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1541|    108|            "applications"));
 1542|    108|        return;
 1543|    108|    }
 1544|       |
 1545|   160k|    try {
 1546|   160k|        og = read_object_start(offset);
 1547|   160k|        if (exp_og != og) {
  ------------------
  |  Branch (1547:13): [True: 91, False: 160k]
  ------------------
 1548|     91|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1549|     91|            if (try_recovery) {
  ------------------
  |  Branch (1549:17): [True: 91, False: 0]
  ------------------
 1550|       |                // Will be retried below
 1551|     91|                throw e;
 1552|     91|            } else {
 1553|       |                // We can try reading the object anyway even if the ID doesn't match.
 1554|      0|                warn(e);
 1555|      0|            }
 1556|     91|        }
 1557|   160k|    } catch (QPDFExc& e) {
 1558|    549|        if (!try_recovery) {
  ------------------
  |  Branch (1558:13): [True: 0, False: 549]
  ------------------
 1559|      0|            throw;
 1560|      0|        }
 1561|       |        // Try again after reconstructing xref table
 1562|    549|        reconstruct_xref(e);
 1563|    549|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1563:13): [True: 24, False: 525]
  |  Branch (1563:47): [True: 24, False: 0]
  ------------------
 1564|     24|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1565|     24|            readObjectAtOffset(false, new_offset, description, exp_og);
 1566|     24|            return;
 1567|     24|        }
 1568|    525|        warn(damagedPDF(
 1569|    525|            "",
 1570|    525|            -1,
 1571|    525|            ("object " + exp_og.unparse(' ') +
 1572|    525|             " not found in file after regenerating cross reference table")));
 1573|    525|        return;
 1574|    549|    }
 1575|       |
 1576|   160k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1576:14): [True: 135k, False: 24.2k]
  ------------------
 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|   135k|        qpdf_offset_t end_before_space = m->file->tell();
 1581|       |
 1582|       |        // skip over spaces
 1583|   315k|        while (true) {
  ------------------
  |  Branch (1583:16): [True: 315k, Folded]
  ------------------
 1584|   315k|            char ch;
 1585|   315k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1585:17): [True: 900, False: 314k]
  ------------------
 1586|    900|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1587|    900|            }
 1588|   314k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1588:17): [True: 135k, False: 179k]
  ------------------
 1589|   135k|                m->file->seek(-1, SEEK_CUR);
 1590|   135k|                break;
 1591|   135k|            }
 1592|   314k|        }
 1593|   135k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1594|   135k|    }
 1595|   160k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1600|  10.0k|{
 1601|  10.0k|    auto og = read_object_start(offset);
 1602|  10.0k|    auto oh = readObject(description, og);
 1603|       |
 1604|  10.0k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1604:9): [True: 1.48k, False: 8.57k]
  |  Branch (1604:16): [True: 5.98k, False: 2.58k]
  ------------------
 1605|  6.08k|        return oh;
 1606|  6.08k|    }
 1607|       |
 1608|  3.97k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1608:9): [True: 2.58k, False: 1.39k]
  |  Branch (1608:34): [True: 20, False: 2.56k]
  ------------------
 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|     20|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1634|     20|        return oh;
 1635|     20|    }
 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|  3.95k|    qpdf_offset_t end_before_space = m->file->tell();
 1641|       |
 1642|       |    // skip over spaces
 1643|  6.47k|    while (true) {
  ------------------
  |  Branch (1643:12): [True: 5.07k, Folded]
  ------------------
 1644|  5.07k|        char ch;
 1645|  5.07k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1645:13): [True: 116, False: 4.96k]
  ------------------
 1646|    116|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1647|    116|        }
 1648|  4.96k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1648:13): [True: 2.45k, False: 2.51k]
  ------------------
 1649|  2.45k|            m->file->seek(-1, SEEK_CUR);
 1650|  2.45k|            break;
 1651|  2.45k|        }
 1652|  4.96k|    }
 1653|  3.84k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1654|       |
 1655|  3.84k|    return oh;
 1656|  3.95k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1660|   470k|{
 1661|   470k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1661:9): [True: 0, False: 470k]
  ------------------
 1662|      0|        return m->obj_cache[og].object;
 1663|      0|    }
 1664|       |
 1665|   470k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1665:9): [True: 255, False: 470k]
  ------------------
 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|    255|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1669|    255|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1670|    255|        return m->obj_cache[og].object;
 1671|    255|    }
 1672|   470k|    ResolveRecorder rr(qpdf, og);
 1673|       |
 1674|   470k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 268k, False: 202k]
  ------------------
 1675|   268k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1676|   268k|        try {
 1677|   268k|            switch (entry.getType()) {
 1678|   160k|            case 1:
  ------------------
  |  Branch (1678:13): [True: 160k, False: 107k]
  ------------------
 1679|       |                // Object stored in cache by readObjectAtOffset
 1680|   160k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1681|   160k|                break;
 1682|       |
 1683|   107k|            case 2:
  ------------------
  |  Branch (1683:13): [True: 107k, False: 160k]
  ------------------
 1684|   107k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1685|   107k|                break;
 1686|       |
 1687|      4|            default:
  ------------------
  |  Branch (1687:13): [True: 4, False: 268k]
  ------------------
 1688|      4|                throw damagedPDF(
 1689|      4|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1690|   268k|            }
 1691|   268k|        } catch (QPDFExc& e) {
 1692|  34.7k|            warn(e);
 1693|  34.7k|        } catch (std::exception& e) {
 1694|    259|            warn(damagedPDF(
 1695|    259|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1696|    259|        }
 1697|   268k|    }
 1698|       |
 1699|   458k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1699:9): [True: 322k, False: 135k]
  ------------------
 1700|       |        // PDF spec says unknown objects resolve to the null object.
 1701|   322k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1702|   322k|    }
 1703|       |
 1704|   458k|    auto& result(m->obj_cache[og].object);
 1705|   458k|    result->setDefaultDescription(&qpdf, og);
 1706|   458k|    return result;
 1707|   470k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1711|   107k|{
 1712|   107k|    auto damaged =
 1713|   107k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1714|   107k|        return {
 1715|   107k|            qpdf_e_damaged_pdf,
 1716|   107k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1717|   107k|            +"object " + std::to_string(id) + " 0",
 1718|   107k|            offset,
 1719|   107k|            msg,
 1720|   107k|            true};
 1721|   107k|    };
 1722|       |
 1723|   107k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1723:9): [True: 80.4k, False: 26.8k]
  ------------------
 1724|  80.4k|        return;
 1725|  80.4k|    }
 1726|  26.8k|    m->resolved_object_streams.insert(obj_stream_number);
 1727|       |    // Force resolution of object stream
 1728|  26.8k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1729|  26.8k|    if (!obj_stream) {
  ------------------
  |  Branch (1729:9): [True: 21.9k, False: 4.90k]
  ------------------
 1730|  21.9k|        throw damagedPDF(
 1731|  21.9k|            "object " + std::to_string(obj_stream_number) + " 0",
 1732|  21.9k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1733|  21.9k|    }
 1734|       |
 1735|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1736|       |    // the stream.
 1737|  4.90k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1738|  4.90k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1739|  4.90k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1740|       |
 1741|  4.90k|    QPDFObjectHandle dict = obj_stream.getDict();
 1742|  4.90k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1742:9): [True: 992, False: 3.91k]
  ------------------
 1743|    992|        warn(damagedPDF(
 1744|    992|            "object " + std::to_string(obj_stream_number) + " 0",
 1745|    992|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1746|    992|    }
 1747|       |
 1748|  4.90k|    unsigned int n{0};
 1749|  4.90k|    int first{0};
 1750|  4.90k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1750:9): [True: 204, False: 4.70k]
  |  Branch (1750:11): [True: 1.41k, False: 3.49k]
  |  Branch (1750:50): [True: 1.36k, False: 50]
  ------------------
 1751|    204|        throw damagedPDF(
 1752|    204|            "object " + std::to_string(obj_stream_number) + " 0",
 1753|    204|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1754|    204|    }
 1755|       |
 1756|       |    // id, offset, size
 1757|  4.70k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1758|       |
 1759|  4.70k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1760|       |
 1761|  4.70k|    is::OffsetBuffer input("", stream_data);
 1762|       |
 1763|  4.70k|    const auto b_size = stream_data.size();
 1764|  4.70k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1765|  4.70k|    auto b_start = stream_data.data();
 1766|       |
 1767|  4.70k|    if (first >= end_offset) {
  ------------------
  |  Branch (1767:9): [True: 46, False: 4.65k]
  ------------------
 1768|     46|        throw damagedPDF(
 1769|     46|            "object " + std::to_string(obj_stream_number) + " 0",
 1770|     46|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1771|     46|    }
 1772|       |
 1773|  4.65k|    int id = 0;
 1774|  4.65k|    long long last_offset = -1;
 1775|  4.65k|    bool is_first = true;
 1776|  58.4k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1776:30): [True: 54.0k, False: 4.45k]
  ------------------
 1777|  54.0k|        auto tnum = readToken(input);
 1778|  54.0k|        auto id_offset = input.getLastOffset();
 1779|  54.0k|        auto toffset = readToken(input);
 1780|  54.0k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1780:15): [True: 53.8k, False: 133]
  |  Branch (1780:35): [True: 53.8k, False: 72]
  ------------------
 1781|    205|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1782|    205|        }
 1783|       |
 1784|  53.8k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1785|  53.8k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1786|       |
 1787|  53.8k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1787:13): [True: 366, False: 53.4k]
  ------------------
 1788|    366|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1789|    366|            continue;
 1790|    366|        }
 1791|       |
 1792|  53.4k|        if (num < 1) {
  ------------------
  |  Branch (1792:13): [True: 746, False: 52.7k]
  ------------------
 1793|    746|            warn(damaged(num, id_offset, "object id is invalid"s));
 1794|    746|            continue;
 1795|    746|        }
 1796|       |
 1797|  52.7k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1797:13): [True: 12.4k, False: 40.3k]
  ------------------
 1798|  12.4k|            warn(damaged(
 1799|  12.4k|                num,
 1800|  12.4k|                input.getLastOffset(),
 1801|  12.4k|                "offset " + std::to_string(offset) +
 1802|  12.4k|                    " is invalid (must be larger than previous offset " +
 1803|  12.4k|                    std::to_string(last_offset) + ")"));
 1804|  12.4k|            continue;
 1805|  12.4k|        }
 1806|       |
 1807|  40.3k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1807:13): [True: 1.60k, False: 38.7k]
  ------------------
 1808|  1.60k|            continue;
 1809|  1.60k|        }
 1810|       |
 1811|  38.7k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1811:13): [True: 7.25k, False: 31.4k]
  ------------------
 1812|  7.25k|            warn(damaged(
 1813|  7.25k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1814|  7.25k|            continue;
 1815|  7.25k|        }
 1816|       |
 1817|  31.4k|        if (is_first) {
  ------------------
  |  Branch (1817:13): [True: 917, False: 30.5k]
  ------------------
 1818|    917|            is_first = false;
 1819|  30.5k|        } else {
 1820|  30.5k|            offsets.emplace_back(
 1821|  30.5k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1822|  30.5k|        }
 1823|       |
 1824|  31.4k|        last_offset = offset;
 1825|  31.4k|        id = num;
 1826|  31.4k|    }
 1827|       |
 1828|  4.45k|    if (!is_first) {
  ------------------
  |  Branch (1828:9): [True: 771, False: 3.68k]
  ------------------
 1829|       |        // We found at least one valid entry.
 1830|    771|        offsets.emplace_back(
 1831|    771|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1832|    771|    }
 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|  27.2k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1838:52): [True: 27.2k, False: 4.45k]
  ------------------
 1839|  27.2k|        QPDFObjGen og(obj_id, 0);
 1840|  27.2k|        auto entry = m->xref_table.find(og);
 1841|  27.2k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1841:13): [True: 25.7k, False: 1.51k]
  |  Branch (1841:13): [True: 23.4k, False: 3.85k]
  |  Branch (1841:45): [True: 25.3k, False: 403]
  ------------------
 1842|  25.3k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1842:13): [True: 23.4k, False: 1.93k]
  ------------------
 1843|  23.4k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1844|  23.4k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1844:22): [True: 20.3k, False: 3.07k]
  ------------------
 1845|  20.3k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1846|  20.3k|            }
 1847|  23.4k|        } else {
 1848|  3.85k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1849|  3.85k|        }
 1850|  27.2k|    }
 1851|  4.45k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1855|  24.3k|{
 1856|  24.3k|    obj->setDefaultDescription(&qpdf, og);
 1857|  24.3k|    return {obj};
 1858|  24.3k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1867|   481k|{
 1868|   481k|    object->setObjGen(&qpdf, og);
 1869|   481k|    if (isCached(og)) {
  ------------------
  |  Branch (1869:9): [True: 388k, False: 92.7k]
  ------------------
 1870|   388k|        auto& cache = m->obj_cache[og];
 1871|   388k|        object->move_to(cache.object, destroy);
 1872|   388k|        cache.end_before_space = end_before_space;
 1873|   388k|        cache.end_after_space = end_after_space;
 1874|   388k|    } else {
 1875|  92.7k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1876|  92.7k|    }
 1877|   481k|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1881|  1.58M|{
 1882|  1.58M|    return m->obj_cache.contains(og);
 1883|  1.58M|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1887|  1.10M|{
 1888|  1.10M|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1888:12): [True: 238k, False: 861k]
  |  Branch (1888:29): [True: 644k, False: 217k]
  ------------------
 1889|  1.10M|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1893|  45.7k|{
 1894|  45.7k|    int max_objid = toI(qpdf.getObjectCount());
 1895|  45.7k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1895:9): [True: 19, False: 45.7k]
  ------------------
 1896|     19|        throw std::range_error("max object id is too high to create new objects");
 1897|     19|    }
 1898|  45.7k|    return {max_objid + 1, 0};
 1899|  45.7k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1903|  24.3k|{
 1904|  24.3k|    QPDFObjGen next{nextObjGen()};
 1905|  24.3k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1906|  24.3k|    return newIndirect(next, m->obj_cache[next].object);
 1907|  24.3k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1911|  24.3k|{
 1912|  24.3k|    if (!oh) {
  ------------------
  |  Branch (1912:9): [True: 0, False: 24.3k]
  ------------------
 1913|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1914|      0|    }
 1915|  24.3k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1916|  24.3k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1920|   668k|{
 1921|       |    // This method is called by the parser and therefore must not resolve any objects.
 1922|   668k|    auto og = QPDFObjGen(id, gen);
 1923|   668k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1923:44): [True: 315k, False: 353k]
  ------------------
 1924|   315k|        return iter->second.object;
 1925|   315k|    }
 1926|   353k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1926:9): [True: 111k, False: 241k]
  |  Branch (1926:40): [True: 223k, False: 17.8k]
  |  Branch (1926:54): [True: 211k, False: 12.2k]
  ------------------
 1927|   323k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1928|   323k|            .first->second.object;
 1929|   323k|    }
 1930|  30.1k|    if (parse_pdf) {
  ------------------
  |  Branch (1930:9): [True: 30.1k, False: 0]
  ------------------
 1931|  30.1k|        return QPDFObject::create<QPDF_Null>();
 1932|  30.1k|    }
 1933|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1934|  30.1k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1952|   142k|{
 1953|   142k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1953:42): [True: 60.6k, False: 82.1k]
  ------------------
 1954|  60.6k|        return {it->second.object};
 1955|  82.1k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1955:16): [True: 4.54k, False: 77.6k]
  |  Branch (1955:29): [True: 3.18k, False: 1.36k]
  ------------------
 1956|  3.18k|        return QPDFObject::create<QPDF_Null>();
 1957|  79.0k|    } else {
 1958|  79.0k|        auto result =
 1959|  79.0k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1960|  79.0k|        return {result.first->second.object};
 1961|  79.0k|    }
 1962|   142k|}
_ZN4QPDF13replaceObjectE10QPDFObjGen16QPDFObjectHandle:
 1972|    308|{
 1973|    308|    if (!oh || (oh.isIndirect() && !(oh.isStream() && oh.getObjGen() == og))) {
  ------------------
  |  Branch (1973:9): [True: 0, False: 308]
  |  Branch (1973:9): [True: 0, False: 308]
  |  Branch (1973:17): [True: 0, False: 308]
  |  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|    308|    m->objects.updateCache(og, oh.obj_sp(), -1, -1, false);
 1977|    308|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1981|  5.34k|{
 1982|  5.34k|    m->xref_table.erase(og);
 1983|  5.34k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1983:46): [True: 713, False: 4.63k]
  ------------------
 1984|       |        // Take care of any object handles that may be floating around.
 1985|    713|        cached->second.object->assign_null();
 1986|    713|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 1987|    713|        m->obj_cache.erase(cached);
 1988|    713|    }
 1989|  5.34k|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  76.3k|        o(o),
  148|  76.3k|        checker(checker)
  149|  76.3k|    {
  150|  76.3k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  45.0k|    {
  155|  45.0k|        return (this->o.*checker)();
  156|  45.0k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  2.67M|    auto check_warnings = [this, max_warnings]() {
  325|  2.67M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 2.67M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  2.67M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1031|  5.01k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1032|  5.01k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1033|  5.01k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   470k|        qpdf(qpdf),
  130|   470k|        iter(qpdf.m->resolving.insert(og).first)
  131|   470k|    {
  132|   470k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   470k|    {
  135|   470k|        qpdf.m->resolving.erase(iter);
  136|   470k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1713|  20.9k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1714|  20.9k|        return {
 1715|  20.9k|            qpdf_e_damaged_pdf,
 1716|  20.9k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1717|  20.9k|            +"object " + std::to_string(id) + " 0",
 1718|  20.9k|            offset,
 1719|  20.9k|            msg,
 1720|  20.9k|            true};
 1721|  20.9k|    };

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  24.6k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  24.6k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 19.5k, False: 5.11k]
  |  Branch (55:30): [True: 18.5k, False: 960]
  ------------------
   56|  18.5k|        ever_called_get_all_pages_ = true;
   57|  18.5k|        auto root = qpdf.getRoot();
   58|  18.5k|        QPDFObjGen::set visited;
   59|  18.5k|        QPDFObjGen::set seen;
   60|  18.5k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  18.5k|        bool warned = false;
   62|  18.5k|        bool changed_pages = false;
   63|  20.2k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 14.9k, False: 5.31k]
  |  Branch (63:16): [True: 1.69k, False: 18.5k]
  |  Branch (63:40): [True: 1.69k, False: 13.2k]
  ------------------
   64|  1.69k|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 51, False: 1.64k]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|     51|                break;
   67|     51|            }
   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|  1.64k|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 1.55k, False: 94]
  ------------------
   71|  1.55k|                root.warn(
   72|  1.55k|                    "document page tree root (root -> /Pages) doesn't point"
   73|  1.55k|                    " to the root of the page tree; attempting to correct");
   74|  1.55k|                warned = true;
   75|  1.55k|            }
   76|  1.64k|            changed_pages = true;
   77|  1.64k|            pages = pages.getKey("/Parent");
   78|  1.64k|        }
   79|  18.5k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 1.55k, False: 17.0k]
  ------------------
   80|  1.55k|            root.replaceKey("/Pages", pages);
   81|  1.55k|        }
   82|  18.5k|        seen.clear();
   83|  18.5k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 137, False: 18.4k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    137|            throw QPDFExc(
   86|    137|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    137|        }
   88|  18.4k|        try {
   89|  18.4k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  18.4k|        } catch (...) {
   91|     87|            all_pages.clear();
   92|     87|            invalid_page_found = false;
   93|     87|            throw;
   94|     87|        }
   95|  13.1k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 6.07k, False: 7.07k]
  ------------------
   96|  6.07k|            flattenPagesTree();
   97|  6.07k|            invalid_page_found = false;
   98|  6.07k|        }
   99|  13.1k|    }
  100|  19.2k|    return all_pages;
  101|  24.6k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  15.8k|{
  112|  15.8k|    static uint32_t constexpr max_level = 100;
  113|  15.8k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 15.8k]
  ------------------
  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|  15.8k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 27, False: 15.8k]
  ------------------
  122|     27|        throw QPDFExc(
  123|     27|            qpdf_e_pages,
  124|     27|            m->file->getName(),
  125|     27|            "object " + cur_node.getObjGen().unparse(' '),
  126|     27|            0,
  127|     27|            "Loop detected in /Pages structure (getAllPages)");
  128|     27|    }
  129|  15.8k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 10.9k, False: 4.84k]
  ------------------
  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.9k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  10.9k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  10.9k|    }
  136|  15.8k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 15.7k, False: 97]
  ------------------
  137|  15.7k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  15.7k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 3.43k, False: 12.2k]
  ------------------
  139|  15.7k|    }
  140|  15.8k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 15.7k, False: 84]
  ------------------
  141|  15.7k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  15.7k|    }
  143|  15.8k|    auto kids = cur_node.getKey("/Kids");
  144|  15.8k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 17, False: 15.8k]
  ------------------
  145|     17|        throw QPDFExc(
  146|     17|            qpdf_e_pages,
  147|     17|            m->file->getName(),
  148|     17|            "object " + cur_node.getObjGen().unparse(' '),
  149|     17|            0,
  150|     17|            "Loop detected in /Pages structure (getAllPages)");
  151|     17|    }
  152|  15.8k|    int i = -1;
  153|  87.0k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 87.0k, False: 15.8k]
  ------------------
  154|  87.0k|        ++i;
  155|  87.0k|        int errors = 0;
  156|       |
  157|  87.0k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 56.8k, False: 30.1k]
  ------------------
  158|  56.8k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  56.8k|            invalid_page_found = true;
  160|  56.8k|            continue;
  161|  56.8k|        }
  162|  30.1k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 1.84k, False: 28.3k]
  ------------------
  163|  1.84k|            cur_node.warn(
  164|  1.84k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  1.84k|            kid = qpdf.makeIndirectObject(kid);
  166|  1.84k|            ++errors;
  167|  1.84k|        }
  168|  30.1k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 2.61k, False: 27.5k]
  ------------------
  169|  2.61k|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  27.5k|        } else {
  171|  27.5k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 20.7k, False: 6.79k]
  |  Branch (171:17): [True: 9.23k, False: 18.3k]
  |  Branch (171:31): [True: 9.23k, False: 11.5k]
  ------------------
  172|  9.23k|                kid.warn(
  173|  9.23k|                    "kid " + std::to_string(i) +
  174|  9.23k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  9.23k|                kid.replaceKey(
  176|  9.23k|                    "/MediaBox",
  177|  9.23k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  9.23k|                ++errors;
  179|  9.23k|            }
  180|  27.5k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 21.4k, False: 6.09k]
  ------------------
  181|  21.4k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  21.4k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 11.9k, False: 9.51k]
  ------------------
  184|  11.9k|                    ++errors;
  185|  11.9k|                    kid.warn(
  186|  11.9k|                        "kid " + std::to_string(i) +
  187|  11.9k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  11.9k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  11.9k|                }
  190|  21.4k|            }
  191|  27.5k|            auto annots = kid.getKey("/Annots");
  192|  27.5k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 9.15k, False: 18.3k]
  ------------------
  193|  9.15k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 38, False: 9.11k]
  ------------------
  194|     38|                    kid.warn(
  195|     38|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     38|                    kid.removeKey("/Annots");
  197|     38|                    ++errors;
  198|  9.11k|                } else {
  199|  9.11k|                    QPDFObjGen::set seen_annots;
  200|   220k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 220k, False: 9.11k]
  ------------------
  201|   220k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 4.15k, False: 216k]
  ------------------
  202|  4.15k|                            kid.warn(
  203|  4.15k|                                "kid " + std::to_string(i) +
  204|  4.15k|                                " (from 0) Annots has duplicate entry for annotation " +
  205|  4.15k|                                annot.id_gen().unparse(' '));
  206|  4.15k|                            ++errors;
  207|  4.15k|                        }
  208|   220k|                    }
  209|  9.11k|                }
  210|  9.15k|            }
  211|       |
  212|  27.5k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 2.73k, False: 24.8k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  2.73k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 35, False: 2.70k]
  ------------------
  216|     35|                    cur_node.warn(
  217|     35|                        "kid " + std::to_string(i) +
  218|     35|                        " (from 0) appears more than once in the pages tree;"
  219|     35|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|     35|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|     35|                    seen.add(kid);
  224|  2.70k|                } else {
  225|  2.70k|                    cur_node.warn(
  226|  2.70k|                        "kid " + std::to_string(i) +
  227|  2.70k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  2.70k|                    invalid_page_found = true;
  229|  2.70k|                    kid = QPDFObjectHandle::newNull();
  230|  2.70k|                    continue;
  231|  2.70k|                }
  232|     35|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 15, False: 20]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|     15|                    ++errors;
  235|     15|                }
  236|     35|            }
  237|  24.8k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 11.2k, False: 13.5k]
  ------------------
  238|  11.2k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  11.2k|                kid.replaceKey("/Type", Name("/Page"));
  240|  11.2k|                ++errors;
  241|  11.2k|            }
  242|  24.8k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 23.9k, False: 875]
  |  Branch (242:42): [True: 1.13k, False: 22.8k]
  ------------------
  243|  1.13k|                cur_node.warn(
  244|  1.13k|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|  1.13k|                invalid_page_found = true;
  246|  1.13k|                kid = QPDFObjectHandle::newNull();
  247|  1.13k|                continue;
  248|  1.13k|            }
  249|  23.7k|            all_pages.emplace_back(kid);
  250|  23.7k|        }
  251|  30.1k|    }
  252|  15.8k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  6.07k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  6.07k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 6.07k]
  ------------------
  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|  6.07k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  6.07k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  6.07k|    size_t const len = all_pages.size();
  288|  20.5k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 14.4k, False: 6.07k]
  ------------------
  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|  14.4k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  14.4k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  14.4k|    }
  295|       |
  296|  6.07k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  6.07k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 4.90k, False: 1.16k]
  ------------------
  299|  4.90k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 4.90k, False: 0]
  |  Branch (299:13): [True: 4.87k, False: 30]
  |  Branch (299:35): [True: 4.87k, False: 30]
  ------------------
  300|  4.87k|            pages.replaceKey("/Count", Integer(len));
  301|  4.87k|        } else {
  302|     30|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     30|        }
  304|  4.90k|    }
  305|  6.07k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  6.07k|{
  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|  6.07k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 6.07k]
  |  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|  6.07k|    (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|  6.07k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  6.07k|    pushInheritedAttributesToPageInternal(
  333|  6.07k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  6.07k|        key_ancestors,
  335|  6.07k|        allow_changes,
  336|  6.07k|        warn_skipped_keys);
  337|  6.07k|    util::assertion(
  338|  6.07k|        key_ancestors.empty(),
  339|  6.07k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  6.07k|    pushed_inherited_attributes_to_pages = true;
  341|  6.07k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  6.07k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  8.38k|{
  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|  8.38k|    std::set<std::string> inheritable_keys;
  356|  31.0k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 31.0k, False: 8.38k]
  ------------------
  357|  31.0k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 600, False: 30.4k]
  |  Branch (357:35): [True: 46, False: 30.4k]
  |  Branch (357:56): [True: 632, False: 29.7k]
  |  Branch (357:79): [True: 630, False: 29.1k]
  ------------------
  358|  1.90k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 1.90k]
  ------------------
  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|  1.90k|            inheritable_keys.insert(key);
  370|  1.90k|            auto oh = cur_pages[key];
  371|  1.90k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 364, False: 1.54k]
  ------------------
  372|  1.90k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 1.54k, False: 364]
  ------------------
  373|  1.54k|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 704, False: 840]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    704|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    704|                    oh = cur_pages[key];
  378|    840|                } else {
  379|       |                    // It's okay to copy scalars.
  380|    840|                }
  381|  1.54k|            }
  382|  1.90k|            key_ancestors[key].emplace_back(oh);
  383|  1.90k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 225, False: 1.68k]
  ------------------
  384|    225|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  1.90k|            cur_pages.erase(key);
  387|  29.1k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 8.37k, False: 20.7k]
  |  Branch (387:40): [True: 1.13k, False: 19.6k]
  |  Branch (387:60): [True: 8.38k, False: 11.2k]
  |  Branch (387:78): [True: 6.32k, False: 4.91k]
  ------------------
  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|  4.91k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 4.91k, False: 0]
  |  Branch (390:17): [True: 1.11k, False: 3.80k]
  |  Branch (390:38): [True: 1.11k, False: 3.80k]
  ------------------
  391|  1.11k|                warn(
  392|  1.11k|                    qpdf_e_pages,
  393|  1.11k|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|  1.11k|                    cur_pages.offset(),
  395|  1.11k|                    ("Unknown key " + key +
  396|  1.11k|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|  1.11k|                     "tree"));
  398|  1.11k|            }
  399|  4.91k|        }
  400|  31.0k|    }
  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|  72.4k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 72.4k, False: 8.38k]
  ------------------
  406|  72.4k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 2.31k, False: 70.1k]
  ------------------
  407|  2.31k|            pushInheritedAttributesToPageInternal(
  408|  2.31k|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  70.1k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  70.1k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 16.0k, False: 70.1k]
  ------------------
  412|  16.0k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 13.5k, False: 2.41k]
  ------------------
  413|  13.5k|                    kid.replaceKey(key, values.back());
  414|  13.5k|                } else {
  415|  2.41k|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|  2.41k|                }
  417|  16.0k|            }
  418|  70.1k|        }
  419|  72.4k|    }
  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|  8.38k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 1.30k, False: 7.08k]
  ------------------
  426|  1.62k|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 1.62k, False: 1.30k]
  ------------------
  427|  1.62k|            key_ancestors[key].pop_back();
  428|  1.62k|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 1.40k, False: 221]
  ------------------
  429|  1.40k|                key_ancestors.erase(key);
  430|  1.40k|            }
  431|  1.62k|        }
  432|  7.08k|    } else {
  433|  7.08k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  7.08k|    }
  435|  8.38k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  14.4k|{
  440|  14.4k|    QPDFObjGen og(obj.getObjGen());
  441|  14.4k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 14.4k, False: 0]
  ------------------
  442|  14.4k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 14.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|  14.4k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  14.4k|}
_ZN22QPDFPageDocumentHelperC2ER4QPDF:
  584|  16.8k|    QPDFDocumentHelper(qpdf)
  585|  16.8k|{
  586|  16.8k|}
_ZN22QPDFPageDocumentHelper11getAllPagesEv:
  601|  14.6k|{
  602|  14.6k|    auto& pp = qpdf.doc().pages();
  603|  14.6k|    return {pp.begin(), pp.end()};
  604|  14.6k|}
_ZN22QPDFPageDocumentHelper18flattenAnnotationsEii:
  641|  9.47k|{
  642|  9.47k|    qpdf.doc().pages().flatten_annotations(required_flags, forbidden_flags);
  643|  9.47k|}
_ZN4QPDF3Doc5Pages19flatten_annotationsEii:
  647|  9.47k|{
  648|  9.47k|    auto& afdh = qpdf.doc().acroform();
  649|  9.47k|    if (afdh.getNeedAppearances()) {
  ------------------
  |  Branch (649:9): [True: 0, False: 9.47k]
  ------------------
  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|  20.1k|    for (QPDFPageObjectHelper ph: all()) {
  ------------------
  |  Branch (656:33): [True: 20.1k, False: 9.47k]
  ------------------
  657|  20.1k|        QPDFObjectHandle resources = ph.getAttribute("/Resources", true);
  658|  20.1k|        if (!resources.isDictionary()) {
  ------------------
  |  Branch (658:13): [True: 1.29k, False: 18.8k]
  ------------------
  659|       |            // As of #1521, this should be impossible unless a user inserted an invalid page.
  660|  1.29k|            resources = ph.getObjectHandle().replaceKeyAndGetNew("/Resources", Dictionary::empty());
  661|  1.29k|        }
  662|  20.1k|        flatten_annotations_for_page(ph, resources, afdh, required_flags, forbidden_flags);
  663|  20.1k|    }
  664|  9.47k|    if (!afdh.getNeedAppearances()) {
  ------------------
  |  Branch (664:9): [True: 9.33k, False: 144]
  ------------------
  665|  9.33k|        qpdf.getRoot().removeKey("/AcroForm");
  666|  9.33k|    }
  667|  9.47k|}
_ZN4QPDF3Doc5Pages28flatten_annotations_for_pageER20QPDFPageObjectHelperR16QPDFObjectHandleRN4qpdf4impl8AcroFormEii:
  676|  20.1k|{
  677|  20.1k|    bool need_appearances = afdh.getNeedAppearances();
  678|  20.1k|    std::vector<QPDFAnnotationObjectHelper> annots = page.getAnnotations();
  679|  20.1k|    std::vector<QPDFObjectHandle> new_annots;
  680|  20.1k|    std::string new_content;
  681|  20.1k|    int rotate = 0;
  682|  20.1k|    QPDFObjectHandle rotate_obj = page.getObjectHandle().getKey("/Rotate");
  683|  20.1k|    if (rotate_obj.isInteger() && rotate_obj.getIntValue()) {
  ------------------
  |  Branch (683:9): [True: 2.65k, False: 17.4k]
  |  Branch (683:35): [True: 384, False: 2.27k]
  ------------------
  684|    384|        rotate = rotate_obj.getIntValueAsInt();
  685|    384|    }
  686|  20.1k|    int next_fx = 1;
  687|  25.5k|    for (auto& aoh: annots) {
  ------------------
  |  Branch (687:19): [True: 25.5k, False: 20.1k]
  ------------------
  688|  25.5k|        QPDFObjectHandle as = aoh.getAppearanceStream("/N");
  689|  25.5k|        bool is_widget = (aoh.getSubtype() == "/Widget");
  690|  25.5k|        bool process = true;
  691|  25.5k|        if (need_appearances && is_widget) {
  ------------------
  |  Branch (691:13): [True: 0, False: 25.5k]
  |  Branch (691:33): [True: 0, False: 0]
  ------------------
  692|      0|            process = false;
  693|      0|        }
  694|  25.5k|        if (process && as.isStream()) {
  ------------------
  |  Branch (694:13): [True: 25.5k, False: 8]
  |  Branch (694:24): [True: 16.9k, False: 8.57k]
  ------------------
  695|  16.9k|            if (is_widget) {
  ------------------
  |  Branch (695:17): [True: 15.7k, False: 1.16k]
  ------------------
  696|  15.7k|                QPDFFormFieldObjectHelper ff = afdh.getFieldForAnnotation(aoh);
  697|  15.7k|                QPDFObjectHandle as_resources = as.getDict().getKey("/Resources");
  698|  15.7k|                if (as_resources.isIndirect()) {
  ------------------
  |  Branch (698:21): [True: 651, False: 15.1k]
  ------------------
  699|    651|                    ;
  700|    651|                    as.getDict().replaceKey("/Resources", as_resources.shallowCopy());
  701|    651|                    as_resources = as.getDict().getKey("/Resources");
  702|    651|                }
  703|  15.7k|                as_resources.mergeResources(ff.getDefaultResources());
  704|  15.7k|            } else {
  705|  1.16k|                QTC::TC("qpdf", "QPDFPageDocumentHelper non-widget annotation");
  706|  1.16k|            }
  707|  16.9k|            std::string name = resources.getUniqueResourceName("/Fxo", next_fx);
  708|  16.9k|            std::string content =
  709|  16.9k|                aoh.getPageContentForAppearance(name, rotate, required_flags, forbidden_flags);
  710|  16.9k|            if (!content.empty()) {
  ------------------
  |  Branch (710:17): [True: 12.1k, False: 4.81k]
  ------------------
  711|  12.1k|                resources.mergeResources(Dictionary({{"/XObject", Dictionary({{name, as}})}}));
  712|  12.1k|                resources.getKey("/XObject").replaceKey(name, as);
  713|  12.1k|                ++next_fx;
  714|  12.1k|            }
  715|  16.9k|            new_content += content;
  716|  16.9k|        } else if (process && !aoh.getAppearanceDictionary().null()) {
  ------------------
  |  Branch (716:20): [True: 8.57k, False: 8]
  |  Branch (716:20): [True: 2.61k, False: 5.97k]
  |  Branch (716:31): [True: 2.61k, False: 5.96k]
  ------------------
  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.97k|        } else {
  723|  5.97k|            new_annots.push_back(aoh.getObjectHandle());
  724|  5.97k|        }
  725|  25.5k|    }
  726|  20.1k|    if (new_annots.size() != annots.size()) {
  ------------------
  |  Branch (726:9): [True: 4.04k, False: 16.0k]
  ------------------
  727|  4.04k|        QPDFObjectHandle page_oh = page.getObjectHandle();
  728|  4.04k|        if (new_annots.empty()) {
  ------------------
  |  Branch (728:13): [True: 3.31k, False: 729]
  ------------------
  729|  3.31k|            page_oh.removeKey("/Annots");
  730|  3.31k|        } else {
  731|    729|            QPDFObjectHandle old_annots = page_oh.getKey("/Annots");
  732|    729|            QPDFObjectHandle new_annots_oh = QPDFObjectHandle::newArray(new_annots);
  733|    729|            if (old_annots.isIndirect()) {
  ------------------
  |  Branch (733:17): [True: 308, False: 421]
  ------------------
  734|    308|                qpdf.replaceObject(old_annots.getObjGen(), new_annots_oh);
  735|    421|            } else {
  736|    421|                page_oh.replaceKey("/Annots", new_annots_oh);
  737|    421|            }
  738|    729|        }
  739|  4.04k|        page.addPageContents(qpdf.newStream("q\n"), true);
  740|  4.04k|        page.addPageContents(qpdf.newStream("\nQ\n" + new_content), false);
  741|  4.04k|    }
  742|  20.1k|}

_ZN5QUtil18int_to_string_baseExii:
  343|  2.54M|{
  344|  2.54M|    return int_to_string_base_internal(num, base, length);
  345|  2.54M|}
_ZN5QUtil16double_to_stringEdib:
  355|   218k|{
  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|   218k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 145k, False: 72.8k]
  ------------------
  360|   145k|        decimal_places = 6;
  361|   145k|    }
  362|   218k|    std::ostringstream buf;
  363|   218k|    buf.imbue(std::locale::classic());
  364|   218k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|   218k|    std::string result = buf.str();
  366|   218k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 218k, False: 0]
  ------------------
  367|  1.27M|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 1.27M, False: 0]
  |  Branch (367:41): [True: 1.05M, False: 218k]
  ------------------
  368|  1.05M|            result.pop_back();
  369|  1.05M|        }
  370|   218k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 218k, False: 0]
  |  Branch (370:38): [True: 123k, False: 94.6k]
  ------------------
  371|   123k|            result.pop_back();
  372|   123k|        }
  373|   218k|    }
  374|   218k|    return result;
  375|   218k|}
_ZN5QUtil12string_to_llEPKc:
  379|  7.33M|{
  380|  7.33M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  7.33M|    long long result = strtoll(str, nullptr, 10);
  385|  7.33M|#endif
  386|  7.33M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 1.52k, False: 7.32M]
  ------------------
  387|  1.52k|        throw std::range_error(
  388|  1.52k|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|  1.52k|    }
  390|  7.32M|    return result;
  391|  7.33M|}
_ZN5QUtil13string_to_intEPKc:
  395|  1.18M|{
  396|       |    // QIntC::to_int does range checking
  397|  1.18M|    return QIntC::to_int(string_to_ll(str));
  398|  1.18M|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   104k|{
  448|   104k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   104k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  7.79k|{
  454|  7.79k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  7.79k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  7.79k|{
  718|  7.79k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  7.79k|    result.get()[str.length()] = '\0';
  721|  7.79k|    memcpy(result.get(), str.c_str(), str.length());
  722|  7.79k|    return result;
  723|  7.79k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  727|  13.1k|{
  728|  13.1k|    static auto constexpr hexchars = "0123456789abcdef";
  729|  13.1k|    std::string result;
  730|  13.1k|    result.reserve(2 * input.length());
  731|  7.97M|    for (const char c: input) {
  ------------------
  |  Branch (731:22): [True: 7.97M, False: 13.1k]
  ------------------
  732|  7.97M|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  733|  7.97M|        result += hexchars[c & 0x0f];
  734|  7.97M|    }
  735|  13.1k|    return result;
  736|  13.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|   332M|{
 1005|   332M|    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|   332M|    if (uval > 0x7fffffff) {
  ------------------
  |  Branch (1014:9): [True: 0, False: 332M]
  ------------------
 1015|      0|        throw std::runtime_error("bounds error in QUtil::toUTF8");
 1016|   332M|    } else if (uval < 128) {
  ------------------
  |  Branch (1016:16): [True: 56.8M, False: 275M]
  ------------------
 1017|  56.8M|        result += static_cast<char>(uval);
 1018|   275M|    } else {
 1019|   275M|        unsigned char bytes[7];
 1020|   275M|        bytes[6] = '\0';
 1021|   275M|        unsigned char* cur_byte = &bytes[5];
 1022|       |
 1023|       |        // maximum value that will fit in the current number of bytes
 1024|   275M|        unsigned char maxval = 0x3f; // six bits
 1025|       |
 1026|   818M|        while (uval > QIntC::to_ulong(maxval)) {
  ------------------
  |  Branch (1026:16): [True: 542M, False: 275M]
  ------------------
 1027|       |            // Assign low six bits plus 10000000 to lowest unused byte position, then shift
 1028|   542M|            *cur_byte = static_cast<unsigned char>(0x80 + (uval & 0x3f));
 1029|   542M|            uval >>= 6;
 1030|       |            // Maximum that will fit in high byte now shrinks by one bit
 1031|   542M|            maxval = static_cast<unsigned char>(maxval >> 1);
 1032|       |            // Slide to the left one byte
 1033|   542M|            if (cur_byte <= bytes) {
  ------------------
  |  Branch (1033:17): [True: 0, False: 542M]
  ------------------
 1034|      0|                throw std::logic_error("QUtil::toUTF8: overflow error");
 1035|      0|            }
 1036|   542M|            --cur_byte;
 1037|   542M|        }
 1038|       |        // If maxval is k bits long, the high (7 - k) bits of the resulting byte must be high.
 1039|   275M|        *cur_byte = static_cast<unsigned char>(QIntC::to_ulong(0xff - (1 + (maxval << 1))) + uval);
 1040|       |
 1041|   275M|        result += reinterpret_cast<char*>(cur_byte);
 1042|   275M|    }
 1043|       |
 1044|   332M|    return result;
 1045|   332M|}
_ZN5QUtil7toUTF16Em:
 1049|  10.4M|{
 1050|  10.4M|    std::string result;
 1051|  10.4M|    if ((uval >= 0xd800) && (uval <= 0xdfff)) {
  ------------------
  |  Branch (1051:9): [True: 4.38k, False: 10.4M]
  |  Branch (1051:29): [True: 218, False: 4.17k]
  ------------------
 1052|    218|        result = "\xff\xfd";
 1053|  10.4M|    } else if (uval <= 0xffff) {
  ------------------
  |  Branch (1053:16): [True: 10.4M, False: 1.27k]
  ------------------
 1054|  10.4M|        char out[2];
 1055|  10.4M|        out[0] = static_cast<char>((uval & 0xff00) >> 8);
 1056|  10.4M|        out[1] = static_cast<char>(uval & 0xff);
 1057|  10.4M|        result = std::string(out, 2);
 1058|  10.4M|    } else if (uval <= 0x10ffff) {
  ------------------
  |  Branch (1058:16): [True: 682, False: 594]
  ------------------
 1059|    682|        char out[4];
 1060|    682|        uval -= 0x10000;
 1061|    682|        unsigned short high = static_cast<unsigned short>(((uval & 0xffc00) >> 10) + 0xd800);
 1062|    682|        unsigned short low = static_cast<unsigned short>((uval & 0x3ff) + 0xdc00);
 1063|    682|        out[0] = static_cast<char>((high & 0xff00) >> 8);
 1064|    682|        out[1] = static_cast<char>(high & 0xff);
 1065|    682|        out[2] = static_cast<char>((low & 0xff00) >> 8);
 1066|    682|        out[3] = static_cast<char>(low & 0xff);
 1067|    682|        result = std::string(out, 4);
 1068|    682|    } else {
 1069|    594|        result = "\xff\xfd";
 1070|    594|    }
 1071|       |
 1072|  10.4M|    return result;
 1073|  10.4M|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    196|{
 1127|    196|    return getRandomDataProviderProvider()->getProvider();
 1128|    196|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    196|{
 1133|    196|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    196|}
_ZN5QUtil23get_next_utf8_codepointERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERmRb:
 1479|  52.4M|{
 1480|  52.4M|    auto o_pos = pos;
 1481|  52.4M|    size_t len = utf8_val.length();
 1482|  52.4M|    unsigned char ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1483|  52.4M|    error = false;
 1484|  52.4M|    if (ch < 128) {
  ------------------
  |  Branch (1484:9): [True: 31.2M, False: 21.1M]
  ------------------
 1485|  31.2M|        return static_cast<unsigned long>(ch);
 1486|  31.2M|    }
 1487|       |
 1488|  21.1M|    size_t bytes_needed = 0;
 1489|  21.1M|    unsigned bit_check = 0x40;
 1490|  21.1M|    unsigned char to_clear = 0x80;
 1491|  48.7M|    while (ch & bit_check) {
  ------------------
  |  Branch (1491:12): [True: 27.5M, False: 21.1M]
  ------------------
 1492|  27.5M|        ++bytes_needed;
 1493|  27.5M|        to_clear = static_cast<unsigned char>(to_clear | bit_check);
 1494|  27.5M|        bit_check >>= 1;
 1495|  27.5M|    }
 1496|  21.1M|    if (((bytes_needed > 5) || (bytes_needed < 1)) || ((pos + bytes_needed) > len)) {
  ------------------
  |  Branch (1496:10): [True: 559k, False: 20.6M]
  |  Branch (1496:32): [True: 8.28M, False: 12.3M]
  |  Branch (1496:55): [True: 461, False: 12.3M]
  ------------------
 1497|  8.84M|        error = true;
 1498|  8.84M|        return 0xfffd;
 1499|  8.84M|    }
 1500|       |
 1501|  12.3M|    auto codepoint = static_cast<unsigned long>(ch & ~to_clear);
 1502|  25.1M|    while (bytes_needed > 0) {
  ------------------
  |  Branch (1502:12): [True: 18.4M, False: 6.66M]
  ------------------
 1503|  18.4M|        --bytes_needed;
 1504|  18.4M|        ch = static_cast<unsigned char>(utf8_val.at(pos++));
 1505|  18.4M|        if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (1505:13): [True: 5.68M, False: 12.7M]
  ------------------
 1506|  5.68M|            --pos;
 1507|  5.68M|            error = true;
 1508|  5.68M|            return 0xfffd;
 1509|  5.68M|        }
 1510|  12.7M|        codepoint <<= 6;
 1511|  12.7M|        codepoint += (ch & 0x3f);
 1512|  12.7M|    }
 1513|  6.66M|    unsigned long lower_bound = 0;
 1514|  6.66M|    switch (pos - o_pos) {
 1515|   536k|    case 2:
  ------------------
  |  Branch (1515:5): [True: 536k, False: 6.12M]
  ------------------
 1516|   536k|        lower_bound = 1 << 7;
 1517|   536k|        break;
 1518|  6.12M|    case 3:
  ------------------
  |  Branch (1518:5): [True: 6.12M, False: 539k]
  ------------------
 1519|  6.12M|        lower_bound = 1 << 11;
 1520|  6.12M|        break;
 1521|  2.04k|    case 4:
  ------------------
  |  Branch (1521:5): [True: 2.04k, False: 6.66M]
  ------------------
 1522|  2.04k|        lower_bound = 1 << 16;
 1523|  2.04k|        break;
 1524|    702|    case 5:
  ------------------
  |  Branch (1524:5): [True: 702, False: 6.66M]
  ------------------
 1525|    702|        lower_bound = 1 << 12;
 1526|    702|        break;
 1527|    403|    case 6:
  ------------------
  |  Branch (1527:5): [True: 403, False: 6.66M]
  ------------------
 1528|    403|        lower_bound = 1 << 26;
 1529|    403|        break;
 1530|      0|    default:
  ------------------
  |  Branch (1530:5): [True: 0, False: 6.66M]
  ------------------
 1531|      0|        lower_bound = 0;
 1532|  6.66M|    }
 1533|       |
 1534|  6.66M|    if (lower_bound > 0 && codepoint < lower_bound) {
  ------------------
  |  Branch (1534:9): [True: 6.66M, False: 0]
  |  Branch (1534:28): [True: 1.36k, False: 6.66M]
  ------------------
 1535|       |        // Too many bytes were used, but return whatever character was encoded.
 1536|  1.36k|        error = true;
 1537|  1.36k|    }
 1538|  6.66M|    return codepoint;
 1539|  6.66M|}
_ZN5QUtil13utf8_to_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1637|    410|{
 1638|    410|    return transcode_utf8(utf8, e_utf16, 0);
 1639|    410|}
_ZN5QUtil13utf8_to_asciiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1643|  66.7k|{
 1644|  66.7k|    return transcode_utf8(utf8, e_ascii, unknown_char);
 1645|  66.7k|}
_ZN5QUtil16utf8_to_win_ansiERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1649|    786|{
 1650|    786|    return transcode_utf8(utf8, e_winansi, unknown_char);
 1651|    786|}
_ZN5QUtil17utf8_to_mac_romanERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEc:
 1655|    275|{
 1656|    275|    return transcode_utf8(utf8, e_macroman, unknown_char);
 1657|    275|}
_ZN5QUtil15utf8_to_pdf_docERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERS6_c:
 1685|  11.2k|{
 1686|  11.2k|    return transcode_utf8(utf8, pdfdoc, e_pdfdoc, unknown_char);
 1687|  11.2k|}
_ZN5QUtil8is_utf16ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1691|  33.8k|{
 1692|  33.8k|    return util::is_utf16(val);
 1693|  33.8k|}
_ZN5QUtil13utf16_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1703|  33.8k|{
 1704|  33.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|  33.8k|    unsigned long codepoint = 0L;
 1709|  33.8k|    size_t len = val.length();
 1710|  33.8k|    size_t start = 0;
 1711|  33.8k|    bool is_le = false;
 1712|  33.8k|    if (is_utf16(val)) {
  ------------------
  |  Branch (1712:9): [True: 33.8k, False: 0]
  ------------------
 1713|  33.8k|        if (static_cast<unsigned char>(val.at(0)) == 0xff) {
  ------------------
  |  Branch (1713:13): [True: 2.43k, False: 31.4k]
  ------------------
 1714|  2.43k|            is_le = true;
 1715|  2.43k|        }
 1716|  33.8k|        start += 2;
 1717|  33.8k|    }
 1718|       |    // If the string has an odd number of bytes, the last byte is ignored.
 1719|  39.0M|    for (size_t i = start; i + 1 < len; i += 2) {
  ------------------
  |  Branch (1719:28): [True: 38.9M, False: 33.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|  38.9M|        auto msb = is_le ? i + 1 : i;
  ------------------
  |  Branch (1724:20): [True: 367k, False: 38.6M]
  ------------------
 1725|  38.9M|        auto lsb = is_le ? i : i + 1;
  ------------------
  |  Branch (1725:20): [True: 367k, False: 38.6M]
  ------------------
 1726|  38.9M|        unsigned short bits = QIntC::to_ushort(
 1727|  38.9M|            (static_cast<unsigned char>(val.at(msb)) << 8) +
 1728|  38.9M|            static_cast<unsigned char>(val.at(lsb)));
 1729|  38.9M|        if ((bits & 0xFC00) == 0xD800) {
  ------------------
  |  Branch (1729:13): [True: 1.65k, False: 38.9M]
  ------------------
 1730|  1.65k|            codepoint = 0x10000U + ((bits & 0x3FFU) << 10U);
 1731|  1.65k|            continue;
 1732|  38.9M|        } else if ((bits & 0xFC00) == 0xDC00) {
  ------------------
  |  Branch (1732:20): [True: 3.21k, False: 38.9M]
  ------------------
 1733|  3.21k|            if (codepoint != 0) {
  ------------------
  |  Branch (1733:17): [True: 309, False: 2.90k]
  ------------------
 1734|    309|                QTC::TC("qpdf", "QUtil non-trivial UTF-16");
 1735|    309|            }
 1736|  3.21k|            codepoint += bits & 0x3FF;
 1737|  38.9M|        } else {
 1738|  38.9M|            codepoint = bits;
 1739|  38.9M|        }
 1740|       |
 1741|  38.9M|        result += QUtil::toUTF8(codepoint);
 1742|  38.9M|        codepoint = 0;
 1743|  38.9M|    }
 1744|  33.8k|    return result;
 1745|  33.8k|}
_ZN5QUtil15pdf_doc_to_utf8ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1781|   231k|{
 1782|   231k|    std::string result;
 1783|   231k|    size_t len = val.length();
 1784|   279M|    for (unsigned int i = 0; i < len; ++i) {
  ------------------
  |  Branch (1784:30): [True: 278M, False: 231k]
  ------------------
 1785|   278M|        unsigned char ch = static_cast<unsigned char>(val.at(i));
 1786|   278M|        unsigned short ch_short = ch;
 1787|   278M|        if ((ch >= 127) && (ch <= 160)) {
  ------------------
  |  Branch (1787:13): [True: 247M, False: 31.0M]
  |  Branch (1787:28): [True: 239M, False: 8.09M]
  ------------------
 1788|   239M|            ch_short = pdf_doc_to_unicode[ch - 127];
 1789|   239M|        } else if ((ch >= 24) && (ch <= 31)) {
  ------------------
  |  Branch (1789:20): [True: 30.2M, False: 8.85M]
  |  Branch (1789:34): [True: 1.04M, False: 29.2M]
  ------------------
 1790|  1.04M|            ch_short = pdf_doc_low_to_unicode[ch - 24];
 1791|  38.0M|        } else if (ch == 173) {
  ------------------
  |  Branch (1791:20): [True: 22.0k, False: 38.0M]
  ------------------
 1792|  22.0k|            ch_short = 0xfffd;
 1793|  22.0k|        }
 1794|   278M|        result += QUtil::toUTF8(ch_short);
 1795|   278M|    }
 1796|   231k|    return result;
 1797|   231k|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    196|{
 1113|       |    // Thread-safe static initializer
 1114|    196|    static RandomDataProviderProvider rdpp;
 1115|    196|    return &rdpp;
 1116|    196|}
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|    196|{
 1101|    196|    return this->current_provider;
 1102|    196|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE10encoding_ec:
 1629|  68.2k|{
 1630|  68.2k|    std::string result;
 1631|  68.2k|    transcode_utf8(utf8_val, result, encoding, unknown);
 1632|  68.2k|    return result;
 1633|  68.2k|}
QUtil.cc:_ZL14transcode_utf8RKNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEERS5_10encoding_ec:
 1543|  79.4k|{
 1544|  79.4k|    bool okay = true;
 1545|  79.4k|    result.clear();
 1546|  79.4k|    size_t len = utf8_val.length();
 1547|  79.4k|    switch (encoding) {
 1548|    410|    case e_utf16:
  ------------------
  |  Branch (1548:5): [True: 410, False: 79.0k]
  ------------------
 1549|    410|        result += "\xfe\xff";
 1550|    410|        break;
 1551|  11.2k|    case e_pdfdoc:
  ------------------
  |  Branch (1551:5): [True: 11.2k, False: 68.2k]
  ------------------
 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|  11.2k|        if ((len >= 4) && (utf8_val[0] == '\xc3')) {
  ------------------
  |  Branch (1558:13): [True: 9.81k, False: 1.43k]
  |  Branch (1558:27): [True: 832, False: 8.98k]
  ------------------
 1559|    832|            static std::string fe_ff("\xbe\xc3\xbf");
 1560|    832|            static std::string ff_fe("\xbf\xc3\xbe");
 1561|    832|            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|    832|            if ((utf8_val.compare(1, 3, fe_ff) == 0) || (utf8_val.compare(1, 3, ff_fe) == 0) ||
  ------------------
  |  Branch (1564:17): [True: 0, False: 832]
  |  Branch (1564:57): [True: 0, False: 832]
  ------------------
 1565|    832|                (utf8_val.compare(1, 5, ef_bb_bf) == 0)) {
  ------------------
  |  Branch (1565:17): [True: 0, False: 832]
  ------------------
 1566|      0|                result += unknown;
 1567|      0|                okay = false;
 1568|      0|            }
 1569|    832|        }
 1570|  11.2k|        break;
 1571|  67.8k|    default:
  ------------------
  |  Branch (1571:5): [True: 67.8k, False: 11.6k]
  ------------------
 1572|  67.8k|        break;
 1573|  79.4k|    }
 1574|  79.4k|    size_t pos = 0;
 1575|  52.5M|    while (pos < len) {
  ------------------
  |  Branch (1575:12): [True: 52.4M, False: 79.4k]
  ------------------
 1576|  52.4M|        bool error = false;
 1577|  52.4M|        unsigned long codepoint = QUtil::get_next_utf8_codepoint(utf8_val, pos, error);
 1578|  52.4M|        if (error) {
  ------------------
  |  Branch (1578:13): [True: 14.5M, False: 37.9M]
  ------------------
 1579|  14.5M|            okay = false;
 1580|  14.5M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1580:17): [True: 7.23M, False: 7.30M]
  ------------------
 1581|  7.23M|                result += "\xff\xfd";
 1582|  7.30M|            } else {
 1583|  7.30M|                result.append(1, unknown);
 1584|  7.30M|            }
 1585|  37.9M|        } else if (codepoint < 128) {
  ------------------
  |  Branch (1585:20): [True: 31.2M, False: 6.66M]
  ------------------
 1586|  31.2M|            char ch = static_cast<char>(codepoint);
 1587|  31.2M|            if (encoding == e_utf16) {
  ------------------
  |  Branch (1587:17): [True: 10.3M, False: 20.8M]
  ------------------
 1588|  10.3M|                result += QUtil::toUTF16(QIntC::to_ulong(ch));
 1589|  20.8M|            } else if ((encoding == e_pdfdoc) && (((ch >= 0x18) && (ch <= 0x1f)) || (ch == 127))) {
  ------------------
  |  Branch (1589:24): [True: 18.6M, False: 2.20M]
  |  Branch (1589:52): [True: 9.27M, False: 9.42M]
  |  Branch (1589:68): [True: 5.13M, False: 4.13M]
  |  Branch (1589:85): [True: 596k, False: 12.9M]
  ------------------
 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|  5.72M|                okay = false;
 1594|  5.72M|                result.append(1, unknown);
 1595|  15.1M|            } else {
 1596|  15.1M|                result.append(1, ch);
 1597|  15.1M|            }
 1598|  31.2M|        } else if (encoding == e_utf16) {
  ------------------
  |  Branch (1598:20): [True: 91.1k, False: 6.56M]
  ------------------
 1599|  91.1k|            result += QUtil::toUTF16(codepoint);
 1600|  6.56M|        } else if ((codepoint == 0xad) && (encoding == e_pdfdoc)) {
  ------------------
  |  Branch (1600:20): [True: 103, False: 6.56M]
  |  Branch (1600:43): [True: 85, False: 18]
  ------------------
 1601|       |            // PDFDocEncoding omits 0x00ad (soft hyphen).
 1602|     85|            okay = false;
 1603|     85|            result.append(1, unknown);
 1604|  6.56M|        } else if (
 1605|  6.56M|            (codepoint > 160) && (codepoint < 256) &&
  ------------------
  |  Branch (1605:13): [True: 6.56M, False: 298]
  |  Branch (1605:34): [True: 386k, False: 6.18M]
  ------------------
 1606|   386k|            ((encoding == e_winansi) || (encoding == e_pdfdoc))) {
  ------------------
  |  Branch (1606:14): [True: 6.77k, False: 379k]
  |  Branch (1606:41): [True: 113k, False: 266k]
  ------------------
 1607|   119k|            result.append(1, static_cast<char>(codepoint & 0xff));
 1608|  6.44M|        } else {
 1609|  6.44M|            unsigned char ch = '\0';
 1610|  6.44M|            if (encoding == e_winansi) {
  ------------------
  |  Branch (1610:17): [True: 3.52M, False: 2.92M]
  ------------------
 1611|  3.52M|                ch = encode_winansi(codepoint);
 1612|  3.52M|            } else if (encoding == e_macroman) {
  ------------------
  |  Branch (1612:24): [True: 4.15k, False: 2.92M]
  ------------------
 1613|  4.15k|                ch = encode_macroman(codepoint);
 1614|  2.92M|            } else if (encoding == e_pdfdoc) {
  ------------------
  |  Branch (1614:24): [True: 1.05M, False: 1.87M]
  ------------------
 1615|  1.05M|                ch = encode_pdfdoc(codepoint);
 1616|  1.05M|            }
 1617|  6.44M|            if (ch == '\0') {
  ------------------
  |  Branch (1617:17): [True: 5.05M, False: 1.39M]
  ------------------
 1618|  5.05M|                okay = false;
 1619|  5.05M|                ch = static_cast<unsigned char>(unknown);
 1620|  5.05M|            }
 1621|  6.44M|            result.append(1, static_cast<char>(ch));
 1622|  6.44M|        }
 1623|  52.4M|    }
 1624|  79.4k|    return okay;
 1625|  79.4k|}
QUtil.cc:_ZL14encode_winansim:
 1449|  3.52M|{
 1450|  3.52M|    auto i = unicode_to_win_ansi.find(codepoint);
 1451|  3.52M|    if (i != unicode_to_win_ansi.end()) {
  ------------------
  |  Branch (1451:9): [True: 427k, False: 3.09M]
  ------------------
 1452|   427k|        return i->second;
 1453|   427k|    }
 1454|  3.09M|    return '\0';
 1455|  3.52M|}
QUtil.cc:_ZL15encode_macromanm:
 1459|  4.15k|{
 1460|  4.15k|    auto i = unicode_to_mac_roman.find(codepoint);
 1461|  4.15k|    if (i != unicode_to_mac_roman.end()) {
  ------------------
  |  Branch (1461:9): [True: 2.51k, False: 1.64k]
  ------------------
 1462|  2.51k|        return i->second;
 1463|  2.51k|    }
 1464|  1.64k|    return '\0';
 1465|  4.15k|}
QUtil.cc:_ZL13encode_pdfdocm:
 1469|  1.05M|{
 1470|  1.05M|    auto i = unicode_to_pdf_doc.find(codepoint);
 1471|  1.05M|    if (i != unicode_to_pdf_doc.end()) {
  ------------------
  |  Branch (1471:9): [True: 963k, False: 87.5k]
  ------------------
 1472|   963k|        return i->second;
 1473|   963k|    }
 1474|  87.5k|    return '\0';
 1475|  1.05M|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  300|  2.54M|{
  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|  2.54M|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (304:11): [True: 2.54M, 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|  2.54M|    std::string cvt;
  308|  2.54M|    if (base == 10) {
  ------------------
  |  Branch (308:9): [True: 0, False: 2.54M]
  ------------------
  309|       |        // Use the more efficient std::to_string when possible
  310|      0|        cvt = std::to_string(num);
  311|  2.54M|    } else {
  312|  2.54M|        std::ostringstream buf;
  313|  2.54M|        buf.imbue(std::locale::classic());
  314|  2.54M|        buf << std::setbase(base) << std::nouppercase << num;
  315|  2.54M|        cvt = buf.str();
  316|  2.54M|    }
  317|  2.54M|    std::string result;
  318|  2.54M|    int str_length = QIntC::to_int(cvt.length());
  319|  2.54M|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (319:9): [True: 2.54M, False: 0]
  |  Branch (319:25): [True: 13.6k, False: 2.53M]
  ------------------
  320|  13.6k|        result.append(QIntC::to_size(length - str_length), '0');
  321|  13.6k|    }
  322|  2.54M|    result += cvt;
  323|  2.54M|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (323:9): [True: 0, False: 2.54M]
  |  Branch (323:25): [True: 0, False: 0]
  ------------------
  324|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  325|      0|    }
  326|  2.54M|    return result;
  327|  2.54M|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  30.4k|{
   14|  30.4k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 22.3k, False: 8.08k]
  ------------------
   15|  22.3k|        return true;
   16|  22.3k|    }
   17|       |
   18|  8.08k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  8.08k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  16.0k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 16.0k, False: 7.92k]
  ------------------
   22|  16.0k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  16.0k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 5.30k, False: 10.7k]
  ------------------
   24|  5.30k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 5.29k, False: 10]
  ------------------
   25|  5.29k|                predictor = value.getIntValueAsInt();
   26|  5.29k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 211, False: 5.08k]
  |  Branch (26:41): [True: 1.11k, False: 3.96k]
  |  Branch (26:60): [True: 3.92k, False: 38]
  |  Branch (26:79): [True: 3.89k, False: 35]
  ------------------
   27|     73|                    return false;
   28|     73|                }
   29|  5.29k|            } else {
   30|     10|                return false;
   31|     10|            }
   32|  10.7k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 4.33k, False: 6.42k]
  |  Branch (32:41): [True: 662, False: 5.76k]
  |  Branch (32:61): [True: 495, False: 5.26k]
  ------------------
   33|  5.49k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 5.48k, False: 10]
  ------------------
   34|  5.48k|                int val = value.getIntValueAsInt();
   35|  5.48k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 5.48k, False: 1]
  |  Branch (35:37): [True: 23, False: 5.45k]
  ------------------
   36|     23|                    QPDFLogger::defaultLogger()->warn(
   37|     23|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     23|                    return false;
   39|     23|                }
   40|  5.46k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 4.32k, False: 1.13k]
  ------------------
   41|  4.32k|                    columns = val;
   42|  4.32k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 639, False: 496]
  ------------------
   43|    639|                    colors = val;
   44|    639|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 495, False: 1]
  ------------------
   45|    495|                    bits_per_component = val;
   46|    495|                }
   47|  5.46k|            } else {
   48|     10|                return false;
   49|     10|            }
   50|  5.49k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 4.67k, False: 592]
  |  Branch (50:27): [True: 181, False: 4.49k]
  ------------------
   51|    181|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 175, False: 6]
  ------------------
   52|    175|                int earlychange = value.getIntValueAsInt();
   53|    175|                early_code_change = (earlychange == 1);
   54|    175|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 68, False: 107]
  |  Branch (54:43): [True: 66, False: 41]
  ------------------
   55|     41|                    return false;
   56|     41|                }
   57|    175|            } else {
   58|      6|                return false;
   59|      6|            }
   60|    181|        }
   61|  16.0k|    }
   62|       |
   63|  7.92k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 5.01k, False: 2.91k]
  |  Branch (63:26): [True: 10, False: 5.00k]
  ------------------
   64|     10|        return false;
   65|     10|    }
   66|       |
   67|  7.91k|    return true;
   68|  7.92k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  30.2k|{
   73|  30.2k|    std::unique_ptr<Pipeline> pipeline;
   74|  30.2k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 3.87k, False: 26.4k]
  |  Branch (74:28): [True: 3.87k, False: 0]
  ------------------
   75|  3.87k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  3.87k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  3.87k|            "png decode",
   78|  3.87k|            next,
   79|  3.87k|            Pl_PNGFilter::a_decode,
   80|  3.87k|            QIntC::to_uint(columns),
   81|  3.87k|            QIntC::to_uint(colors),
   82|  3.87k|            QIntC::to_uint(bits_per_component));
   83|  3.87k|        next = pipeline.get();
   84|  3.87k|        pipelines.push_back(std::move(pipeline));
   85|  26.4k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 1.10k, False: 25.3k]
  ------------------
   86|  1.10k|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|  1.10k|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|  1.10k|            "tiff decode",
   89|  1.10k|            next,
   90|  1.10k|            Pl_TIFFPredictor::a_decode,
   91|  1.10k|            QIntC::to_uint(columns),
   92|  1.10k|            QIntC::to_uint(colors),
   93|  1.10k|            QIntC::to_uint(bits_per_component));
   94|  1.10k|        next = pipeline.get();
   95|  1.10k|        pipelines.push_back(std::move(pipeline));
   96|  1.10k|    }
   97|       |
   98|  30.2k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 8.35k, False: 21.9k]
  ------------------
   99|  8.35k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  21.9k|    } else {
  101|  21.9k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  21.9k|    }
  103|  30.2k|    next = pipeline.get();
  104|  30.2k|    pipelines.push_back(std::move(pipeline));
  105|  30.2k|    return next;
  106|  30.2k|}

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

_ZN24SecureRandomDataProvider17provideRandomDataEPhm:
   81|    196|{
   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|    196|    static std::unique_ptr<QUtil::FileCloser> random_device = []() {
   93|    196|        FILE* f = fopen("/dev/urandom", "rb");
   94|    196|        if (f == nullptr) {
   95|    196|            f = fopen("/dev/arandom", "rb");
   96|    196|        }
   97|    196|        if (f == nullptr) {
   98|    196|            f = fopen("/dev/random", "rb");
   99|    196|        }
  100|    196|        if (f == nullptr) {
  101|    196|            throw std::runtime_error("unable to find device in /dev for generating random numbers");
  102|    196|        }
  103|    196|        return std::make_unique<QUtil::FileCloser>(f);
  104|    196|    }();
  105|       |
  106|    196|    size_t fr = fread(data, 1, len, random_device->f);
  107|    196|    if (fr != len) {
  ------------------
  |  Branch (107:9): [True: 0, False: 196]
  ------------------
  108|      0|        throw std::runtime_error(
  109|      0|            "unable to read " + std::to_string(len) + " bytes from random number device");
  110|      0|    }
  111|       |
  112|    196|# endif
  113|    196|}
_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|  26.8k|{
   14|  26.8k|    if (value) {
  ------------------
  |  Branch (14:9): [True: 26.8k, False: 0]
  ------------------
   15|  26.8k|        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|  26.8k|        Limits::dct_max_memory(10'000'000);
   21|  26.8k|        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|  26.8k|        dct_throw_on_corrupt_data(true);
   25|  26.8k|        Limits::png_max_memory(1'000'000);
   26|  26.8k|        Limits::flate_max_memory(200'000);
   27|  26.8k|        Limits::run_length_max_memory(1'000'000);
   28|  26.8k|        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|  26.8k|        Limits::doc_max_warnings(200);
   32|  26.8k|    }
   33|  26.8k|}
qpdf_global_set_uint32:
  129|  26.8k|{
  130|  26.8k|    switch (param) {
  131|      0|    case qpdf_p_inspection_mode:
  ------------------
  |  Branch (131:5): [True: 0, False: 26.8k]
  ------------------
  132|      0|        Options::inspection_mode(value);
  133|      0|        return qpdf_r_ok;
  134|  26.8k|    case qpdf_p_fuzz_mode:
  ------------------
  |  Branch (134:5): [True: 26.8k, False: 0]
  ------------------
  135|  26.8k|        Options::fuzz_mode(value);
  136|  26.8k|        return qpdf_r_ok;
  137|      0|    case qpdf_p_default_limits:
  ------------------
  |  Branch (137:5): [True: 0, False: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  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: 26.8k]
  ------------------
  177|      0|        Limits::tiff_max_memory(value);
  178|      0|        return qpdf_r_ok;
  179|      0|    default:
  ------------------
  |  Branch (179:5): [True: 0, False: 26.8k]
  ------------------
  180|      0|        return qpdf_r_bad_parameter;
  181|  26.8k|    }
  182|  26.8k|}

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

_ZN4qpdf4impl8AcroFormC2ERN4QPDF3DocE:
   38|  20.9k|            Common(doc)
   39|  20.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|  20.9k|            validate();
   44|  20.9k|        }
_ZN4qpdf4impl8FormNodeC2ERK16QPDFObjectHandle:
  352|   201k|            BaseDictionary(oh)
  353|   201k|        {
  354|   201k|        }
_ZNK4qpdf4impl8FormNode2APEv:
  372|  17.2k|        {
  373|  17.2k|            return {get("/AP")};
  374|  17.2k|        }
_ZN4qpdf4impl8FormNode6ParentEv:
  386|   104k|        {
  387|   104k|            return {get("/Parent")};
  388|   104k|        }
_ZNK4qpdf4impl8FormNode4KidsEv:
  400|  43.8k|        {
  401|  43.8k|            return {get("/Kids")};
  402|  43.8k|        }
_ZNK4qpdf4impl8FormNode2FTEb:
  470|  64.6k|        {
  471|  64.6k|            return inheritable_value<Name>("/FT");
  472|  64.6k|        }
_ZNK4qpdf4impl8FormNode1TEv:
  480|  68.2k|        {
  481|  68.2k|            return {get("/T")};
  482|  68.2k|        }
_ZNK4qpdf4impl8FormNode5fieldEv:
  660|  18.3k|        {
  661|  18.3k|            return T() || Kids() || FT();
  ------------------
  |  Branch (661:20): [True: 10.0k, False: 8.28k]
  |  Branch (661:27): [True: 2.02k, False: 6.26k]
  |  Branch (661:37): [True: 1.23k, False: 5.03k]
  ------------------
  662|  18.3k|        }
_ZNK4qpdf4impl8FormNode6widgetEv:
  680|  18.3k|        {
  681|  18.3k|            return !Kids() && (contains("/Subtype") || contains("/Rect") || contains("/AP"));
  ------------------
  |  Branch (681:20): [True: 14.0k, False: 4.22k]
  |  Branch (681:32): [True: 8.33k, False: 5.74k]
  |  Branch (681:56): [True: 317, False: 5.43k]
  |  Branch (681:77): [True: 353, False: 5.07k]
  ------------------
  682|  18.3k|        }
_ZNK4qpdf4impl8FormNode13from_AcroFormERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  767|  27.6k|        {
  768|  27.6k|            return {qpdf() ? qpdf()->getRoot()["/AcroForm"][name] : null_oh};
  ------------------
  |  Branch (768:21): [True: 26.2k, False: 1.39k]
  ------------------
  769|  27.6k|        }
_ZN26QPDFAcroFormDocumentHelper7MembersC2ER4QPDF:
  790|  20.9k|        AcroForm(qpdf.doc())
  791|  20.9k|    {
  792|  20.9k|    }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_4NameEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  64.6k|        {
  449|  64.6k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 56.1k, False: 8.47k]
  ------------------
  450|  56.1k|                return {v};
  451|  56.1k|            }
  452|  8.47k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 8.47k, False: 0]
  ------------------
  453|  64.6k|        }
_ZN4qpdf4impl8AcroFormD2Ev:
   35|  20.9k|        ~AcroForm() = default;
_ZN4qpdf4impl8FormNodeC2ERKS1_:
  345|  40.0k|        FormNode(FormNode const&) = default;
_ZN4qpdf4impl8FormNodeaSEOS1_:
  348|  57.5k|        FormNode& operator=(FormNode&&) = default;
_ZNK4qpdf4impl8FormNode17inheritable_valueI16QPDFObjectHandleEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  8.31k|        {
  449|  8.31k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.67k, False: 6.63k]
  ------------------
  450|  1.67k|                return {v};
  451|  1.67k|            }
  452|  6.63k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 6.63k, False: 0]
  ------------------
  453|  8.31k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_6StringEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  28.3k|        {
  449|  28.3k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 12.4k, False: 15.8k]
  ------------------
  450|  12.4k|                return {v};
  451|  12.4k|            }
  452|  15.8k|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 15.8k, False: 0]
  ------------------
  453|  28.3k|        }
_ZNK4qpdf4impl8FormNode1VI16QPDFObjectHandleEET_b:
  564|  1.50k|        {
  565|  1.50k|            return inheritable_value<T>("/V", inherit);
  566|  1.50k|        }
_ZNK4qpdf4impl8FormNode17inheritable_valueINS_5ArrayEEET_RKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEbb:
  448|  1.57k|        {
  449|  1.57k|            if (auto& v = get(name)) {
  ------------------
  |  Branch (449:23): [True: 1.25k, False: 317]
  ------------------
  450|  1.25k|                return {v};
  451|  1.25k|            }
  452|    317|            return {inherit ? inherited(name, acroform) : null_oh};
  ------------------
  |  Branch (452:21): [True: 317, False: 0]
  ------------------
  453|  1.57k|        }

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

_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  88.0k|        ~OffsetBuffer() final = default;
_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|  13.1k|        {
   49|  13.1k|            return description;
   50|  13.1k|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  32.0M|        {
   55|  32.0M|            return pos + global_offset;
   56|  32.0M|        }
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  88.1k|            description(description),
   22|  88.1k|            view_(view),
   23|  88.1k|            global_offset(global_offset)
   24|  88.1k|        {
   25|  88.1k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 55, False: 88.0k]
  ------------------
   26|     55|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     55|            }
   28|  88.0k|            last_offset = global_offset;
   29|  88.0k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  54.5k|{
   88|  54.5k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 40.3k, False: 14.2k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  40.3k|    }
   91|  54.5k|    str.resize(count);
   92|  54.5k|    str.resize(read(str.data(), count));
   93|  54.5k|    return str.size();
   94|  54.5k|}
_ZN11InputSource4readEmx:
   98|  40.3k|{
   99|  40.3k|    std::string result(count, '\0');
  100|  40.3k|    (void)read(result, count, at);
  101|  40.3k|    return result;
  102|  40.3k|}
_ZN11InputSource10loadBufferEv:
  106|  7.39M|{
  107|  7.39M|    buf_idx = 0;
  108|  7.39M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  7.39M|    buf_start = last_offset;
  111|  7.39M|}
_ZN11InputSource8fastTellEv:
  115|  33.0M|{
  116|  33.0M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 147k, False: 32.9M]
  ------------------
  117|   147k|        loadBuffer();
  118|  32.9M|    } else {
  119|  32.9M|        auto curr = tell();
  120|  32.9M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 79.1k, False: 32.8M]
  |  Branch (120:33): [True: 7.16M, False: 25.6M]
  ------------------
  121|  7.24M|            loadBuffer();
  122|  25.6M|        } else {
  123|  25.6M|            last_offset = curr;
  124|  25.6M|            buf_idx = curr - buf_start;
  125|  25.6M|        }
  126|  32.9M|    }
  127|  33.0M|    return last_offset;
  128|  33.0M|}
_ZN11InputSource8fastReadERc:
  132|   885M|{
  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|   885M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 878M, False: 6.69M]
  ------------------
  136|   878M|        ch = buffer[buf_idx];
  137|   878M|        ++(buf_idx);
  138|   878M|        ++(last_offset);
  139|   878M|        return true;
  140|       |
  141|   878M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 104k, False: 6.59M]
  ------------------
  142|   104k|        return false;
  143|  6.59M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  6.59M|        fastTell();
  146|  6.59M|        return fastRead(ch);
  147|  6.59M|    }
  148|   885M|}
_ZN11InputSource10fastUnreadEb:
  152|  26.4M|{
  153|  26.4M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 17.8M, False: 8.63M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  26.4M|}

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

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

_ZNK10NNTreeImpl8itemsKeyEv:
  185|   134k|    {
  186|   134k|        return items_key;
  187|   134k|    }
_ZNK14NNTreeIterator5validEv:
   29|  41.0k|    {
   30|  41.0k|        return item_number >= 0;
   31|  41.0k|    }
_ZN14NNTreeIterator13setItemNumberERK16QPDFObjectHandlei:
  102|  16.6k|    {
  103|  16.6k|        node = a_node;
  104|  16.6k|        item_number = n;
  105|  16.6k|        updateIValue();
  106|  16.6k|    }
_ZNK10NNTreeImpl8keyValidE16QPDFObjectHandle:
  190|   124k|    {
  191|   124k|        return o.resolved_type_code() == key_type;
  192|   124k|    }
_ZN14NNTreeIteratorD2Ev:
   24|  34.7k|    ~NNTreeIterator() = default;
_ZN14NNTreeIterator14addPathElementERK16QPDFObjectHandlei:
  109|  7.44k|    {
  110|  7.44k|        path.emplace_back(a_node, kid_number);
  111|  7.44k|    }
_ZN14NNTreeIterator11PathElementC2ERKN4qpdf10DictionaryEi:
   85|  7.47k|            node(node),
   86|  7.47k|            kid_number(kid_number)
   87|  7.47k|        {
   88|  7.47k|        }
_ZN14NNTreeIteratorC2ER10NNTreeImpl:
   95|  22.5k|        impl(impl)
   96|  22.5k|    {
   97|  22.5k|    }
_ZN10NNTreeImplC2ER4QPDFN4qpdf10DictionaryE18qpdf_object_type_eNSt3__18functionIFbRK16QPDFObjectHandleEEEb:
  139|  1.83k|        qpdf(qpdf),
  140|  1.83k|        tree_root(std::move(tree_root)),
  141|  1.83k|        key_type(key_type),
  142|  1.83k|        items_key(key_type == ::ot_string ? "/Names" : "/Nums"),
  ------------------
  |  Branch (142:19): [True: 794, False: 1.03k]
  ------------------
  143|  1.83k|        value_valid(value_validator),
  144|  1.83k|        auto_repair(auto_repair)
  145|  1.83k|    {
  146|  1.83k|    }
_ZN10NNTreeImpl3endEv:
  150|  6.20k|    {
  151|  6.20k|        return {*this};
  152|  6.20k|    }
_ZNK14NNTreeIteratorneERKS_:
   73|  14.5k|    {
   74|  14.5k|        return !operator==(other);
   75|  14.5k|    }
_ZN14NNTreeIteratordeEv:
   60|  13.4k|    {
   61|  13.4k|        updateIValue(false);
   62|  13.4k|        return ivalue;
   63|  13.4k|    }
_ZN14NNTreeIteratorppEv:
   34|  12.9k|    {
   35|  12.9k|        increment(false);
   36|  12.9k|        return *this;
   37|  12.9k|    }
_ZN14NNTreeIteratorptEv:
   66|  27.8k|    {
   67|  27.8k|        updateIValue(false);
   68|  27.8k|        return &ivalue;
   69|  27.8k|    }

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

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

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

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

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|  48.8M|    {
  934|  48.8M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 48.8M, False: 0]
  ------------------
  935|  48.8M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|  1.18M|    {
  928|  1.18M|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 1.18M, False: 1.40k]
  ------------------
  929|  1.18M|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|   100k|    {
  922|   100k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 100k, False: 0]
  ------------------
  923|   100k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  12.4M|    {
  952|  12.4M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 253k, False: 12.2M]
  ------------------
  953|   253k|            return ::ot_uninitialized;
  954|   253k|        }
  955|  12.2M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 381k, False: 11.8M]
  ------------------
  956|   381k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   381k|        }
  958|  11.8M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 11.8M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  11.8M|        return raw_type_code();
  962|  11.8M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|  4.86M|    {
  861|  4.86M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 4.86M, False: 6.87k]
  ------------------
  862|  4.86M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|  1.77M|    {
  908|  1.77M|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 190k, False: 1.58M]
  |  Branch (908:24): [True: 337k, False: 1.24M]
  ------------------
  909|  1.77M|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   958k|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 870k, False: 88.2k]
  ------------------
   58|   958k|        {
   59|   958k|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|  4.42M|    {
  940|  4.42M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 152k, False: 4.26M]
  ------------------
  941|   152k|            return ::ot_uninitialized;
  942|   152k|        }
  943|  4.26M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 682, False: 4.26M]
  ------------------
  944|    682|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    682|        }
  946|  4.26M|        return raw_type_code();
  947|  4.26M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|  2.79M|        obj(oh.obj)
  789|  2.79M|    {
  790|  2.79M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   716k|            BaseDictionary(oh)
  269|   716k|        {
  270|   716k|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   917k|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 797k, False: 119k]
  ------------------
  239|   917k|        {
  240|   917k|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|   133k|        {
  142|   133k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 100k, False: 33.5k]
  ------------------
  143|   100k|                return d->items.begin();
  144|   100k|            }
  145|  33.5k|            return {};
  146|   133k|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|  3.31M|    {
  771|  3.31M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 79.7k, False: 3.23M]
  ------------------
  772|  79.7k|            return nullptr;
  773|  79.7k|        }
  774|  3.23M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 3.19M, False: 46.3k]
  ------------------
  775|  3.19M|            return &std::get<T>(obj->value);
  776|  3.19M|        }
  777|  46.3k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1.18k, False: 45.1k]
  ------------------
  778|  1.18k|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|  1.18k|        }
  780|  45.1k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 45.1k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  45.1k|        return nullptr;
  785|  45.1k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|   133k|        {
  151|   133k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 100k, False: 33.5k]
  ------------------
  152|   100k|                return d->items.end();
  153|   100k|            }
  154|  33.5k|            return {};
  155|   133k|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|   392k|    {
  855|   392k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 392k, False: 0]
  ------------------
  856|   392k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|   161k|        {
  555|   161k|            return {stream()->stream_dict};
  556|   161k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   477k|        {
  698|   477k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 477k, False: 0]
  ------------------
  699|   477k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 477k, False: 1]
  ------------------
  700|   477k|                    return ptr;
  701|   477k|                }
  702|      1|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   477k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   477k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   477k|    {
  771|   477k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 477k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   477k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 477k, False: 0]
  ------------------
  775|   477k|            return &std::get<T>(obj->value);
  776|   477k|        }
  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|   294k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 175k, False: 119k]
  ------------------
  320|   294k|        {
  321|   294k|        }
_ZNK4qpdf7IntegercvbEv:
  330|   155k|        {
  331|   155k|            return obj != nullptr;
  332|   155k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   399k|        {
  474|   399k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 304k, False: 95.0k]
  |  Branch (474:27): [True: 183k, False: 121k]
  ------------------
  475|   399k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   527k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 343k, False: 184k]
  ------------------
  450|   527k|        {
  451|   527k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|   252k|    {
  806|   252k|        return {obj};
  807|   252k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|   871k|{
  989|   871k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   871k|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  49.5k|        {
  362|  49.5k|            try {
  363|  49.5k|                return static_cast<T>(*this);
  364|  49.5k|            } catch (std::underflow_error&) {
  365|    118|                if constexpr (std::is_same_v<T, int>) {
  366|    118|                    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|    118|                return std::numeric_limits<T>::min();
  377|    608|            } catch (std::overflow_error&) {
  378|    608|                if constexpr (std::is_same_v<T, int>) {
  379|    608|                    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|    608|                return std::numeric_limits<T>::max();
  388|    608|            }
  389|  49.5k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  64.4k|        {
  340|  64.4k|            auto v = value();
  341|       |
  342|  64.4k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 609, False: 63.8k]
  ------------------
  343|    609|                throw std::overflow_error("Integer conversion overflow");
  344|    609|            }
  345|  63.8k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 118, False: 63.6k]
  ------------------
  346|    118|                throw std::underflow_error("Integer conversion underflow");
  347|    118|            }
  348|  63.6k|            return static_cast<T>(v);
  349|  63.8k|        }
_ZN4qpdf5ArrayaSERKS0_:
   36|  3.99k|        {
   37|  3.99k|            if (obj != other.obj) {
  ------------------
  |  Branch (37:17): [True: 3.99k, False: 0]
  ------------------
   38|  3.99k|                obj = other.obj;
   39|  3.99k|            }
   40|  3.99k|            return *this;
   41|  3.99k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|   218k|            BaseHandle(obj)
   48|   218k|        {
   49|   218k|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  51.0k|            BaseHandle(std::move(obj))
   53|  51.0k|        {
   54|  51.0k|        }
_ZN4qpdf5ArrayaSERK16QPDFObjectHandle:
   63|  17.1k|        {
   64|  17.1k|            assign(::ot_array, oh);
   65|  17.1k|            return *this;
   66|  17.1k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|     33|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 1, False: 32]
  ------------------
   70|     33|        {
   71|     33|        }
_ZN4qpdf14BaseDictionaryC2EONSt3__13mapINS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandleNS1_4lessIS8_EENS6_INS1_4pairIKS8_S9_EEEEEE:
  220|  84.7k|            BaseHandle(QPDFObject::create<QPDF_Dictionary>(std::move(dict)))
  221|  84.7k|        {
  222|  84.7k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|   395k|            BaseHandle(obj)
  226|   395k|        {
  227|   395k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  19.7k|            BaseHandle(
  244|  19.7k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 18.6k, False: 1.11k]
  ------------------
  245|  19.7k|        {
  246|  19.7k|        }
_ZN4qpdf10DictionaryaSERK16QPDFObjectHandle:
  274|  27.5k|        {
  275|  27.5k|            assign(::ot_dictionary, oh);
  276|  27.5k|            return *this;
  277|  27.5k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  19.7k|            BaseDictionary(std::move(oh))
  281|  19.7k|        {
  282|  19.7k|        }
_ZN4qpdf10DictionaryaSEO16QPDFObjectHandle:
  286|    278|        {
  287|    278|            assign(::ot_dictionary, std::move(oh));
  288|    278|            return *this;
  289|    278|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  39.6k|        {
  462|  39.6k|            return value();
  463|  39.6k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf4Null4tempEv:
  496|  86.7k|        {
  497|  86.7k|            return temp_.oh();
  498|  86.7k|        }
_ZN4qpdf4Null7if_nullE16QPDFObjectHandle:
  503|  17.2k|        {
  504|  17.2k|            return oh ? std::move(oh) : Null::temp();
  ------------------
  |  Branch (504:20): [True: 11.8k, False: 5.41k]
  ------------------
  505|  17.2k|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|   160k|            BaseHandle(obj)
  516|   160k|        {
  517|   160k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|   177k|            BaseHandle(std::move(obj))
  521|   177k|        {
  522|   177k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  52.0k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 19.2k, False: 32.7k]
  ------------------
  538|  52.0k|        {
  539|  52.0k|        }
_ZNK4qpdf6Stream6LengthEv:
  563|  4.36k|        {
  564|  4.36k|            return {getDict()["/Length"]};
  565|  4.36k|        }
_ZNK4qpdf6Stream7SubtypeEv:
  592|  12.2k|        {
  593|  12.2k|            return {getDict()["/Subtype"]};
  594|  12.2k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  25.9k|        {
  602|  25.9k|            return {getDict()["/Type"]};
  603|  25.9k|        }
_ZNK4qpdf6Stream9getLengthEv:
  624|    990|        {
  625|    990|            return stream()->length;
  626|    990|        }
_ZN4qpdf6Stream11replaceDictERK16QPDFObjectHandle:
  681|  7.75k|        {
  682|  7.75k|            auto s = stream();
  683|  7.75k|            s->stream_dict = new_dict;
  684|  7.75k|            setDictDescription();
  685|  7.75k|        }
_ZN4qpdf6StringC2ERK16QPDFObjectHandle:
  732|  99.1k|            BaseHandle(oh.type_code() == ::ot_string ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (732:24): [True: 65.2k, False: 33.9k]
  ------------------
  733|  99.1k|        {
  734|  99.1k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|   215k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 215k, False: 0]
  ------------------
  738|   215k|        {
  739|   215k|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|   200k|    {
  800|   200k|        return obj;
  801|   200k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eRKS0_:
  838|  44.6k|    {
  839|  44.6k|        if (obj != other.obj) {
  ------------------
  |  Branch (839:13): [True: 20.4k, False: 24.2k]
  ------------------
  840|  20.4k|            obj = other.resolved_type_code() == required ? other.obj : nullptr;
  ------------------
  |  Branch (840:19): [True: 17.2k, False: 3.13k]
  ------------------
  841|  20.4k|        }
  842|  44.6k|    }
_ZN4qpdf10BaseHandle6assignE18qpdf_object_type_eOS0_:
  846|    278|    {
  847|    278|        if (obj != other.obj) {
  ------------------
  |  Branch (847:13): [True: 210, False: 68]
  ------------------
  848|    210|            obj = other.resolved_type_code() == required ? std::move(other.obj) : nullptr;
  ------------------
  |  Branch (848:19): [True: 210, False: 0]
  ------------------
  849|    210|        }
  850|    278|    }
_ZNK4qpdf10BaseHandle21no_ci_stop_damaged_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  877|  7.75k|    {
  878|  7.75k|        if (condition) {
  ------------------
  |  Branch (878:13): [True: 0, False: 7.75k]
  ------------------
  879|      0|            throw std::runtime_error(message);
  880|      0|        }
  881|  7.75k|    }
_ZNK4qpdf10BaseHandle13no_ci_warn_ifEbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  885|  16.3k|    {
  886|  16.3k|        if (condition) {
  ------------------
  |  Branch (886:13): [True: 0, False: 16.3k]
  ------------------
  887|      0|            warn(warning);
  888|      0|        }
  889|  16.3k|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|  1.38M|    {
  902|  1.38M|        return (*this)[key];
  903|  1.38M|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|   308k|{
  975|   308k|    auto n = QPDFObject::create<QPDF_Null>();
  976|   308k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|   308k|    return n;
  978|   308k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|   267k|{
 1007|   267k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 267k]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|   267k|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 81.4k, False: 186k]
  |  Branch (1010:37): [True: 135k, False: 51.0k]
  ------------------
 1011|   216k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 51.0k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|   216k|        return qpdf::Array(obj);
 1013|   216k|    }
 1014|  51.0k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|   267k|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|   395k|{
 1020|   395k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 67.5k, False: 327k]
  |  Branch (1020:37): [True: 299k, False: 28.2k]
  ------------------
 1021|   366k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 28.2k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|   366k|        return qpdf::Dictionary(obj);
 1023|   366k|    }
 1024|  28.2k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 28.2k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  28.2k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|   395k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|   341k|{
 1033|   341k|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 341k]
  |  Branch (1033:37): [True: 163k, False: 177k]
  ------------------
 1034|   177k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 177k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|   160k|        return qpdf::Stream(obj);
 1036|   160k|    }
 1037|   180k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 0, False: 180k]
  ------------------
 1038|      0|        assertType("stream", false);
 1039|      0|    }
 1040|   180k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|   341k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  21.9k|{
  989|  21.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  21.9k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   354k|{
  989|   354k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   354k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|   284k|        obj(std::move(oh.obj))
  794|   284k|    {
  795|   284k|    }
_ZN4qpdf10DictionaryC2Ev:
  256|  23.1k|        Dictionary() = default;
_ZN4qpdf14BaseDictionaryC2Ev:
  212|  23.1k|        BaseDictionary() = default;
_ZN4qpdf10DictionaryC2ERKS0_:
  262|  50.4k|        Dictionary(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryC2ERKS0_:
  232|  90.5k|        BaseDictionary(BaseDictionary const&) = default;
_ZN4qpdf10DictionaryaSEOS0_:
  265|  4.84k|        Dictionary& operator=(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryaSEOS0_:
  235|  62.3k|        BaseDictionary& operator=(BaseDictionary&&) = default;
_ZN4qpdf6StreamaSEOS0_:
  528|  8.76k|        Stream& operator=(Stream&&) = default;
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    914|{
  989|    914|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    914|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  4.03M|{
  989|  4.03M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  4.03M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  57.5k|{
  989|  57.5k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  57.5k|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   124k|{
  989|   124k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   124k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   176k|{
  989|   176k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   176k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    461|{
  989|    461|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    461|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  42.4k|{
  989|  42.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  42.4k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  38.2k|{
  989|  38.2k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  38.2k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|  5.65k|    {
  771|  5.65k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 5.65k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  5.65k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 5.65k, False: 0]
  ------------------
  775|  5.65k|            return &std::get<T>(obj->value);
  776|  5.65k|        }
  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|   176k|    {
  771|   176k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.11k, False: 175k]
  ------------------
  772|  1.11k|            return nullptr;
  773|  1.11k|        }
  774|   175k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 175k, False: 0]
  ------------------
  775|   175k|            return &std::get<T>(obj->value);
  776|   175k|        }
  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|  59.2k|        {
  340|  59.2k|            auto v = value();
  341|       |
  342|  59.2k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 59.2k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  59.2k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 59.2k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  59.2k|            return static_cast<T>(v);
  349|  59.2k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  26.0k|        {
  362|  26.0k|            try {
  363|  26.0k|                return static_cast<T>(*this);
  364|  26.0k|            } 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|    113|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    113|                    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|    113|                return std::numeric_limits<T>::min();
  377|    113|            } 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|  26.0k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  26.0k|        {
  340|  26.0k|            auto v = value();
  341|       |
  342|  26.0k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 26.0k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  26.0k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 113, False: 25.9k]
  ------------------
  346|    113|                throw std::underflow_error("Integer conversion underflow");
  347|    113|            }
  348|  25.9k|            return static_cast<T>(v);
  349|  26.0k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  7.57k|        {
  362|  7.57k|            try {
  363|  7.57k|                return static_cast<T>(*this);
  364|  7.57k|            } 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|    114|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    114|                    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|    114|                return std::numeric_limits<T>::min();
  377|    114|            } 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|     68|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|     68|                    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|     68|                return std::numeric_limits<T>::max();
  388|     68|            }
  389|  7.57k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  7.57k|        {
  340|  7.57k|            auto v = value();
  341|       |
  342|  7.57k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 68, False: 7.50k]
  ------------------
  343|     68|                throw std::overflow_error("Integer conversion overflow");
  344|     68|            }
  345|  7.50k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 114, False: 7.39k]
  ------------------
  346|    114|                throw std::underflow_error("Integer conversion underflow");
  347|    114|            }
  348|  7.39k|            return static_cast<T>(v);
  349|  7.50k|        }
_ZNK4qpdf10BaseHandle2asI9QPDF_RealEEPT_v:
  770|   163k|    {
  771|   163k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 163k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   163k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 163k, False: 0]
  ------------------
  775|   163k|            return &std::get<T>(obj->value);
  776|   163k|        }
  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.48M|{
  989|  2.48M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  2.48M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  57.3k|{
  989|  57.3k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  57.3k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|   394k|    {
  771|   394k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 394k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   394k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 390k, False: 3.61k]
  ------------------
  775|   390k|            return &std::get<T>(obj->value);
  776|   390k|        }
  777|  3.61k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 1, False: 3.61k]
  ------------------
  778|      1|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      1|        }
  780|  3.61k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 3.61k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  3.61k|        return nullptr;
  785|  3.61k|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   570k|{
  989|   570k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   570k|}
_ZN10QPDFObject6createI11QPDF_StringJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|    410|{
  989|    410|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    410|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|   261k|    {
  771|   261k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 261k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   261k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 261k, False: 0]
  ------------------
  775|   261k|            return &std::get<T>(obj->value);
  776|   261k|        }
  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|  1.22M|    {
  771|  1.22M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 1.22M]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  1.22M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.22M, False: 0]
  ------------------
  775|  1.22M|            return &std::get<T>(obj->value);
  776|  1.22M|        }
  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|   472k|{
  989|   472k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   472k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  67.9k|{
  989|  67.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  67.9k|}
_ZN9QPDF_RealC2Edib:
  981|  67.9k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  67.9k|{
  983|  67.9k|}
_ZN10QPDFObject6createI13QPDF_OperatorJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  1.49M|{
  989|  1.49M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.49M|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  31.4k|{
  989|  31.4k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  31.4k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   354k|    items(std::move(items))
  968|   354k|{
  969|   354k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  20.8k|{
  989|  20.8k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  20.8k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.22M|{
  989|  1.22M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.22M|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   361k|{
  989|   361k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   361k|}
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  2.71M|    {
  771|  2.71M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 151k, False: 2.55M]
  ------------------
  772|   151k|            return nullptr;
  773|   151k|        }
  774|  2.55M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 2.49M, False: 66.0k]
  ------------------
  775|  2.49M|            return &std::get<T>(obj->value);
  776|  2.49M|        }
  777|  66.0k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 66.0k]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  66.0k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 66.0k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  66.0k|        return nullptr;
  785|  66.0k|    }
_ZN4qpdf6Stream6LengthITkNSt3__18integralExEEvT_:
  582|  4.36k|        {
  583|  4.36k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  4.36k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 4.36k, False: 0]
  ------------------
  584|  4.36k|            getDict().replace("/Length", Integer(val));
  585|  4.36k|        }
_ZN4qpdf6Stream6LengthITkNSt3__18integralEmEEvT_:
  582|  30.0k|        {
  583|  30.0k|            qpdf_expect(val >= 0);
  ------------------
  |  |   13|  30.0k|#define qpdf_expect assert
  ------------------
  |  Branch (583:13): [True: 30.0k, False: 0]
  ------------------
  584|  30.0k|            getDict().replace("/Length", Integer(val));
  585|  30.0k|        }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  34.9k|            Integer(static_cast<long long>(value))
  308|  34.9k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  34.9k|                              std::numeric_limits<long long>::max())) {
  312|  34.9k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 34.9k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  34.9k|            }
  316|  34.9k|        }
_ZN4qpdf10DictionaryC2EOS0_:
  264|  2.89k|        Dictionary(Dictionary&&) = default;
_ZN4qpdf14BaseDictionaryC2EOS0_:
  234|  2.89k|        BaseDictionary(BaseDictionary&&) = default;
_ZN4qpdf10DictionaryaSERKS0_:
  263|  5.32k|        Dictionary& operator=(Dictionary const&) = default;
_ZN4qpdf14BaseDictionaryaSERKS0_:
  233|  5.32k|        BaseDictionary& operator=(BaseDictionary const&) = default;
_ZN4qpdf5ArrayC2Ev:
   21|  3.99k|        Array() = default;

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

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  19.0M|        {
   65|  19.0M|            return this->type;
   66|  19.0M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  13.8M|        {
   70|  13.8M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 3.60M, False: 10.2M]
  |  Branch (70:61): [True: 570k, False: 9.70M]
  ------------------
   71|  13.8M|                ? this->val
   72|  13.8M|                : this->raw_val;
   73|  13.8M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  69.9k|        {
   82|  69.9k|            return this->error_message;
   83|  69.9k|        }

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

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA29_KcEEvbOT_:
   36|  5.45M|    {
   37|  5.45M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 5.45M]
  ------------------
   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|  5.45M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|   152k|    {
   28|   152k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 152k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   152k|    }
_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|  5.29M|    {
   37|  5.29M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 5.29M]
  ------------------
   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|  5.29M|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|  61.7M|    {
  100|  61.7M|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 47.2M, False: 14.5M]
  |  Branch (100:32): [True: 47.1M, False: 82.4k]
  ------------------
  101|  61.7M|            ? char(digit - '0')
  102|  61.7M|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 14.3M, False: 193k]
  ------------------
  103|  14.5M|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 62.3k, False: 131k]
  ------------------
  104|  61.7M|    }
_ZN4qpdf4util8is_spaceEc:
  114|  44.3M|    {
  115|  44.3M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 12.3M, False: 31.9M]
  |  Branch (115:29): [True: 1.83M, False: 30.1M]
  |  Branch (115:43): [True: 553k, False: 29.5M]
  |  Branch (115:57): [True: 2.77M, False: 26.7M]
  |  Branch (115:71): [True: 136k, False: 26.6M]
  |  Branch (115:85): [True: 48.4k, False: 26.6M]
  ------------------
  116|  44.3M|    }
_ZN4qpdf4util8is_digitEc:
  120|  26.3M|    {
  121|  26.3M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 17.0M, False: 9.34M]
  |  Branch (121:30): [True: 16.7M, False: 302k]
  ------------------
  122|  26.3M|    }
_ZN4qpdf4util15hex_encode_charEc:
  127|  42.4M|    {
  128|  42.4M|        static auto constexpr hexchars = "0123456789abcdef";
  129|  42.4M|        return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  130|  42.4M|    }
_ZN4qpdf4util8is_utf16ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  149|   316k|    {
  150|   316k|        return str.starts_with("\xfe\xff") || str.starts_with("\xff\xfe");
  ------------------
  |  Branch (150:16): [True: 62.9k, False: 253k]
  |  Branch (150:47): [True: 4.86k, False: 248k]
  ------------------
  151|   316k|    }
_ZN4qpdf4util16is_explicit_utf8ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  155|   248k|    {
  156|       |        // QPDF_String.cc knows that this is a 3-byte sequence.
  157|   248k|        return str.starts_with("\xef\xbb\xbf");
  158|   248k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   290k|    {
   28|   290k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 290k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   290k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   132k|    {
   28|   132k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 132k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   132k|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|  4.68k|    {
   28|  4.68k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 4.68k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  4.68k|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|  1.44k|    {
   28|  1.44k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.44k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.44k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  26.8k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  26.8k|                          std::numeric_limits<T>::min())) {
   67|  26.8k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 26.8k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  26.8k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  26.8k|                          std::numeric_limits<T>::max())) {
   74|  26.8k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 26.8k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  26.8k|        }
   78|  26.8k|        return true;
   79|  26.8k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  26.8k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  26.8k|                          std::numeric_limits<T>::min())) {
   67|  26.8k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 26.8k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  26.8k|        }
   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|  26.8k|        return true;
   79|  26.8k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|   117k|    {
   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|   117k|                          std::numeric_limits<T>::max())) {
   74|   117k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 9, False: 117k]
  ------------------
   75|      9|                return false;
   76|      9|            }
   77|   117k|        }
   78|   117k|        return true;
   79|   117k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|   868k|    {
   28|   868k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 868k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   868k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  8.35k|    {
   28|  8.35k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 8.35k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  8.35k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  6.29k|    {
   28|  6.29k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 6.29k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  6.29k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|  7.99M|    {
   37|  7.99M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 4, False: 7.99M]
  ------------------
   38|      4|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      4|                                       .append(
   40|      4|                                           "\nThis is a qpdf bug. Please report at "
   41|      4|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      4|        }
   43|  7.99M|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  5.84k|    {
   28|  5.84k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 5.84k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  5.84k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|   137k|    {
   28|   137k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 137k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   137k|    }
_ZN4qpdf4util9assertionIRA65_KcEEvbOT_:
   27|  2.74k|    {
   28|  2.74k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.74k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.74k|    }
_ZN4qpdf4util9assertionIRA49_KcEEvbOT_:
   27|  3.99k|    {
   28|  3.99k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.99k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.99k|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  64.2k|    {
   28|  64.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 64.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  64.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  3.10M|    {
   49|  3.10M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 3.10M]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|  3.10M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   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|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  4.73M|    {
   49|  4.73M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 15, False: 4.73M]
  ------------------
   50|     15|            throw std::runtime_error(std::forward<T>(msg));
   51|     15|        }
   52|  4.73M|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  26.6M|    {
   28|  26.6M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 26.6M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  26.6M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  73.3k|    {
   49|  73.3k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 43, False: 73.2k]
  ------------------
   50|     43|            throw std::runtime_error(std::forward<T>(msg));
   51|     43|        }
   52|  73.3k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|    617|    {
   28|    617|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 617]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    617|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  26.5k|    {
   28|  26.5k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 26.5k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  26.5k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA73_KcEEvbOT_:
   48|  7.79k|    {
   49|  7.79k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 7.79k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  7.79k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|  2.96k|    {
   28|  2.96k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.96k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.96k|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|   153k|    {
   49|   153k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 153k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   153k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  25.7k|    {
   49|  25.7k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 25.7k]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|  25.7k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|   212k|    {
   49|   212k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 212k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   212k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  82.0k|    {
   49|  82.0k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 82.0k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  82.0k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  4.96k|    {
   49|  4.96k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 10, False: 4.95k]
  ------------------
   50|     10|            throw std::runtime_error(std::forward<T>(msg));
   51|     10|        }
   52|  4.96k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  3.84k|    {
   49|  3.84k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 3.84k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  3.84k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  3.84k|    {
   49|  3.84k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 3.84k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  3.84k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  3.84k|    {
   49|  3.84k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 6, False: 3.83k]
  ------------------
   50|      6|            throw std::runtime_error(std::forward<T>(msg));
   51|      6|        }
   52|  3.84k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  95.4k|    {
   49|  95.4k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 39, False: 95.4k]
  ------------------
   50|     39|            throw std::runtime_error(std::forward<T>(msg));
   51|     39|        }
   52|  95.4k|    }
_ZN4qpdf4util9assertionIRA47_KcEEvbOT_:
   27|  98.2k|    {
   28|  98.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 98.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  98.2k|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|  1.10k|    {
   28|  1.10k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.10k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.10k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|  1.10k|    {
   49|  1.10k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.09k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.10k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|  1.09k|    {
   49|  1.09k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.09k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.09k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|  1.08k|    {
   49|  1.08k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 8, False: 1.07k]
  ------------------
   50|      8|            throw std::runtime_error(std::forward<T>(msg));
   51|      8|        }
   52|  1.08k|    }

BitStream.cc:_ZL9read_bitsRPKhRmS2_m:
   21|  2.55M|{
   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|  2.55M|    if (bits_wanted > bits_available) {
  ------------------
  |  Branch (29:9): [True: 0, False: 2.55M]
  ------------------
   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|  2.55M|    if (bits_wanted > 32) {
  ------------------
  |  Branch (34:9): [True: 17, False: 2.55M]
  ------------------
   35|     17|        throw std::out_of_range("read_bits: too many bits requested");
   36|     17|    }
   37|       |
   38|  2.55M|    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|  12.7M|    while (bits_wanted > 0) {
  ------------------
  |  Branch (44:12): [True: 10.2M, False: 2.55M]
  ------------------
   45|       |        // Grab bits from the first byte clearing anything before
   46|       |        // bit_offset.
   47|  10.2M|        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|  10.2M|        size_t to_copy = std::min(bits_wanted, bit_offset + 1);
   51|  10.2M|        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|  10.2M|        byte = static_cast<unsigned char>(byte >> leftover);
   60|       |
   61|       |        // Copy the bits into result
   62|  10.2M|        result <<= to_copy;
   63|  10.2M|        result |= byte;
   64|       |
   65|       |        // Update pointers
   66|  10.2M|        if (leftover) {
  ------------------
  |  Branch (66:13): [True: 1.48M, False: 8.73M]
  ------------------
   67|  1.48M|            bit_offset = leftover - 1;
   68|  8.73M|        } else {
   69|  8.73M|            bit_offset = 7;
   70|  8.73M|            ++p;
   71|  8.73M|        }
   72|  10.2M|        bits_wanted -= to_copy;
   73|  10.2M|        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|  10.2M|    }
   79|       |
   80|  2.55M|    return result;
   81|  2.55M|}
BitWriter.cc:_ZL10write_bitsRhRmymP8Pipeline:
   88|  2.55M|{
   89|  2.55M|    if (bits > 32) {
  ------------------
  |  Branch (89:9): [True: 0, False: 2.55M]
  ------------------
   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|  12.7M|    while (bits > 0) {
  ------------------
  |  Branch (99:12): [True: 10.2M, False: 2.55M]
  ------------------
  100|  10.2M|        size_t bits_to_write = std::min(bits, bit_offset + 1);
  101|  10.2M|        unsigned char newval = static_cast<unsigned char>(
  102|  10.2M|            (val >> (bits - bits_to_write)) & ((1U << bits_to_write) - 1));
  103|  10.2M|        size_t bits_left_in_ch = bit_offset + 1 - bits_to_write;
  104|  10.2M|        newval = static_cast<unsigned char>(newval << bits_left_in_ch);
  105|  10.2M|        ch |= newval;
  106|  10.2M|        if (bits_left_in_ch == 0) {
  ------------------
  |  Branch (106:13): [True: 8.73M, False: 1.48M]
  ------------------
  107|       |# ifdef BITS_TESTING
  108|       |            QTC::TC("libtests", "bits write pipeline");
  109|       |# endif
  110|  8.73M|            pipeline->write(&ch, 1);
  111|  8.73M|            bit_offset = 7;
  112|  8.73M|            ch = 0;
  113|  8.73M|        } else {
  114|       |# ifdef BITS_TESTING
  115|       |            QTC::TC("libtests", "bits write leftover");
  116|       |# endif
  117|  1.48M|            bit_offset -= bits_to_write;
  118|  1.48M|        }
  119|  10.2M|        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|  10.2M|    }
  124|  2.55M|}

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

_Z20rijndaelSetupEncryptPjPKhm:
  715|   162k|{
  716|   162k|  int i = 0;
  717|   162k|  u32 temp;
  718|       |
  719|   162k|  rk[0] = GETU32(key     );
  ------------------
  |  |  698|   162k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   162k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   162k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   162k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  720|   162k|  rk[1] = GETU32(key +  4);
  ------------------
  |  |  698|   162k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   162k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   162k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   162k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  721|   162k|  rk[2] = GETU32(key +  8);
  ------------------
  |  |  698|   162k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   162k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   162k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   162k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  722|   162k|  rk[3] = GETU32(key + 12);
  ------------------
  |  |  698|   162k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   162k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   162k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   162k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  723|   162k|  if (keybits == 128)
  ------------------
  |  Branch (723:7): [True: 157k, False: 5.22k]
  ------------------
  724|   157k|  {
  725|   157k|    for (;;)
  726|  1.57M|    {
  727|  1.57M|      temp  = rk[3];
  728|  1.57M|      rk[4] = rk[0] ^
  729|  1.57M|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  730|  1.57M|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  731|  1.57M|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  732|  1.57M|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  733|  1.57M|        rcon[i];
  734|  1.57M|      rk[5] = rk[1] ^ rk[4];
  735|  1.57M|      rk[6] = rk[2] ^ rk[5];
  736|  1.57M|      rk[7] = rk[3] ^ rk[6];
  737|  1.57M|      if (++i == 10)
  ------------------
  |  Branch (737:11): [True: 157k, False: 1.41M]
  ------------------
  738|   157k|        return 10;
  739|  1.41M|      rk += 4;
  740|  1.41M|    }
  741|   157k|  }
  742|  5.22k|  rk[4] = GETU32(key + 16);
  ------------------
  |  |  698|  5.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  743|  5.22k|  rk[5] = GETU32(key + 20);
  ------------------
  |  |  698|  5.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  744|  5.22k|  if (keybits == 192)
  ------------------
  |  Branch (744:7): [True: 0, False: 5.22k]
  ------------------
  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.22k|  rk[6] = GETU32(key + 24);
  ------------------
  |  |  698|  5.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  766|  5.22k|  rk[7] = GETU32(key + 28);
  ------------------
  |  |  698|  5.22k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  5.22k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  5.22k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  5.22k|               (static_cast<u32>((plaintext)[3])))
  ------------------
  767|  5.22k|  if (keybits == 256)
  ------------------
  |  Branch (767:7): [True: 5.22k, False: 0]
  ------------------
  768|  5.22k|  {
  769|  5.22k|    for (;;)
  770|  36.5k|    {
  771|  36.5k|      temp = rk[ 7];
  772|  36.5k|      rk[ 8] = rk[ 0] ^
  773|  36.5k|        (Te4[(temp >> 16) & 0xff] & 0xff000000) ^
  774|  36.5k|        (Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
  775|  36.5k|        (Te4[(temp      ) & 0xff] & 0x0000ff00) ^
  776|  36.5k|        (Te4[(temp >> 24)       ] & 0x000000ff) ^
  777|  36.5k|        rcon[i];
  778|  36.5k|      rk[ 9] = rk[ 1] ^ rk[ 8];
  779|  36.5k|      rk[10] = rk[ 2] ^ rk[ 9];
  780|  36.5k|      rk[11] = rk[ 3] ^ rk[10];
  781|  36.5k|      if (++i == 7)
  ------------------
  |  Branch (781:11): [True: 5.22k, False: 31.3k]
  ------------------
  782|  5.22k|        return 14;
  783|  31.3k|      temp = rk[11];
  784|  31.3k|      rk[12] = rk[ 4] ^
  785|  31.3k|        (Te4[(temp >> 24)       ] & 0xff000000) ^
  786|  31.3k|        (Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
  787|  31.3k|        (Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
  788|  31.3k|        (Te4[(temp      ) & 0xff] & 0x000000ff);
  789|  31.3k|      rk[13] = rk[ 5] ^ rk[12];
  790|  31.3k|      rk[14] = rk[ 6] ^ rk[13];
  791|  31.3k|      rk[15] = rk[ 7] ^ rk[14];
  792|  31.3k|      rk += 8;
  793|  31.3k|    }
  794|  5.22k|  }
  795|      0|  return 0;
  796|  5.22k|}
_Z20rijndaelSetupDecryptPjPKhm:
  804|  65.5k|{
  805|  65.5k|  unsigned int nrounds, i, j;
  806|  65.5k|  u32 temp;
  807|       |
  808|       |  /* expand the cipher key: */
  809|  65.5k|  nrounds = rijndaelSetupEncrypt(rk, key, keybits);
  810|       |  /* invert the order of the round keys: */
  811|   404k|  for (i = 0, j = 4*nrounds; i < j; i += 4, j -= 4)
  ------------------
  |  Branch (811:30): [True: 338k, False: 65.5k]
  ------------------
  812|   338k|  {
  813|   338k|    temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
  814|   338k|    temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
  815|   338k|    temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
  816|   338k|    temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
  817|   338k|  }
  818|       |  /* apply the inverse MixColumn transform to all round keys but the first and the last: */
  819|   676k|  for (i = 1; i < nrounds; i++)
  ------------------
  |  Branch (819:15): [True: 611k, False: 65.5k]
  ------------------
  820|   611k|  {
  821|   611k|    rk += 4;
  822|   611k|    rk[0] =
  823|   611k|      Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
  824|   611k|      Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
  825|   611k|      Td2[Te4[(rk[0] >>  8) & 0xff] & 0xff] ^
  826|   611k|      Td3[Te4[(rk[0]      ) & 0xff] & 0xff];
  827|   611k|    rk[1] =
  828|   611k|      Td0[Te4[(rk[1] >> 24)       ] & 0xff] ^
  829|   611k|      Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
  830|   611k|      Td2[Te4[(rk[1] >>  8) & 0xff] & 0xff] ^
  831|   611k|      Td3[Te4[(rk[1]      ) & 0xff] & 0xff];
  832|   611k|    rk[2] =
  833|   611k|      Td0[Te4[(rk[2] >> 24)       ] & 0xff] ^
  834|   611k|      Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
  835|   611k|      Td2[Te4[(rk[2] >>  8) & 0xff] & 0xff] ^
  836|   611k|      Td3[Te4[(rk[2]      ) & 0xff] & 0xff];
  837|   611k|    rk[3] =
  838|   611k|      Td0[Te4[(rk[3] >> 24)       ] & 0xff] ^
  839|   611k|      Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
  840|   611k|      Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
  841|   611k|      Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
  842|   611k|  }
  843|  65.5k|  return nrounds;
  844|  65.5k|}
_Z15rijndaelEncryptPKjjPKhPh:
  849|  26.3M|{
  850|  26.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|  26.3M|  s0 = GETU32(plaintext     ) ^ rk[0];
  ------------------
  |  |  698|  26.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  26.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  26.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  26.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  859|  26.3M|  s1 = GETU32(plaintext +  4) ^ rk[1];
  ------------------
  |  |  698|  26.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  26.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  26.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  26.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  860|  26.3M|  s2 = GETU32(plaintext +  8) ^ rk[2];
  ------------------
  |  |  698|  26.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  26.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  26.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  26.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  861|  26.3M|  s3 = GETU32(plaintext + 12) ^ rk[3];
  ------------------
  |  |  698|  26.3M|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|  26.3M|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|  26.3M|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|  26.3M|               (static_cast<u32>((plaintext)[3])))
  ------------------
  862|  26.3M|#ifdef FULL_UNROLL
  863|       |    /* round 1: */
  864|  26.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
  865|  26.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
  866|  26.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
  867|  26.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
  868|       |    /* round 2: */
  869|  26.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
  870|  26.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
  871|  26.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
  872|  26.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
  873|       |    /* round 3: */
  874|  26.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
  875|  26.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
  876|  26.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
  877|  26.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
  878|       |    /* round 4: */
  879|  26.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
  880|  26.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
  881|  26.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
  882|  26.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
  883|       |    /* round 5: */
  884|  26.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
  885|  26.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
  886|  26.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
  887|  26.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
  888|       |    /* round 6: */
  889|  26.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
  890|  26.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
  891|  26.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
  892|  26.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
  893|       |    /* round 7: */
  894|  26.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
  895|  26.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
  896|  26.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
  897|  26.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
  898|       |    /* round 8: */
  899|  26.3M|    s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
  900|  26.3M|    s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
  901|  26.3M|    s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
  902|  26.3M|    s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
  903|       |    /* round 9: */
  904|  26.3M|    t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
  905|  26.3M|    t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
  906|  26.3M|    t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
  907|  26.3M|    t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
  908|  26.3M|    if (nrounds > 10)
  ------------------
  |  Branch (908:9): [True: 0, False: 26.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|  26.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|  26.3M|  s0 =
 1000|  26.3M|    (Te4[(t0 >> 24)       ] & 0xff000000) ^
 1001|  26.3M|    (Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1002|  26.3M|    (Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1003|  26.3M|    (Te4[(t3      ) & 0xff] & 0x000000ff) ^
 1004|  26.3M|    rk[0];
 1005|  26.3M|  PUTU32(ciphertext     , s0);
  ------------------
  |  |  703|  26.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  26.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  26.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  26.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  26.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1006|  26.3M|  s1 =
 1007|  26.3M|    (Te4[(t1 >> 24)       ] & 0xff000000) ^
 1008|  26.3M|    (Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1009|  26.3M|    (Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1010|  26.3M|    (Te4[(t0      ) & 0xff] & 0x000000ff) ^
 1011|  26.3M|    rk[1];
 1012|  26.3M|  PUTU32(ciphertext +  4, s1);
  ------------------
  |  |  703|  26.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  26.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  26.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  26.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  26.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1013|  26.3M|  s2 =
 1014|  26.3M|    (Te4[(t2 >> 24)       ] & 0xff000000) ^
 1015|  26.3M|    (Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1016|  26.3M|    (Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1017|  26.3M|    (Te4[(t1      ) & 0xff] & 0x000000ff) ^
 1018|  26.3M|    rk[2];
 1019|  26.3M|  PUTU32(ciphertext +  8, s2);
  ------------------
  |  |  703|  26.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  26.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  26.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  26.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  26.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1020|  26.3M|  s3 =
 1021|  26.3M|    (Te4[(t3 >> 24)       ] & 0xff000000) ^
 1022|  26.3M|    (Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1023|  26.3M|    (Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1024|  26.3M|    (Te4[(t2      ) & 0xff] & 0x000000ff) ^
 1025|  26.3M|    rk[3];
 1026|  26.3M|  PUTU32(ciphertext + 12, s3);
  ------------------
  |  |  703|  26.3M|#define PUTU32(ciphertext, st) { \
  |  |  704|  26.3M|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|  26.3M|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|  26.3M|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|  26.3M|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1027|  26.3M|}
_Z15rijndaelDecryptPKjjPKhPh:
 1032|   309k|{
 1033|   309k|  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|   309k|    s0 = GETU32(ciphertext     ) ^ rk[0];
  ------------------
  |  |  698|   309k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   309k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   309k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   309k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1043|   309k|    s1 = GETU32(ciphertext +  4) ^ rk[1];
  ------------------
  |  |  698|   309k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   309k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   309k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   309k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1044|   309k|    s2 = GETU32(ciphertext +  8) ^ rk[2];
  ------------------
  |  |  698|   309k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   309k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   309k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   309k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1045|   309k|    s3 = GETU32(ciphertext + 12) ^ rk[3];
  ------------------
  |  |  698|   309k|              ((static_cast<u32>((plaintext)[0]) << 24) ^ \
  |  |  699|   309k|               (static_cast<u32>((plaintext)[1]) << 16) ^ \
  |  |  700|   309k|               (static_cast<u32>((plaintext)[2]) <<  8) ^ \
  |  |  701|   309k|               (static_cast<u32>((plaintext)[3])))
  ------------------
 1046|   309k|#ifdef FULL_UNROLL
 1047|       |    /* round 1: */
 1048|   309k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
 1049|   309k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
 1050|   309k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
 1051|   309k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
 1052|       |    /* round 2: */
 1053|   309k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
 1054|   309k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
 1055|   309k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
 1056|   309k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
 1057|       |    /* round 3: */
 1058|   309k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
 1059|   309k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
 1060|   309k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
 1061|   309k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
 1062|       |    /* round 4: */
 1063|   309k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
 1064|   309k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
 1065|   309k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
 1066|   309k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
 1067|       |    /* round 5: */
 1068|   309k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
 1069|   309k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
 1070|   309k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
 1071|   309k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
 1072|       |    /* round 6: */
 1073|   309k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
 1074|   309k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
 1075|   309k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
 1076|   309k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
 1077|       |    /* round 7: */
 1078|   309k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
 1079|   309k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
 1080|   309k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
 1081|   309k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
 1082|       |    /* round 8: */
 1083|   309k|    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
 1084|   309k|    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
 1085|   309k|    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
 1086|   309k|    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
 1087|       |    /* round 9: */
 1088|   309k|    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
 1089|   309k|    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
 1090|   309k|    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
 1091|   309k|    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
 1092|   309k|    if (nrounds > 10)
  ------------------
  |  Branch (1092:9): [True: 91.7k, False: 218k]
  ------------------
 1093|  91.7k|    {
 1094|       |      /* round 10: */
 1095|  91.7k|      s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
 1096|  91.7k|      s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
 1097|  91.7k|      s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
 1098|  91.7k|      s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
 1099|       |      /* round 11: */
 1100|  91.7k|      t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
 1101|  91.7k|      t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
 1102|  91.7k|      t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
 1103|  91.7k|      t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
 1104|  91.7k|      if (nrounds > 12)
  ------------------
  |  Branch (1104:11): [True: 91.7k, False: 0]
  ------------------
 1105|  91.7k|      {
 1106|       |        /* round 12: */
 1107|  91.7k|        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
 1108|  91.7k|        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
 1109|  91.7k|        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
 1110|  91.7k|        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
 1111|       |        /* round 13: */
 1112|  91.7k|        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
 1113|  91.7k|        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
 1114|  91.7k|        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
 1115|  91.7k|        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
 1116|  91.7k|      }
 1117|  91.7k|    }
 1118|   309k|    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|   309k|  s0 =
 1184|   309k|    (Td4[(t0 >> 24)       ] & 0xff000000) ^
 1185|   309k|    (Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
 1186|   309k|    (Td4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
 1187|   309k|    (Td4[(t1      ) & 0xff] & 0x000000ff) ^
 1188|   309k|    rk[0];
 1189|   309k|  PUTU32(plaintext     , s0);
  ------------------
  |  |  703|   309k|#define PUTU32(ciphertext, st) { \
  |  |  704|   309k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   309k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   309k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   309k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1190|   309k|  s1 =
 1191|   309k|    (Td4[(t1 >> 24)       ] & 0xff000000) ^
 1192|   309k|    (Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
 1193|   309k|    (Td4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
 1194|   309k|    (Td4[(t2      ) & 0xff] & 0x000000ff) ^
 1195|   309k|    rk[1];
 1196|   309k|  PUTU32(plaintext +  4, s1);
  ------------------
  |  |  703|   309k|#define PUTU32(ciphertext, st) { \
  |  |  704|   309k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   309k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   309k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   309k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1197|   309k|  s2 =
 1198|   309k|    (Td4[(t2 >> 24)       ] & 0xff000000) ^
 1199|   309k|    (Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
 1200|   309k|    (Td4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
 1201|   309k|    (Td4[(t3      ) & 0xff] & 0x000000ff) ^
 1202|   309k|    rk[2];
 1203|   309k|  PUTU32(plaintext +  8, s2);
  ------------------
  |  |  703|   309k|#define PUTU32(ciphertext, st) { \
  |  |  704|   309k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   309k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   309k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   309k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1204|   309k|  s3 =
 1205|   309k|    (Td4[(t3 >> 24)       ] & 0xff000000) ^
 1206|   309k|    (Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
 1207|   309k|    (Td4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
 1208|   309k|    (Td4[(t0      ) & 0xff] & 0x000000ff) ^
 1209|   309k|    rk[3];
 1210|   309k|  PUTU32(plaintext + 12, s3);
  ------------------
  |  |  703|   309k|#define PUTU32(ciphertext, st) { \
  |  |  704|   309k|                    (ciphertext)[0] = static_cast<u8>((st) >> 24); \
  |  |  705|   309k|                    (ciphertext)[1] = static_cast<u8>((st) >> 16); \
  |  |  706|   309k|                    (ciphertext)[2] = static_cast<u8>((st) >>  8); \
  |  |  707|   309k|                    (ciphertext)[3] = static_cast<u8>(st); }
  ------------------
 1211|   309k|}

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

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

sph_sha224:
  173|  34.1k|{
  174|  34.1k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  34.1k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  34.1k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  34.1k|        unsigned current;
  176|  34.1k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  34.1k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  34.1k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 2.07k, False: 32.0k]
  ------------------
  182|  2.07k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  2.07k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.07k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  2.07k|                return;
  184|  2.07k|        }
  185|  32.0k|        sc = cc;
  186|  32.0k|#if SPH_64
  187|  32.0k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  32.0k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  32.0k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 32.0k]
  ------------------
  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|  32.0k|        orig_len = len;
  206|  2.21M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  2.21M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 2.17M, False: 32.0k]
  ------------------
  207|  2.17M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  2.17M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.17M|#define SPH_VAL   sc->val
  ------------------
  208|  2.17M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  2.17M|#define SPH_BLEN     64U
  ------------------
  209|  2.17M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  2.17M|#define SPH_BLEN     64U
  ------------------
  210|  2.17M|        }
  211|  32.0k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 32.0k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  32.0k|#if SPH_64
  214|  32.0k|        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|  32.0k|}
sha2.c:sha224_short:
  131|  2.07k|{
  132|  2.07k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  2.07k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.07k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  2.07k|        unsigned current;
  134|       |
  135|  2.07k|        sc = cc;
  136|  2.07k|#if SPH_64
  137|  2.07k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  2.07k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  4.15k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 2.07k, False: 2.07k]
  ------------------
  142|  2.07k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  2.07k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  2.07k|#define SPH_BLEN     64U
  ------------------
  148|  2.07k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 2.07k, False: 0]
  ------------------
  149|  2.07k|                        clen = (unsigned)len;
  150|  2.07k|                memcpy(sc->buf + current, data, clen);
  151|  2.07k|                data = (const unsigned char *)data + clen;
  152|  2.07k|                current += clen;
  153|  2.07k|                len -= clen;
  154|  2.07k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  2.07k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 2.07k]
  ------------------
  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|  2.07k|#if SPH_64
  159|  2.07k|                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|  2.07k|        }
  168|  2.07k|}
sha2.c:sha224_close:
  345|  33.5k|{
  346|  33.5k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  33.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  33.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  33.5k|}
sha2.c:sha224_addbits_and_close:
  242|  33.5k|{
  243|  33.5k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  33.5k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  33.5k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  33.5k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  33.5k|        sc = cc;
  250|  33.5k|#if SPH_64
  251|  33.5k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  33.5k|#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|  33.5k|        {
  259|  33.5k|                unsigned z;
  260|       |
  261|  33.5k|                z = 0x80U >> n;
  262|  33.5k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  33.5k|        }
  264|  33.5k|#endif
  265|  33.5k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  33.5k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  33.5k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  33.5k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 632, False: 32.8k]
  ------------------
  266|    632|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|    632|#define SPH_BLEN     64U
  ------------------
  267|    632|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|    632|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|    632|#define SPH_VAL   sc->val
  ------------------
  268|    632|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|    632|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|    632|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|    632|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  32.8k|        } else {
  270|  32.8k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  32.8k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  32.8k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  32.8k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  32.8k|        }
  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|  33.5k|#if SPH_64
  303|  33.5k|#ifdef BE32
  304|  33.5k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  33.5k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  33.5k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  33.5k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  33.5k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  33.5k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  33.5k|#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|  33.5k|#endif
  323|  33.5k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  33.5k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  33.5k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   301k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 268k, False: 33.5k]
  ------------------
  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|   268k|        }
  340|  33.5k|#endif
  341|  33.5k|}
sph_sha384:
  173|  64.7k|{
  174|  64.7k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  64.7k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  64.7k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  64.7k|        unsigned current;
  176|  64.7k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  64.7k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|  64.7k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 64.7k]
  ------------------
  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|  64.7k|        sc = cc;
  186|  64.7k|#if SPH_64
  187|  64.7k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  64.7k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  64.7k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 64.7k]
  ------------------
  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|  64.7k|        orig_len = len;
  206|  2.26M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  2.26M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 2.19M, False: 64.7k]
  ------------------
  207|  2.19M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  2.19M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.19M|#define SPH_VAL   sc->val
  ------------------
  208|  2.19M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  2.19M|#define SPH_BLEN    128U
  ------------------
  209|  2.19M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  2.19M|#define SPH_BLEN    128U
  ------------------
  210|  2.19M|        }
  211|  64.7k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 64.7k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  64.7k|#if SPH_64
  214|  64.7k|        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|  64.7k|}
sha2big.c:sha384_close:
  345|  64.7k|{
  346|  64.7k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  64.7k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  64.7k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  64.7k|}
sha2big.c:sha384_addbits_and_close:
  242|  64.7k|{
  243|  64.7k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  64.7k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  64.7k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  64.7k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  64.7k|        sc = cc;
  250|  64.7k|#if SPH_64
  251|  64.7k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  64.7k|#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|  64.7k|        {
  259|  64.7k|                unsigned z;
  260|       |
  261|  64.7k|                z = 0x80U >> n;
  262|  64.7k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  64.7k|        }
  264|  64.7k|#endif
  265|  64.7k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  64.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  64.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  64.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 64.7k]
  ------------------
  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|  64.7k|        } else {
  270|  64.7k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  64.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  64.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  64.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|  64.7k|        }
  272|  64.7k|#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|  64.7k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|  64.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  64.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  64.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|  64.7k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|  64.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  64.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  64.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|  64.7k|#define SPH_WLEN      8U
  ------------------
  285|  64.7k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  64.7k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  64.7k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|  64.7k|#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|  64.7k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|  64.7k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  64.7k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   511k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 446k, False: 64.7k]
  ------------------
  330|   446k|#if defined BE64
  331|   446k|                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|   446k|        }
  340|  64.7k|#endif
  341|  64.7k|}

sha2.c:sph_dec32be_aligned:
 1471|  35.4M|{
 1472|  35.4M|#if SPH_LITTLE_ENDIAN
 1473|  35.4M|        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|  35.4M|}
sha2.c:sph_bswap32:
 1220|  35.6M|{
 1221|  35.6M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  35.6M|        return x;
 1223|  35.6M|}
sha2.c:sph_enc64be_aligned:
 1706|  33.5k|{
 1707|  33.5k|#if SPH_LITTLE_ENDIAN
 1708|  33.5k|        *(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|  33.5k|}
sha2.c:sph_bswap64:
 1229|  33.5k|{
 1230|  33.5k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  33.5k|        return x;
 1232|  33.5k|}
sha2.c:sph_enc32be:
 1374|   268k|{
 1375|   268k|#if defined SPH_UPTR
 1376|   268k|#if SPH_UNALIGNED
 1377|   268k|#if SPH_LITTLE_ENDIAN
 1378|   268k|        val = sph_bswap32(val);
 1379|   268k|#endif
 1380|   268k|        *(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|   268k|}
sha2big.c:sph_dec64be_aligned:
 1778|  36.2M|{
 1779|  36.2M|#if SPH_LITTLE_ENDIAN
 1780|  36.2M|        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|  36.2M|}
sha2big.c:sph_bswap64:
 1229|  36.8M|{
 1230|  36.8M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  36.8M|        return x;
 1232|  36.8M|}
sha2big.c:sph_enc64be_aligned:
 1706|   129k|{
 1707|   129k|#if SPH_LITTLE_ENDIAN
 1708|   129k|        *(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|   129k|}
sha2big.c:sph_enc64be:
 1661|   446k|{
 1662|   446k|#if defined SPH_UPTR
 1663|   446k|#if SPH_UNALIGNED
 1664|   446k|#if SPH_LITTLE_ENDIAN
 1665|   446k|        val = sph_bswap64(val);
 1666|   446k|#endif
 1667|   446k|        *(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|   446k|}

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

inflate_fast:
   50|  47.8k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  47.8k|    struct inflate_state FAR *state;
   52|  47.8k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  47.8k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  47.8k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  47.8k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  47.8k|    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|  47.8k|    unsigned wsize;             /* window size or zero if not using window */
   61|  47.8k|    unsigned whave;             /* valid bytes in the window */
   62|  47.8k|    unsigned wnext;             /* window write index */
   63|  47.8k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  47.8k|    unsigned long hold;         /* local strm->hold */
   65|  47.8k|    unsigned bits;              /* local strm->bits */
   66|  47.8k|    code const FAR *lcode;      /* local strm->lencode */
   67|  47.8k|    code const FAR *dcode;      /* local strm->distcode */
   68|  47.8k|    unsigned lmask;             /* mask for first level of length codes */
   69|  47.8k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  47.8k|    code const *here;           /* retrieved table entry */
   71|  47.8k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  47.8k|    unsigned len;               /* match length, unused bytes */
   74|  47.8k|    unsigned dist;              /* match distance */
   75|  47.8k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  47.8k|    state = (struct inflate_state FAR *)strm->state;
   79|  47.8k|    in = strm->next_in;
   80|  47.8k|    last = in + (strm->avail_in - 5);
   81|  47.8k|    out = strm->next_out;
   82|  47.8k|    beg = out - (start - strm->avail_out);
   83|  47.8k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  47.8k|    wsize = state->wsize;
   88|  47.8k|    whave = state->whave;
   89|  47.8k|    wnext = state->wnext;
   90|  47.8k|    window = state->window;
   91|  47.8k|    hold = state->hold;
   92|  47.8k|    bits = state->bits;
   93|  47.8k|    lcode = state->lencode;
   94|  47.8k|    dcode = state->distcode;
   95|  47.8k|    lmask = (1U << state->lenbits) - 1;
   96|  47.8k|    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|  37.5M|    do {
  101|  37.5M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 15.4M, False: 22.1M]
  ------------------
  102|  15.4M|            hold += (unsigned long)(*in++) << bits;
  103|  15.4M|            bits += 8;
  104|  15.4M|            hold += (unsigned long)(*in++) << bits;
  105|  15.4M|            bits += 8;
  106|  15.4M|        }
  107|  37.5M|        here = lcode + (hold & lmask);
  108|  37.8M|      dolen:
  109|  37.8M|        op = (unsigned)(here->bits);
  110|  37.8M|        hold >>= op;
  111|  37.8M|        bits -= op;
  112|  37.8M|        op = (unsigned)(here->op);
  113|  37.8M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 22.6M, False: 15.1M]
  ------------------
  114|  22.6M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  22.6M|                    "inflate:         literal '%c'\n" :
  116|  22.6M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  22.6M|            *out++ = (unsigned char)(here->val);
  118|  22.6M|        }
  119|  15.1M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 14.9M, False: 266k]
  ------------------
  120|  14.9M|            len = (unsigned)(here->val);
  121|  14.9M|            op &= 15;                           /* number of extra bits */
  122|  14.9M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 11.2M, False: 3.68M]
  ------------------
  123|  11.2M|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 20.4k, False: 11.2M]
  ------------------
  124|  20.4k|                    hold += (unsigned long)(*in++) << bits;
  125|  20.4k|                    bits += 8;
  126|  20.4k|                }
  127|  11.2M|                len += (unsigned)hold & ((1U << op) - 1);
  128|  11.2M|                hold >>= op;
  129|  11.2M|                bits -= op;
  130|  11.2M|            }
  131|  14.9M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  14.9M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 6.35M, False: 8.55M]
  ------------------
  133|  6.35M|                hold += (unsigned long)(*in++) << bits;
  134|  6.35M|                bits += 8;
  135|  6.35M|                hold += (unsigned long)(*in++) << bits;
  136|  6.35M|                bits += 8;
  137|  6.35M|            }
  138|  14.9M|            here = dcode + (hold & dmask);
  139|  15.1M|          dodist:
  140|  15.1M|            op = (unsigned)(here->bits);
  141|  15.1M|            hold >>= op;
  142|  15.1M|            bits -= op;
  143|  15.1M|            op = (unsigned)(here->op);
  144|  15.1M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 14.9M, False: 254k]
  ------------------
  145|  14.9M|                dist = (unsigned)(here->val);
  146|  14.9M|                op &= 15;                       /* number of extra bits */
  147|  14.9M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 2.49k, False: 14.9M]
  ------------------
  148|  2.49k|                    hold += (unsigned long)(*in++) << bits;
  149|  2.49k|                    bits += 8;
  150|  2.49k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 0, False: 2.49k]
  ------------------
  151|      0|                        hold += (unsigned long)(*in++) << bits;
  152|      0|                        bits += 8;
  153|      0|                    }
  154|  2.49k|                }
  155|  14.9M|                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|  14.9M|                hold >>= op;
  165|  14.9M|                bits -= op;
  166|  14.9M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  14.9M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  14.9M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 41.8k, False: 14.8M]
  ------------------
  169|  41.8k|                    op = dist - op;             /* distance back in window */
  170|  41.8k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 392, False: 41.4k]
  ------------------
  171|    392|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 392, False: 0]
  ------------------
  172|    392|                            strm->msg = (z_const char *)
  173|    392|                                "invalid distance too far back";
  174|    392|                            state->mode = BAD;
  175|    392|                            break;
  176|    392|                        }
  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|    392|                    }
  197|  41.4k|                    from = window;
  198|  41.4k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 17.7k, False: 23.6k]
  ------------------
  199|  17.7k|                        from += wsize - op;
  200|  17.7k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 2.29k, False: 15.4k]
  ------------------
  201|  2.29k|                            len -= op;
  202|  59.9k|                            do {
  203|  59.9k|                                *out++ = *from++;
  204|  59.9k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 57.6k, False: 2.29k]
  ------------------
  205|  2.29k|                            from = out - dist;  /* rest from output */
  206|  2.29k|                        }
  207|  17.7k|                    }
  208|  23.6k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 373, False: 23.2k]
  ------------------
  209|    373|                        from += wsize + wnext - op;
  210|    373|                        op -= wnext;
  211|    373|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 50, False: 323]
  ------------------
  212|     50|                            len -= op;
  213|  2.68k|                            do {
  214|  2.68k|                                *out++ = *from++;
  215|  2.68k|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 2.63k, False: 50]
  ------------------
  216|     50|                            from = window;
  217|     50|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 23, False: 27]
  ------------------
  218|     23|                                op = wnext;
  219|     23|                                len -= op;
  220|  1.76k|                                do {
  221|  1.76k|                                    *out++ = *from++;
  222|  1.76k|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 1.74k, False: 23]
  ------------------
  223|     23|                                from = out - dist;      /* rest from output */
  224|     23|                            }
  225|     50|                        }
  226|    373|                    }
  227|  23.2k|                    else {                      /* contiguous in window */
  228|  23.2k|                        from += wnext - op;
  229|  23.2k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 4.36k, False: 18.9k]
  ------------------
  230|  4.36k|                            len -= op;
  231|   446k|                            do {
  232|   446k|                                *out++ = *from++;
  233|   446k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 441k, False: 4.36k]
  ------------------
  234|  4.36k|                            from = out - dist;  /* rest from output */
  235|  4.36k|                        }
  236|  23.2k|                    }
  237|   432k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 391k, False: 41.4k]
  ------------------
  238|   391k|                        *out++ = *from++;
  239|   391k|                        *out++ = *from++;
  240|   391k|                        *out++ = *from++;
  241|   391k|                        len -= 3;
  242|   391k|                    }
  243|  41.4k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 19.1k, False: 22.2k]
  ------------------
  244|  19.1k|                        *out++ = *from++;
  245|  19.1k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 7.47k, False: 11.6k]
  ------------------
  246|  7.47k|                            *out++ = *from++;
  247|  19.1k|                    }
  248|  41.4k|                }
  249|  14.8M|                else {
  250|  14.8M|                    from = out - dist;          /* copy direct from output */
  251|   112M|                    do {                        /* minimum length is three */
  252|   112M|                        *out++ = *from++;
  253|   112M|                        *out++ = *from++;
  254|   112M|                        *out++ = *from++;
  255|   112M|                        len -= 3;
  256|   112M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 97.6M, False: 14.8M]
  ------------------
  257|  14.8M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 4.89M, False: 9.97M]
  ------------------
  258|  4.89M|                        *out++ = *from++;
  259|  4.89M|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 3.18M, False: 1.71M]
  ------------------
  260|  3.18M|                            *out++ = *from++;
  261|  4.89M|                    }
  262|  14.8M|                }
  263|  14.9M|            }
  264|   254k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 254k, False: 23]
  ------------------
  265|   254k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|   254k|                goto dodist;
  267|   254k|            }
  268|     23|            else {
  269|     23|                strm->msg = (z_const char *)"invalid distance code";
  270|     23|                state->mode = BAD;
  271|     23|                break;
  272|     23|            }
  273|  15.1M|        }
  274|   266k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 259k, False: 6.88k]
  ------------------
  275|   259k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|   259k|            goto dolen;
  277|   259k|        }
  278|  6.88k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 6.87k, False: 16]
  ------------------
  279|  6.87k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  6.87k|            state->mode = TYPE;
  281|  6.87k|            break;
  282|  6.87k|        }
  283|     16|        else {
  284|     16|            strm->msg = (z_const char *)"invalid literal/length code";
  285|     16|            state->mode = BAD;
  286|     16|            break;
  287|     16|        }
  288|  37.8M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 37.5M, False: 37.8k]
  |  Branch (288:27): [True: 37.5M, False: 2.69k]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|  47.8k|    len = bits >> 3;
  292|  47.8k|    in -= len;
  293|  47.8k|    bits -= len << 3;
  294|  47.8k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|  47.8k|    strm->next_in = in;
  298|  47.8k|    strm->next_out = out;
  299|  47.8k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 27.0k, False: 20.7k]
  ------------------
  300|  47.8k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 45.0k, False: 2.70k]
  ------------------
  301|  45.0k|                                 257 + (end - out) : 257 - (out - end));
  302|  47.8k|    state->hold = hold;
  303|  47.8k|    state->bits = bits;
  304|  47.8k|    return;
  305|  47.8k|}

inflateResetKeep:
  100|  19.6k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|  19.6k|    struct inflate_state FAR *state;
  102|       |
  103|  19.6k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 19.6k]
  ------------------
  104|  19.6k|    state = (struct inflate_state FAR *)strm->state;
  105|  19.6k|    strm->total_in = strm->total_out = state->total = 0;
  106|  19.6k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|  19.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|  19.6k|    strm->data_type = 0;
  108|  19.6k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 19.6k, False: 0]
  ------------------
  109|  19.6k|        strm->adler = state->wrap & 1;
  110|  19.6k|    state->mode = HEAD;
  111|  19.6k|    state->last = 0;
  112|  19.6k|    state->havedict = 0;
  113|  19.6k|    state->flags = -1;
  114|  19.6k|    state->dmax = 32768U;
  115|  19.6k|    state->head = Z_NULL;
  ------------------
  |  |  216|  19.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|  19.6k|    state->hold = 0;
  117|  19.6k|    state->bits = 0;
  118|  19.6k|    state->lencode = state->distcode = state->next = state->codes;
  119|  19.6k|    state->sane = 1;
  120|  19.6k|    state->back = -1;
  121|  19.6k|    Tracev((stderr, "inflate: reset\n"));
  122|  19.6k|    return Z_OK;
  ------------------
  |  |  181|  19.6k|#define Z_OK            0
  ------------------
  123|  19.6k|}
inflateReset:
  125|  19.6k|int ZEXPORT inflateReset(z_streamp strm) {
  126|  19.6k|    struct inflate_state FAR *state;
  127|       |
  128|  19.6k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 19.6k]
  ------------------
  129|  19.6k|    state = (struct inflate_state FAR *)strm->state;
  130|  19.6k|    state->wsize = 0;
  131|  19.6k|    state->whave = 0;
  132|  19.6k|    state->wnext = 0;
  133|  19.6k|    return inflateResetKeep(strm);
  134|  19.6k|}
inflateReset2:
  136|  19.6k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  137|  19.6k|    int wrap;
  138|  19.6k|    struct inflate_state FAR *state;
  139|       |
  140|       |    /* get the state */
  141|  19.6k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (141:9): [True: 0, False: 19.6k]
  ------------------
  142|  19.6k|    state = (struct inflate_state FAR *)strm->state;
  143|       |
  144|       |    /* extract wrap request from windowBits parameter */
  145|  19.6k|    if (windowBits < 0) {
  ------------------
  |  Branch (145:9): [True: 0, False: 19.6k]
  ------------------
  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|  19.6k|    else {
  152|  19.6k|        wrap = (windowBits >> 4) + 5;
  153|  19.6k|#ifdef GUNZIP
  154|  19.6k|        if (windowBits < 48)
  ------------------
  |  Branch (154:13): [True: 19.6k, False: 0]
  ------------------
  155|  19.6k|            windowBits &= 15;
  156|  19.6k|#endif
  157|  19.6k|    }
  158|       |
  159|       |    /* set number of window bits, free window if different */
  160|  19.6k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (160:9): [True: 19.6k, False: 0]
  |  Branch (160:24): [True: 0, False: 19.6k]
  |  Branch (160:42): [True: 0, False: 19.6k]
  ------------------
  161|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  162|  19.6k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|  39.3k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (162:9): [True: 0, False: 19.6k]
  |  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|  19.6k|    state->wrap = wrap;
  169|  19.6k|    state->wbits = (unsigned)windowBits;
  170|  19.6k|    return inflateReset(strm);
  171|  19.6k|}
inflateInit2_:
  174|  19.6k|                          const char *version, int stream_size) {
  175|  19.6k|    int ret;
  176|  19.6k|    struct inflate_state FAR *state;
  177|       |
  178|  19.6k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|  39.3k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|  19.6k|#define ZLIB_VERSION "1.3.2.1-motley"
  ------------------
  |  Branch (178:9): [True: 0, False: 19.6k]
  |  Branch (178:30): [True: 0, False: 19.6k]
  ------------------
  179|  19.6k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (179:9): [True: 0, False: 19.6k]
  ------------------
  180|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  181|  19.6k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|  19.6k|#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: 19.6k]
  ------------------
  182|  19.6k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|  19.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  183|  19.6k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (183:9): [True: 19.6k, False: 0]
  ------------------
  184|       |#ifdef Z_SOLO
  185|       |        return Z_STREAM_ERROR;
  186|       |#else
  187|  19.6k|        strm->zalloc = zcalloc;
  188|  19.6k|        strm->opaque = (voidpf)0;
  189|  19.6k|#endif
  190|  19.6k|    }
  191|  19.6k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (191:9): [True: 19.6k, False: 0]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|  19.6k|        strm->zfree = zcfree;
  196|  19.6k|#endif
  197|  19.6k|    state = (struct inflate_state FAR *)
  198|  19.6k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|  19.6k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  199|  19.6k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|  19.6k|#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: 19.6k]
  ------------------
  200|  19.6k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|  19.6k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  201|  19.6k|    Tracev((stderr, "inflate: allocated\n"));
  202|  19.6k|    strm->state = (struct internal_state FAR *)state;
  203|  19.6k|    state->strm = strm;
  204|  19.6k|    state->window = Z_NULL;
  ------------------
  |  |  216|  19.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  205|  19.6k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  206|  19.6k|    ret = inflateReset2(strm, windowBits);
  207|  19.6k|    if (ret != Z_OK) {
  ------------------
  |  |  181|  19.6k|#define Z_OK            0
  ------------------
  |  Branch (207:9): [True: 0, False: 19.6k]
  ------------------
  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|  19.6k|    return ret;
  212|  19.6k|}
inflateInit_:
  215|  19.6k|                         int stream_size) {
  216|  19.6k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   76|  19.6k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  287|  19.6k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  217|  19.6k|}
inflate:
  474|   214k|int ZEXPORT inflate(z_streamp strm, int flush) {
  475|   214k|    struct inflate_state FAR *state;
  476|   214k|    z_const unsigned char FAR *next;    /* next input */
  477|   214k|    unsigned char FAR *put;     /* next output */
  478|   214k|    unsigned have, left;        /* available input and output */
  479|   214k|    unsigned long hold;         /* bit buffer */
  480|   214k|    unsigned bits;              /* bits in bit buffer */
  481|   214k|    unsigned in, out;           /* save starting available input and output */
  482|   214k|    unsigned copy;              /* number of stored or match bytes to copy */
  483|   214k|    unsigned char FAR *from;    /* where to copy match bytes from */
  484|   214k|    code here;                  /* current decoding table entry */
  485|   214k|    code last;                  /* parent table entry */
  486|   214k|    unsigned len;               /* length to copy for repeats, bits to drop */
  487|   214k|    int ret;                    /* return code */
  488|   214k|#ifdef GUNZIP
  489|   214k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  490|   214k|#endif
  491|   214k|    static const unsigned short order[19] = /* permutation of code lengths */
  492|   214k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  493|       |
  494|   214k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   429k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (494:9): [True: 0, False: 214k]
  |  Branch (494:36): [True: 0, False: 214k]
  ------------------
  495|   214k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   429k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (495:10): [True: 0, False: 214k]
  |  Branch (495:37): [True: 0, False: 0]
  ------------------
  496|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  497|       |
  498|   214k|    state = (struct inflate_state FAR *)strm->state;
  499|   214k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (499:9): [True: 942, False: 213k]
  ------------------
  500|   214k|    LOAD();
  ------------------
  |  |  329|   214k|    do { \
  |  |  330|   214k|        put = strm->next_out; \
  |  |  331|   214k|        left = strm->avail_out; \
  |  |  332|   214k|        next = strm->next_in; \
  |  |  333|   214k|        have = strm->avail_in; \
  |  |  334|   214k|        hold = state->hold; \
  |  |  335|   214k|        bits = state->bits; \
  |  |  336|   214k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 214k]
  |  |  ------------------
  ------------------
  501|   214k|    in = have;
  502|   214k|    out = left;
  503|   214k|    ret = Z_OK;
  ------------------
  |  |  181|   214k|#define Z_OK            0
  ------------------
  504|   214k|    for (;;)
  505|  1.91M|        switch (state->mode) {
  506|  19.7k|        case HEAD:
  ------------------
  |  Branch (506:9): [True: 19.7k, False: 1.89M]
  ------------------
  507|  19.7k|            if (state->wrap == 0) {
  ------------------
  |  Branch (507:17): [True: 0, False: 19.7k]
  ------------------
  508|      0|                state->mode = TYPEDO;
  509|      0|                break;
  510|      0|            }
  511|  19.7k|            NEEDBITS(16);
  ------------------
  |  |  369|  19.7k|    do { \
  |  |  370|  58.9k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 39.3k, False: 19.5k]
  |  |  ------------------
  |  |  371|  39.3k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  39.3k|    do { \
  |  |  |  |  360|  39.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 131, False: 39.2k]
  |  |  |  |  ------------------
  |  |  |  |  361|  39.3k|        have--; \
  |  |  |  |  362|  39.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  39.2k|        bits += 8; \
  |  |  |  |  364|  39.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 39.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  19.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 19.5k]
  |  |  ------------------
  ------------------
  512|  19.5k|#ifdef GUNZIP
  513|  19.5k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (513:17): [True: 0, False: 19.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|  19.5k|            if (state->head != Z_NULL)
  ------------------
  |  |  216|  19.5k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (522:17): [True: 0, False: 19.5k]
  ------------------
  523|      0|                state->head->done = -1;
  524|  19.5k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (524:17): [True: 0, False: 19.5k]
  ------------------
  525|       |#else
  526|       |            if (
  527|       |#endif
  528|  19.5k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  376|  19.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (528:17): [True: 265, False: 19.3k]
  ------------------
  529|    265|                strm->msg = (z_const char *)"incorrect header check";
  530|    265|                state->mode = BAD;
  531|    265|                break;
  532|    265|            }
  533|  19.3k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  376|  19.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|  19.3k|#define Z_DEFLATED   8
  ------------------
  |  Branch (533:17): [True: 21, False: 19.3k]
  ------------------
  534|     21|                strm->msg = (z_const char *)"unknown compression method";
  535|     21|                state->mode = BAD;
  536|     21|                break;
  537|     21|            }
  538|  19.3k|            DROPBITS(4);
  ------------------
  |  |  380|  19.3k|    do { \
  |  |  381|  19.3k|        hold >>= (n); \
  |  |  382|  19.3k|        bits -= (unsigned)(n); \
  |  |  383|  19.3k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 19.3k]
  |  |  ------------------
  ------------------
  539|  19.3k|            len = BITS(4) + 8;
  ------------------
  |  |  376|  19.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  540|  19.3k|            if (state->wbits == 0)
  ------------------
  |  Branch (540:17): [True: 0, False: 19.3k]
  ------------------
  541|      0|                state->wbits = len;
  542|  19.3k|            if (len > 15 || len > state->wbits) {
  ------------------
  |  Branch (542:17): [True: 18, False: 19.2k]
  |  Branch (542:29): [True: 0, False: 19.2k]
  ------------------
  543|     18|                strm->msg = (z_const char *)"invalid window size";
  544|     18|                state->mode = BAD;
  545|     18|                break;
  546|     18|            }
  547|  19.2k|            state->dmax = 1U << len;
  548|  19.2k|            state->flags = 0;               /* indicate zlib header */
  549|  19.2k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  550|  19.2k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|  19.2k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  551|  19.2k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (551:27): [True: 54, False: 19.2k]
  ------------------
  552|  19.2k|            INITBITS();
  ------------------
  |  |  351|  19.2k|    do { \
  |  |  352|  19.2k|        hold = 0; \
  |  |  353|  19.2k|        bits = 0; \
  |  |  354|  19.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 19.2k]
  |  |  ------------------
  ------------------
  553|  19.2k|            break;
  554|      0|#ifdef GUNZIP
  555|      0|        case FLAGS:
  ------------------
  |  Branch (555:9): [True: 0, False: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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: 1.91M]
  ------------------
  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|     97|        case DICTID:
  ------------------
  |  Branch (694:9): [True: 97, False: 1.91M]
  ------------------
  695|     97|            NEEDBITS(32);
  ------------------
  |  |  369|     97|    do { \
  |  |  370|    224|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 211, False: 13]
  |  |  ------------------
  |  |  371|    211|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|    211|    do { \
  |  |  |  |  360|    211|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 84, False: 127]
  |  |  |  |  ------------------
  |  |  |  |  361|    211|        have--; \
  |  |  |  |  362|    127|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|    127|        bits += 8; \
  |  |  |  |  364|    127|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|     97|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 13]
  |  |  ------------------
  ------------------
  696|     13|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|     13|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|     13|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  697|     13|            INITBITS();
  ------------------
  |  |  351|     13|    do { \
  |  |  352|     13|        hold = 0; \
  |  |  353|     13|        bits = 0; \
  |  |  354|     13|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 13]
  |  |  ------------------
  ------------------
  698|     13|            state->mode = DICT;
  699|       |                /* fallthrough */
  700|     24|        case DICT:
  ------------------
  |  Branch (700:9): [True: 11, False: 1.91M]
  ------------------
  701|     24|            if (state->havedict == 0) {
  ------------------
  |  Branch (701:17): [True: 24, False: 0]
  ------------------
  702|     24|                RESTORE();
  ------------------
  |  |  340|     24|    do { \
  |  |  341|     24|        strm->next_out = put; \
  |  |  342|     24|        strm->avail_out = left; \
  |  |  343|     24|        strm->next_in = next; \
  |  |  344|     24|        strm->avail_in = have; \
  |  |  345|     24|        state->hold = hold; \
  |  |  346|     24|        state->bits = bits; \
  |  |  347|     24|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 24]
  |  |  ------------------
  ------------------
  703|     24|                return Z_NEED_DICT;
  ------------------
  |  |  183|     24|#define Z_NEED_DICT     2
  ------------------
  704|     24|            }
  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|  34.8k|        case TYPE:
  ------------------
  |  Branch (708:9): [True: 34.8k, False: 1.88M]
  ------------------
  709|  34.8k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|  69.7k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  34.8k|#define Z_TREES         6
  ------------------
  |  Branch (709:17): [True: 0, False: 34.8k]
  |  Branch (709:37): [True: 0, False: 34.8k]
  ------------------
  710|       |                /* fallthrough */
  711|  35.8k|        case TYPEDO:
  ------------------
  |  Branch (711:9): [True: 942, False: 1.91M]
  ------------------
  712|  35.8k|            if (state->last) {
  ------------------
  |  Branch (712:17): [True: 5.38k, False: 30.4k]
  ------------------
  713|  5.38k|                BYTEBITS();
  ------------------
  |  |  387|  5.38k|    do { \
  |  |  388|  5.38k|        hold >>= bits & 7; \
  |  |  389|  5.38k|        bits -= bits & 7; \
  |  |  390|  5.38k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 5.38k]
  |  |  ------------------
  ------------------
  714|  5.38k|                state->mode = CHECK;
  715|  5.38k|                break;
  716|  5.38k|            }
  717|  30.4k|            NEEDBITS(3);
  ------------------
  |  |  369|  30.4k|    do { \
  |  |  370|  51.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 22.8k, False: 28.5k]
  |  |  ------------------
  |  |  371|  30.4k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  22.8k|    do { \
  |  |  |  |  360|  22.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 1.84k, False: 21.0k]
  |  |  |  |  ------------------
  |  |  |  |  361|  22.8k|        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|  30.4k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 28.5k]
  |  |  ------------------
  ------------------
  718|  28.5k|            state->last = BITS(1);
  ------------------
  |  |  376|  28.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  719|  28.5k|            DROPBITS(1);
  ------------------
  |  |  380|  28.5k|    do { \
  |  |  381|  28.5k|        hold >>= (n); \
  |  |  382|  28.5k|        bits -= (unsigned)(n); \
  |  |  383|  28.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 28.5k]
  |  |  ------------------
  ------------------
  720|  28.5k|            switch (BITS(2)) {
  ------------------
  |  |  376|  28.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  721|    707|            case 0:                             /* stored block */
  ------------------
  |  Branch (721:13): [True: 707, False: 27.8k]
  ------------------
  722|    707|                Tracev((stderr, "inflate:     stored block%s\n",
  723|    707|                        state->last ? " (last)" : ""));
  724|    707|                state->mode = STORED;
  725|    707|                break;
  726|  11.9k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (726:13): [True: 11.9k, False: 16.6k]
  ------------------
  727|  11.9k|                inflate_fixed(state);
  728|  11.9k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  729|  11.9k|                        state->last ? " (last)" : ""));
  730|  11.9k|                state->mode = LEN_;             /* decode codes */
  731|  11.9k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  11.9k|#define Z_TREES         6
  ------------------
  |  Branch (731:21): [True: 0, False: 11.9k]
  ------------------
  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|  11.9k|                break;
  736|  15.9k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (736:13): [True: 15.9k, False: 12.6k]
  ------------------
  737|  15.9k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  738|  15.9k|                        state->last ? " (last)" : ""));
  739|  15.9k|                state->mode = TABLE;
  740|  15.9k|                break;
  741|     34|            default:
  ------------------
  |  Branch (741:13): [True: 34, False: 28.5k]
  ------------------
  742|     34|                strm->msg = (z_const char *)"invalid block type";
  743|     34|                state->mode = BAD;
  744|  28.5k|            }
  745|  28.5k|            DROPBITS(2);
  ------------------
  |  |  380|  28.5k|    do { \
  |  |  381|  28.5k|        hold >>= (n); \
  |  |  382|  28.5k|        bits -= (unsigned)(n); \
  |  |  383|  28.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 28.5k]
  |  |  ------------------
  ------------------
  746|  28.5k|            break;
  747|  1.22k|        case STORED:
  ------------------
  |  Branch (747:9): [True: 1.22k, False: 1.91M]
  ------------------
  748|  1.22k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  387|  1.22k|    do { \
  |  |  388|  1.22k|        hold >>= bits & 7; \
  |  |  389|  1.22k|        bits -= bits & 7; \
  |  |  390|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (390:14): [Folded, False: 1.22k]
  |  |  ------------------
  ------------------
  749|  1.22k|            NEEDBITS(32);
  ------------------
  |  |  369|  1.22k|    do { \
  |  |  370|  3.40k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 3.01k, False: 396]
  |  |  ------------------
  |  |  371|  3.01k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  3.01k|    do { \
  |  |  |  |  360|  3.01k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 826, False: 2.18k]
  |  |  |  |  ------------------
  |  |  |  |  361|  3.01k|        have--; \
  |  |  |  |  362|  2.18k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  2.18k|        bits += 8; \
  |  |  |  |  364|  2.18k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 2.18k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  1.22k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 396]
  |  |  ------------------
  ------------------
  750|    396|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (750:17): [True: 94, False: 302]
  ------------------
  751|     94|                strm->msg = (z_const char *)"invalid stored block lengths";
  752|     94|                state->mode = BAD;
  753|     94|                break;
  754|     94|            }
  755|    302|            state->length = (unsigned)hold & 0xffff;
  756|    302|            Tracev((stderr, "inflate:       stored length %u\n",
  757|    302|                    state->length));
  758|    302|            INITBITS();
  ------------------
  |  |  351|    302|    do { \
  |  |  352|    302|        hold = 0; \
  |  |  353|    302|        bits = 0; \
  |  |  354|    302|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 302]
  |  |  ------------------
  ------------------
  759|    302|            state->mode = COPY_;
  760|    302|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|    302|#define Z_TREES         6
  ------------------
  |  Branch (760:17): [True: 0, False: 302]
  ------------------
  761|       |                /* fallthrough */
  762|    302|        case COPY_:
  ------------------
  |  Branch (762:9): [True: 0, False: 1.91M]
  ------------------
  763|    302|            state->mode = COPY;
  764|       |                /* fallthrough */
  765|    831|        case COPY:
  ------------------
  |  Branch (765:9): [True: 529, False: 1.91M]
  ------------------
  766|    831|            copy = state->length;
  767|    831|            if (copy) {
  ------------------
  |  Branch (767:17): [True: 733, False: 98]
  ------------------
  768|    733|                if (copy > have) copy = have;
  ------------------
  |  Branch (768:21): [True: 649, False: 84]
  ------------------
  769|    733|                if (copy > left) copy = left;
  ------------------
  |  Branch (769:21): [True: 44, False: 689]
  ------------------
  770|    733|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (770:21): [True: 431, False: 302]
  ------------------
  771|    302|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|    302|#    define zmemcpy memcpy
  ------------------
  772|    302|                have -= copy;
  773|    302|                next += copy;
  774|    302|                left -= copy;
  775|    302|                put += copy;
  776|    302|                state->length -= copy;
  777|    302|                break;
  778|    733|            }
  779|     98|            Tracev((stderr, "inflate:       stored end\n"));
  780|     98|            state->mode = TYPE;
  781|     98|            break;
  782|  19.9k|        case TABLE:
  ------------------
  |  Branch (782:9): [True: 19.9k, False: 1.89M]
  ------------------
  783|  19.9k|            NEEDBITS(14);
  ------------------
  |  |  369|  19.9k|    do { \
  |  |  370|  51.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 35.5k, False: 15.8k]
  |  |  ------------------
  |  |  371|  35.5k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  35.5k|    do { \
  |  |  |  |  360|  35.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 4.10k, False: 31.4k]
  |  |  |  |  ------------------
  |  |  |  |  361|  35.5k|        have--; \
  |  |  |  |  362|  31.4k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  31.4k|        bits += 8; \
  |  |  |  |  364|  31.4k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 31.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  19.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 15.8k]
  |  |  ------------------
  ------------------
  784|  15.8k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  376|  15.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  785|  15.8k|            DROPBITS(5);
  ------------------
  |  |  380|  15.8k|    do { \
  |  |  381|  15.8k|        hold >>= (n); \
  |  |  382|  15.8k|        bits -= (unsigned)(n); \
  |  |  383|  15.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 15.8k]
  |  |  ------------------
  ------------------
  786|  15.8k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  376|  15.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  787|  15.8k|            DROPBITS(5);
  ------------------
  |  |  380|  15.8k|    do { \
  |  |  381|  15.8k|        hold >>= (n); \
  |  |  382|  15.8k|        bits -= (unsigned)(n); \
  |  |  383|  15.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 15.8k]
  |  |  ------------------
  ------------------
  788|  15.8k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  376|  15.8k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  789|  15.8k|            DROPBITS(4);
  ------------------
  |  |  380|  15.8k|    do { \
  |  |  381|  15.8k|        hold >>= (n); \
  |  |  382|  15.8k|        bits -= (unsigned)(n); \
  |  |  383|  15.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 15.8k]
  |  |  ------------------
  ------------------
  790|  15.8k|#ifndef PKZIP_BUG_WORKAROUND
  791|  15.8k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (791:17): [True: 10, False: 15.8k]
  |  Branch (791:38): [True: 14, False: 15.7k]
  ------------------
  792|     24|                strm->msg = (z_const char *)
  793|     24|                    "too many length or distance symbols";
  794|     24|                state->mode = BAD;
  795|     24|                break;
  796|     24|            }
  797|  15.7k|#endif
  798|  15.7k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  799|  15.7k|            state->have = 0;
  800|  15.7k|            state->mode = LENLENS;
  801|       |                /* fallthrough */
  802|  21.3k|        case LENLENS:
  ------------------
  |  Branch (802:9): [True: 5.51k, False: 1.91M]
  ------------------
  803|   270k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (803:20): [True: 255k, False: 14.9k]
  ------------------
  804|   255k|                NEEDBITS(3);
  ------------------
  |  |  369|   255k|    do { \
  |  |  370|   341k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 92.6k, False: 249k]
  |  |  ------------------
  |  |  371|   255k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  92.6k|    do { \
  |  |  |  |  360|  92.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 6.39k, False: 86.2k]
  |  |  |  |  ------------------
  |  |  |  |  361|  92.6k|        have--; \
  |  |  |  |  362|  86.2k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  86.2k|        bits += 8; \
  |  |  |  |  364|  86.2k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 86.2k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   255k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 249k]
  |  |  ------------------
  ------------------
  805|   249k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  376|   249k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  806|   249k|                DROPBITS(3);
  ------------------
  |  |  380|   249k|    do { \
  |  |  381|   249k|        hold >>= (n); \
  |  |  382|   249k|        bits -= (unsigned)(n); \
  |  |  383|   249k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 249k]
  |  |  ------------------
  ------------------
  807|   249k|            }
  808|  54.6k|            while (state->have < 19)
  ------------------
  |  Branch (808:20): [True: 39.7k, False: 14.9k]
  ------------------
  809|  39.7k|                state->lens[order[state->have++]] = 0;
  810|  14.9k|            state->next = state->codes;
  811|  14.9k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  812|  14.9k|            state->lenbits = 7;
  813|  14.9k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  814|  14.9k|                                &(state->lenbits), state->work);
  815|  14.9k|            if (ret) {
  ------------------
  |  Branch (815:17): [True: 100, False: 14.8k]
  ------------------
  816|    100|                strm->msg = (z_const char *)"invalid code lengths set";
  817|    100|                state->mode = BAD;
  818|    100|                break;
  819|    100|            }
  820|  14.8k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  821|  14.8k|            state->have = 0;
  822|  14.8k|            state->mode = CODELENS;
  823|       |                /* fallthrough */
  824|  34.2k|        case CODELENS:
  ------------------
  |  Branch (824:9): [True: 19.4k, False: 1.89M]
  ------------------
  825|  1.31M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (825:20): [True: 1.30M, False: 12.7k]
  ------------------
  826|  1.82M|                for (;;) {
  827|  1.82M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|  1.82M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  828|  1.82M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (828:25): [True: 1.28M, False: 535k]
  ------------------
  829|   535k|                    PULLBYTE();
  ------------------
  |  |  359|   535k|    do { \
  |  |  360|   535k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 13.7k, False: 522k]
  |  |  ------------------
  |  |  361|   535k|        have--; \
  |  |  362|   522k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   522k|        bits += 8; \
  |  |  364|   522k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 522k]
  |  |  ------------------
  ------------------
  830|   535k|                }
  831|  1.28M|                if (here.val < 16) {
  ------------------
  |  Branch (831:21): [True: 1.10M, False: 179k]
  ------------------
  832|  1.10M|                    DROPBITS(here.bits);
  ------------------
  |  |  380|  1.10M|    do { \
  |  |  381|  1.10M|        hold >>= (n); \
  |  |  382|  1.10M|        bits -= (unsigned)(n); \
  |  |  383|  1.10M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.10M]
  |  |  ------------------
  ------------------
  833|  1.10M|                    state->lens[state->have++] = here.val;
  834|  1.10M|                }
  835|   179k|                else {
  836|   179k|                    if (here.val == 16) {
  ------------------
  |  Branch (836:25): [True: 22.1k, False: 157k]
  ------------------
  837|  22.1k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  369|  22.1k|    do { \
  |  |  370|  25.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 2.93k, False: 22.0k]
  |  |  ------------------
  |  |  371|  22.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  2.93k|    do { \
  |  |  |  |  360|  2.93k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 60, False: 2.87k]
  |  |  |  |  ------------------
  |  |  |  |  361|  2.93k|        have--; \
  |  |  |  |  362|  2.87k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  2.87k|        bits += 8; \
  |  |  |  |  364|  2.87k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 2.87k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  22.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 22.0k]
  |  |  ------------------
  ------------------
  838|  22.0k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  22.0k|    do { \
  |  |  381|  22.0k|        hold >>= (n); \
  |  |  382|  22.0k|        bits -= (unsigned)(n); \
  |  |  383|  22.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 22.0k]
  |  |  ------------------
  ------------------
  839|  22.0k|                        if (state->have == 0) {
  ------------------
  |  Branch (839:29): [True: 11, False: 22.0k]
  ------------------
  840|     11|                            strm->msg = (z_const char *)
  841|     11|                                "invalid bit length repeat";
  842|     11|                            state->mode = BAD;
  843|     11|                            break;
  844|     11|                        }
  845|  22.0k|                        len = state->lens[state->have - 1];
  846|  22.0k|                        copy = 3 + BITS(2);
  ------------------
  |  |  376|  22.0k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  847|  22.0k|                        DROPBITS(2);
  ------------------
  |  |  380|  22.0k|    do { \
  |  |  381|  22.0k|        hold >>= (n); \
  |  |  382|  22.0k|        bits -= (unsigned)(n); \
  |  |  383|  22.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 22.0k]
  |  |  ------------------
  ------------------
  848|  22.0k|                    }
  849|   157k|                    else if (here.val == 17) {
  ------------------
  |  Branch (849:30): [True: 94.0k, False: 63.0k]
  ------------------
  850|  94.0k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  369|  94.0k|    do { \
  |  |  370|   134k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 40.2k, False: 93.9k]
  |  |  ------------------
  |  |  371|  94.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  40.2k|    do { \
  |  |  |  |  360|  40.2k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 95, False: 40.1k]
  |  |  |  |  ------------------
  |  |  |  |  361|  40.2k|        have--; \
  |  |  |  |  362|  40.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  40.1k|        bits += 8; \
  |  |  |  |  364|  40.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 40.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  94.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 93.9k]
  |  |  ------------------
  ------------------
  851|  93.9k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  93.9k|    do { \
  |  |  381|  93.9k|        hold >>= (n); \
  |  |  382|  93.9k|        bits -= (unsigned)(n); \
  |  |  383|  93.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 93.9k]
  |  |  ------------------
  ------------------
  852|  93.9k|                        len = 0;
  853|  93.9k|                        copy = 3 + BITS(3);
  ------------------
  |  |  376|  93.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  854|  93.9k|                        DROPBITS(3);
  ------------------
  |  |  380|  93.9k|    do { \
  |  |  381|  93.9k|        hold >>= (n); \
  |  |  382|  93.9k|        bits -= (unsigned)(n); \
  |  |  383|  93.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 93.9k]
  |  |  ------------------
  ------------------
  855|  93.9k|                    }
  856|  63.0k|                    else {
  857|  63.0k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  369|  63.0k|    do { \
  |  |  370|   108k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 53.3k, False: 55.5k]
  |  |  ------------------
  |  |  371|  63.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  53.3k|    do { \
  |  |  |  |  360|  53.3k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 7.58k, False: 45.7k]
  |  |  |  |  ------------------
  |  |  |  |  361|  53.3k|        have--; \
  |  |  |  |  362|  45.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  45.7k|        bits += 8; \
  |  |  |  |  364|  45.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 45.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  63.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 55.5k]
  |  |  ------------------
  ------------------
  858|  55.5k|                        DROPBITS(here.bits);
  ------------------
  |  |  380|  55.5k|    do { \
  |  |  381|  55.5k|        hold >>= (n); \
  |  |  382|  55.5k|        bits -= (unsigned)(n); \
  |  |  383|  55.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 55.5k]
  |  |  ------------------
  ------------------
  859|  55.5k|                        len = 0;
  860|  55.5k|                        copy = 11 + BITS(7);
  ------------------
  |  |  376|  55.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  861|  55.5k|                        DROPBITS(7);
  ------------------
  |  |  380|  55.5k|    do { \
  |  |  381|  55.5k|        hold >>= (n); \
  |  |  382|  55.5k|        bits -= (unsigned)(n); \
  |  |  383|  55.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 55.5k]
  |  |  ------------------
  ------------------
  862|  55.5k|                    }
  863|   171k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (863:25): [True: 63, False: 171k]
  ------------------
  864|     63|                        strm->msg = (z_const char *)
  865|     63|                            "invalid bit length repeat";
  866|     63|                        state->mode = BAD;
  867|     63|                        break;
  868|     63|                    }
  869|  3.47M|                    while (copy--)
  ------------------
  |  Branch (869:28): [True: 3.30M, False: 171k]
  ------------------
  870|  3.30M|                        state->lens[state->have++] = (unsigned short)len;
  871|   171k|                }
  872|  1.28M|            }
  873|       |
  874|       |            /* handle error breaks in while */
  875|  12.7k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (875:17): [True: 74, False: 12.7k]
  ------------------
  876|       |
  877|       |            /* check for end-of-block code (better have one) */
  878|  12.7k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (878:17): [True: 34, False: 12.6k]
  ------------------
  879|     34|                strm->msg = (z_const char *)
  880|     34|                    "invalid code -- missing end-of-block";
  881|     34|                state->mode = BAD;
  882|     34|                break;
  883|     34|            }
  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|  12.6k|            state->next = state->codes;
  889|  12.6k|            state->lencode = (const code FAR *)(state->next);
  890|  12.6k|            state->lenbits = 9;
  891|  12.6k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  892|  12.6k|                                &(state->lenbits), state->work);
  893|  12.6k|            if (ret) {
  ------------------
  |  Branch (893:17): [True: 96, False: 12.5k]
  ------------------
  894|     96|                strm->msg = (z_const char *)"invalid literal/lengths set";
  895|     96|                state->mode = BAD;
  896|     96|                break;
  897|     96|            }
  898|  12.5k|            state->distcode = (const code FAR *)(state->next);
  899|  12.5k|            state->distbits = 6;
  900|  12.5k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  901|  12.5k|                            &(state->next), &(state->distbits), state->work);
  902|  12.5k|            if (ret) {
  ------------------
  |  Branch (902:17): [True: 41, False: 12.5k]
  ------------------
  903|     41|                strm->msg = (z_const char *)"invalid distances set";
  904|     41|                state->mode = BAD;
  905|     41|                break;
  906|     41|            }
  907|  12.5k|            Tracev((stderr, "inflate:       codes ok\n"));
  908|  12.5k|            state->mode = LEN_;
  909|  12.5k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  12.5k|#define Z_TREES         6
  ------------------
  |  Branch (909:17): [True: 0, False: 12.5k]
  ------------------
  910|       |                /* fallthrough */
  911|  24.4k|        case LEN_:
  ------------------
  |  Branch (911:9): [True: 11.9k, False: 1.90M]
  ------------------
  912|  24.4k|            state->mode = LEN;
  913|       |                /* fallthrough */
  914|  1.17M|        case LEN:
  ------------------
  |  Branch (914:9): [True: 1.15M, False: 764k]
  ------------------
  915|  1.17M|            if (have >= 6 && left >= 258) {
  ------------------
  |  Branch (915:17): [True: 143k, False: 1.03M]
  |  Branch (915:30): [True: 47.8k, False: 95.6k]
  ------------------
  916|  47.8k|                RESTORE();
  ------------------
  |  |  340|  47.8k|    do { \
  |  |  341|  47.8k|        strm->next_out = put; \
  |  |  342|  47.8k|        strm->avail_out = left; \
  |  |  343|  47.8k|        strm->next_in = next; \
  |  |  344|  47.8k|        strm->avail_in = have; \
  |  |  345|  47.8k|        state->hold = hold; \
  |  |  346|  47.8k|        state->bits = bits; \
  |  |  347|  47.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 47.8k]
  |  |  ------------------
  ------------------
  917|  47.8k|                inflate_fast(strm, out);
  918|  47.8k|                LOAD();
  ------------------
  |  |  329|  47.8k|    do { \
  |  |  330|  47.8k|        put = strm->next_out; \
  |  |  331|  47.8k|        left = strm->avail_out; \
  |  |  332|  47.8k|        next = strm->next_in; \
  |  |  333|  47.8k|        have = strm->avail_in; \
  |  |  334|  47.8k|        hold = state->hold; \
  |  |  335|  47.8k|        bits = state->bits; \
  |  |  336|  47.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (336:14): [Folded, False: 47.8k]
  |  |  ------------------
  ------------------
  919|  47.8k|                if (state->mode == TYPE)
  ------------------
  |  Branch (919:21): [True: 6.87k, False: 40.9k]
  ------------------
  920|  6.87k|                    state->back = -1;
  921|  47.8k|                break;
  922|  47.8k|            }
  923|  1.12M|            state->back = 0;
  924|  1.64M|            for (;;) {
  925|  1.64M|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  376|  1.64M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  926|  1.64M|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (926:21): [True: 995k, False: 653k]
  ------------------
  927|   653k|                PULLBYTE();
  ------------------
  |  |  359|   653k|    do { \
  |  |  360|   653k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 133k, False: 519k]
  |  |  ------------------
  |  |  361|   653k|        have--; \
  |  |  362|   519k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   519k|        bits += 8; \
  |  |  364|   519k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 519k]
  |  |  ------------------
  ------------------
  928|   653k|            }
  929|   995k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (929:17): [True: 485k, False: 510k]
  |  Branch (929:28): [True: 6.50k, False: 478k]
  ------------------
  930|  6.50k|                last = here;
  931|  7.50k|                for (;;) {
  932|  7.50k|                    here = state->lencode[last.val +
  933|  7.50k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  7.50k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  934|  7.50k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (934:25): [True: 6.31k, False: 1.19k]
  ------------------
  935|  1.19k|                    PULLBYTE();
  ------------------
  |  |  359|  1.19k|    do { \
  |  |  360|  1.19k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 196, False: 1.00k]
  |  |  ------------------
  |  |  361|  1.19k|        have--; \
  |  |  362|  1.00k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|  1.00k|        bits += 8; \
  |  |  364|  1.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 1.00k]
  |  |  ------------------
  ------------------
  936|  1.19k|                }
  937|  6.31k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  6.31k|    do { \
  |  |  381|  6.31k|        hold >>= (n); \
  |  |  382|  6.31k|        bits -= (unsigned)(n); \
  |  |  383|  6.31k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 6.31k]
  |  |  ------------------
  ------------------
  938|  6.31k|                state->back += last.bits;
  939|  6.31k|            }
  940|   995k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   995k|    do { \
  |  |  381|   995k|        hold >>= (n); \
  |  |  382|   995k|        bits -= (unsigned)(n); \
  |  |  383|   995k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 995k]
  |  |  ------------------
  ------------------
  941|   995k|            state->back += here.bits;
  942|   995k|            state->length = (unsigned)here.val;
  943|   995k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (943:17): [True: 514k, False: 480k]
  ------------------
  944|   514k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  945|   514k|                        "inflate:         literal '%c'\n" :
  946|   514k|                        "inflate:         literal 0x%02x\n", here.val));
  947|   514k|                state->mode = LIT;
  948|   514k|                break;
  949|   514k|            }
  950|   480k|            if (here.op & 32) {
  ------------------
  |  Branch (950:17): [True: 8.66k, False: 471k]
  ------------------
  951|  8.66k|                Tracevv((stderr, "inflate:         end of block\n"));
  952|  8.66k|                state->back = -1;
  953|  8.66k|                state->mode = TYPE;
  954|  8.66k|                break;
  955|  8.66k|            }
  956|   471k|            if (here.op & 64) {
  ------------------
  |  Branch (956:17): [True: 13, False: 471k]
  ------------------
  957|     13|                strm->msg = (z_const char *)"invalid literal/length code";
  958|     13|                state->mode = BAD;
  959|     13|                break;
  960|     13|            }
  961|   471k|            state->extra = (unsigned)(here.op) & 15;
  962|   471k|            state->mode = LENEXT;
  963|       |                /* fallthrough */
  964|   474k|        case LENEXT:
  ------------------
  |  Branch (964:9): [True: 2.44k, False: 1.91M]
  ------------------
  965|   474k|            if (state->extra) {
  ------------------
  |  Branch (965:17): [True: 135k, False: 338k]
  ------------------
  966|   135k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   135k|    do { \
  |  |  370|   146k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 13.8k, False: 132k]
  |  |  ------------------
  |  |  371|   135k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  13.8k|    do { \
  |  |  |  |  360|  13.8k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 2.65k, False: 11.1k]
  |  |  |  |  ------------------
  |  |  |  |  361|  13.8k|        have--; \
  |  |  |  |  362|  11.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  11.1k|        bits += 8; \
  |  |  |  |  364|  11.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 11.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   135k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 132k]
  |  |  ------------------
  ------------------
  967|   132k|                state->length += BITS(state->extra);
  ------------------
  |  |  376|   132k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  968|   132k|                DROPBITS(state->extra);
  ------------------
  |  |  380|   132k|    do { \
  |  |  381|   132k|        hold >>= (n); \
  |  |  382|   132k|        bits -= (unsigned)(n); \
  |  |  383|   132k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 132k]
  |  |  ------------------
  ------------------
  969|   132k|                state->back += state->extra;
  970|   132k|            }
  971|   471k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  972|   471k|            state->was = state->length;
  973|   471k|            state->mode = DIST;
  974|       |                /* fallthrough */
  975|   483k|        case DIST:
  ------------------
  |  Branch (975:9): [True: 11.3k, False: 1.90M]
  ------------------
  976|   619k|            for (;;) {
  977|   619k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  376|   619k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  978|   619k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (978:21): [True: 470k, False: 148k]
  ------------------
  979|   148k|                PULLBYTE();
  ------------------
  |  |  359|   148k|    do { \
  |  |  360|   148k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 12.1k, False: 136k]
  |  |  ------------------
  |  |  361|   148k|        have--; \
  |  |  362|   136k|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|   136k|        bits += 8; \
  |  |  364|   136k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 136k]
  |  |  ------------------
  ------------------
  980|   148k|            }
  981|   470k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (981:17): [True: 1.56k, False: 469k]
  ------------------
  982|  1.56k|                last = here;
  983|  1.99k|                for (;;) {
  984|  1.99k|                    here = state->distcode[last.val +
  985|  1.99k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  376|  1.99k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  986|  1.99k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (986:25): [True: 1.42k, False: 566]
  ------------------
  987|    566|                    PULLBYTE();
  ------------------
  |  |  359|    566|    do { \
  |  |  360|    566|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (360:13): [True: 139, False: 427]
  |  |  ------------------
  |  |  361|    566|        have--; \
  |  |  362|    427|        hold += (unsigned long)(*next++) << bits; \
  |  |  363|    427|        bits += 8; \
  |  |  364|    427|    } while (0)
  |  |  ------------------
  |  |  |  Branch (364:14): [Folded, False: 427]
  |  |  ------------------
  ------------------
  988|    566|                }
  989|  1.42k|                DROPBITS(last.bits);
  ------------------
  |  |  380|  1.42k|    do { \
  |  |  381|  1.42k|        hold >>= (n); \
  |  |  382|  1.42k|        bits -= (unsigned)(n); \
  |  |  383|  1.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 1.42k]
  |  |  ------------------
  ------------------
  990|  1.42k|                state->back += last.bits;
  991|  1.42k|            }
  992|   470k|            DROPBITS(here.bits);
  ------------------
  |  |  380|   470k|    do { \
  |  |  381|   470k|        hold >>= (n); \
  |  |  382|   470k|        bits -= (unsigned)(n); \
  |  |  383|   470k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 470k]
  |  |  ------------------
  ------------------
  993|   470k|            state->back += here.bits;
  994|   470k|            if (here.op & 64) {
  ------------------
  |  Branch (994:17): [True: 28, False: 470k]
  ------------------
  995|     28|                strm->msg = (z_const char *)"invalid distance code";
  996|     28|                state->mode = BAD;
  997|     28|                break;
  998|     28|            }
  999|   470k|            state->offset = (unsigned)here.val;
 1000|   470k|            state->extra = (unsigned)(here.op) & 15;
 1001|   470k|            state->mode = DISTEXT;
 1002|       |                /* fallthrough */
 1003|   481k|        case DISTEXT:
  ------------------
  |  Branch (1003:9): [True: 10.6k, False: 1.90M]
  ------------------
 1004|   481k|            if (state->extra) {
  ------------------
  |  Branch (1004:17): [True: 105k, False: 376k]
  ------------------
 1005|   105k|                NEEDBITS(state->extra);
  ------------------
  |  |  369|   105k|    do { \
  |  |  370|   154k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 61.5k, False: 92.7k]
  |  |  ------------------
  |  |  371|   105k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  61.5k|    do { \
  |  |  |  |  360|  61.5k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 12.2k, False: 49.3k]
  |  |  |  |  ------------------
  |  |  |  |  361|  61.5k|        have--; \
  |  |  |  |  362|  49.3k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  49.3k|        bits += 8; \
  |  |  |  |  364|  49.3k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 49.3k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|   105k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 92.7k]
  |  |  ------------------
  ------------------
 1006|  92.7k|                state->offset += BITS(state->extra);
  ------------------
  |  |  376|  92.7k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1007|  92.7k|                DROPBITS(state->extra);
  ------------------
  |  |  380|  92.7k|    do { \
  |  |  381|  92.7k|        hold >>= (n); \
  |  |  382|  92.7k|        bits -= (unsigned)(n); \
  |  |  383|  92.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (383:14): [Folded, False: 92.7k]
  |  |  ------------------
  ------------------
 1008|  92.7k|                state->back += state->extra;
 1009|  92.7k|            }
 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|   469k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1018|   469k|            state->mode = MATCH;
 1019|       |                /* fallthrough */
 1020|   562k|        case MATCH:
  ------------------
  |  Branch (1020:9): [True: 93.1k, False: 1.82M]
  ------------------
 1021|   562k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1021:17): [True: 2.41k, False: 559k]
  ------------------
 1022|   559k|            copy = out - left;
 1023|   559k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1023:17): [True: 121k, False: 438k]
  ------------------
 1024|   121k|                copy = state->offset - copy;
 1025|   121k|                if (copy > state->whave) {
  ------------------
  |  Branch (1025:21): [True: 59, False: 121k]
  ------------------
 1026|     59|                    if (state->sane) {
  ------------------
  |  Branch (1026:25): [True: 59, False: 0]
  ------------------
 1027|     59|                        strm->msg = (z_const char *)
 1028|     59|                            "invalid distance too far back";
 1029|     59|                        state->mode = BAD;
 1030|     59|                        break;
 1031|     59|                    }
 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|     59|                }
 1046|   121k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1046:21): [True: 3.06k, False: 118k]
  ------------------
 1047|  3.06k|                    copy -= state->wnext;
 1048|  3.06k|                    from = state->window + (state->wsize - copy);
 1049|  3.06k|                }
 1050|   118k|                else
 1051|   118k|                    from = state->window + (state->wnext - copy);
 1052|   121k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1052:21): [True: 32.3k, False: 88.7k]
  ------------------
 1053|   121k|            }
 1054|   438k|            else {                              /* copy from output */
 1055|   438k|                from = put - state->offset;
 1056|   438k|                copy = state->length;
 1057|   438k|            }
 1058|   559k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1058:17): [True: 2.41k, False: 557k]
  ------------------
 1059|   559k|            left -= copy;
 1060|   559k|            state->length -= copy;
 1061|  72.7M|            do {
 1062|  72.7M|                *put++ = *from++;
 1063|  72.7M|            } while (--copy);
  ------------------
  |  Branch (1063:22): [True: 72.1M, False: 559k]
  ------------------
 1064|   559k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1064:17): [True: 469k, False: 90.7k]
  ------------------
 1065|   559k|            break;
 1066|   515k|        case LIT:
  ------------------
  |  Branch (1066:9): [True: 515k, False: 1.40M]
  ------------------
 1067|   515k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1067:17): [True: 288, False: 514k]
  ------------------
 1068|   514k|            *put++ = (unsigned char)(state->length);
 1069|   514k|            left--;
 1070|   514k|            state->mode = LEN;
 1071|   514k|            break;
 1072|  7.42k|        case CHECK:
  ------------------
  |  Branch (1072:9): [True: 7.42k, False: 1.90M]
  ------------------
 1073|  7.42k|            if (state->wrap) {
  ------------------
  |  Branch (1073:17): [True: 7.42k, False: 0]
  ------------------
 1074|  7.42k|                NEEDBITS(32);
  ------------------
  |  |  369|  7.42k|    do { \
  |  |  370|  27.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (370:16): [True: 22.7k, False: 4.75k]
  |  |  ------------------
  |  |  371|  22.7k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  359|  22.7k|    do { \
  |  |  |  |  360|  22.7k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (360:13): [True: 2.66k, False: 20.1k]
  |  |  |  |  ------------------
  |  |  |  |  361|  22.7k|        have--; \
  |  |  |  |  362|  20.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  363|  20.1k|        bits += 8; \
  |  |  |  |  364|  20.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (364:14): [Folded, False: 20.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  372|  7.42k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 4.75k]
  |  |  ------------------
  ------------------
 1075|  4.75k|                out -= left;
 1076|  4.75k|                strm->total_out += out;
 1077|  4.75k|                state->total += out;
 1078|  4.75k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1078:21): [True: 4.75k, False: 0]
  |  Branch (1078:42): [True: 2.89k, False: 1.86k]
  ------------------
 1079|  2.89k|                    strm->adler = state->check =
 1080|  2.89k|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  303|  2.89k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (303:6): [True: 0, False: 2.89k]
  |  |  ------------------
  ------------------
 1081|  4.75k|                out = left;
 1082|  4.75k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1082:21): [True: 4.75k, False: 0]
  |  Branch (1082:42): [True: 1.74k, False: 3.01k]
  ------------------
 1083|  4.75k|#ifdef GUNZIP
 1084|  4.75k|                     state->flags ? hold :
  ------------------
  |  Branch (1084:22): [True: 0, False: 4.75k]
  ------------------
 1085|  4.75k|#endif
 1086|  4.75k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|  4.75k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|  4.75k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1087|  1.74k|                    strm->msg = (z_const char *)"incorrect data check";
 1088|  1.74k|                    state->mode = BAD;
 1089|  1.74k|                    break;
 1090|  1.74k|                }
 1091|  3.01k|                INITBITS();
  ------------------
  |  |  351|  3.01k|    do { \
  |  |  352|  3.01k|        hold = 0; \
  |  |  353|  3.01k|        bits = 0; \
  |  |  354|  3.01k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (354:14): [Folded, False: 3.01k]
  |  |  ------------------
  ------------------
 1092|  3.01k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1093|  3.01k|            }
 1094|  3.01k|#ifdef GUNZIP
 1095|  3.01k|            state->mode = LENGTH;
 1096|       |                /* fallthrough */
 1097|  3.01k|        case LENGTH:
  ------------------
  |  Branch (1097:9): [True: 0, False: 1.91M]
  ------------------
 1098|  3.01k|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1098:17): [True: 3.01k, False: 0]
  |  Branch (1098:32): [True: 0, False: 3.01k]
  ------------------
 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|  3.01k|#endif
 1109|  3.01k|            state->mode = DONE;
 1110|       |                /* fallthrough */
 1111|  6.14k|        case DONE:
  ------------------
  |  Branch (1111:9): [True: 3.13k, False: 1.91M]
  ------------------
 1112|  6.14k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  6.14k|#define Z_STREAM_END    1
  ------------------
 1113|  6.14k|            goto inf_leave;
 1114|  7.11k|        case BAD:
  ------------------
  |  Branch (1114:9): [True: 7.11k, False: 1.90M]
  ------------------
 1115|  7.11k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  7.11k|#define Z_DATA_ERROR   (-3)
  ------------------
 1116|  7.11k|            goto inf_leave;
 1117|      0|        case MEM:
  ------------------
  |  Branch (1117:9): [True: 0, False: 1.91M]
  ------------------
 1118|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1119|      0|        case SYNC:
  ------------------
  |  Branch (1119:9): [True: 0, False: 1.91M]
  ------------------
 1120|       |                /* fallthrough */
 1121|      0|        default:
  ------------------
  |  Branch (1121:9): [True: 0, False: 1.91M]
  ------------------
 1122|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1123|  1.91M|        }
 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|   214k|  inf_leave:
 1132|   214k|    RESTORE();
  ------------------
  |  |  340|   214k|    do { \
  |  |  341|   214k|        strm->next_out = put; \
  |  |  342|   214k|        strm->avail_out = left; \
  |  |  343|   214k|        strm->next_in = next; \
  |  |  344|   214k|        strm->avail_in = have; \
  |  |  345|   214k|        state->hold = hold; \
  |  |  346|   214k|        state->bits = bits; \
  |  |  347|   214k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (347:14): [Folded, False: 214k]
  |  |  ------------------
  ------------------
 1133|   214k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1133:9): [True: 160k, False: 54.3k]
  |  Branch (1133:26): [True: 12.4k, False: 41.9k]
  |  Branch (1133:52): [True: 11.8k, False: 551]
  ------------------
 1134|  11.8k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|    396|#define Z_FINISH        4
  ------------------
  |  Branch (1134:14): [True: 11.4k, False: 396]
  |  Branch (1134:37): [True: 396, False: 0]
  ------------------
 1135|   172k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1135:13): [True: 0, False: 172k]
  ------------------
 1136|      0|            state->mode = MEM;
 1137|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1138|      0|        }
 1139|   214k|    in -= strm->avail_in;
 1140|   214k|    out -= strm->avail_out;
 1141|   214k|    strm->total_in += in;
 1142|   214k|    strm->total_out += out;
 1143|   214k|    state->total += out;
 1144|   214k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1144:9): [True: 214k, False: 0]
  |  Branch (1144:30): [True: 156k, False: 58.5k]
  ------------------
 1145|   156k|        strm->adler = state->check =
 1146|   156k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  303|   156k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (303:6): [True: 0, False: 156k]
  |  |  ------------------
  ------------------
 1147|   214k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1147:43): [True: 41.3k, False: 173k]
  ------------------
 1148|   214k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1148:24): [True: 943, False: 213k]
  ------------------
 1149|   214k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1149:24): [True: 0, False: 214k]
  |  Branch (1149:47): [True: 0, False: 214k]
  ------------------
 1150|   214k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   194k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  20.5k|#define Z_OK            0
  ------------------
  |  Branch (1150:11): [True: 20.5k, False: 194k]
  |  Branch (1150:22): [True: 20.5k, False: 24]
  |  Branch (1150:35): [True: 0, False: 194k]
  |  Branch (1150:57): [True: 13.3k, False: 7.17k]
  ------------------
 1151|  13.3k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  13.3k|#define Z_BUF_ERROR    (-5)
  ------------------
 1152|   214k|    return ret;
 1153|   214k|}
inflateEnd:
 1155|  19.6k|int ZEXPORT inflateEnd(z_streamp strm) {
 1156|  19.6k|    struct inflate_state FAR *state;
 1157|  19.6k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1157:9): [True: 0, False: 19.6k]
  ------------------
 1158|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1159|  19.6k|    state = (struct inflate_state FAR *)strm->state;
 1160|  19.6k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|  19.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|  11.8k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1160:9): [True: 11.8k, False: 7.79k]
  ------------------
 1161|  19.6k|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|  19.6k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1162|  19.6k|    strm->state = Z_NULL;
  ------------------
  |  |  216|  19.6k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1163|  19.6k|    Tracev((stderr, "inflate: end\n"));
 1164|  19.6k|    return Z_OK;
  ------------------
  |  |  181|  19.6k|#define Z_OK            0
  ------------------
 1165|  19.6k|}
inflate.c:inflateStateCheck:
   88|   293k|local int inflateStateCheck(z_streamp strm) {
   89|   293k|    struct inflate_state FAR *state;
   90|   293k|    if (strm == Z_NULL ||
  ------------------
  |  |  216|   586k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 293k]
  ------------------
   91|   293k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 0, False: 293k]
  |  Branch (91:42): [True: 0, False: 293k]
  ------------------
   92|      0|        return 1;
   93|   293k|    state = (struct inflate_state FAR *)strm->state;
   94|   293k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|   586k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 293k]
  |  Branch (94:28): [True: 0, False: 293k]
  ------------------
   95|   293k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 293k]
  |  Branch (95:31): [True: 0, False: 293k]
  ------------------
   96|      0|        return 1;
   97|   293k|    return 0;
   98|   293k|}
inflate.c:updatewindow:
  252|   172k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  253|   172k|    struct inflate_state FAR *state;
  254|   172k|    unsigned dist;
  255|       |
  256|   172k|    state = (struct inflate_state FAR *)strm->state;
  257|       |
  258|       |    /* if it hasn't been done already, allocate space for the window */
  259|   172k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   172k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (259:9): [True: 11.8k, False: 160k]
  ------------------
  260|  11.8k|        state->window = (unsigned char FAR *)
  261|  11.8k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|  11.8k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  262|  11.8k|                               sizeof(unsigned char));
  263|  11.8k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  11.8k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (263:13): [True: 0, False: 11.8k]
  ------------------
  264|  11.8k|    }
  265|       |
  266|       |    /* if window not in use yet, initialize */
  267|   172k|    if (state->wsize == 0) {
  ------------------
  |  Branch (267:9): [True: 11.8k, False: 160k]
  ------------------
  268|  11.8k|        state->wsize = 1U << state->wbits;
  269|  11.8k|        state->wnext = 0;
  270|  11.8k|        state->whave = 0;
  271|  11.8k|    }
  272|       |
  273|       |    /* copy state->wsize or less output bytes into the circular window */
  274|   172k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (274:9): [True: 5.88k, False: 166k]
  ------------------
  275|  5.88k|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|  5.88k|#    define zmemcpy memcpy
  ------------------
  276|  5.88k|        state->wnext = 0;
  277|  5.88k|        state->whave = state->wsize;
  278|  5.88k|    }
  279|   166k|    else {
  280|   166k|        dist = state->wsize - state->wnext;
  281|   166k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (281:13): [True: 164k, False: 1.37k]
  ------------------
  282|   166k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|   166k|#    define zmemcpy memcpy
  ------------------
  283|   166k|        copy -= dist;
  284|   166k|        if (copy) {
  ------------------
  |  Branch (284:13): [True: 1.36k, False: 164k]
  ------------------
  285|  1.36k|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|  1.36k|#    define zmemcpy memcpy
  ------------------
  286|  1.36k|            state->wnext = copy;
  287|  1.36k|            state->whave = state->wsize;
  288|  1.36k|        }
  289|   164k|        else {
  290|   164k|            state->wnext += dist;
  291|   164k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (291:17): [True: 6, False: 164k]
  ------------------
  292|   164k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (292:17): [True: 90.9k, False: 74.0k]
  ------------------
  293|   164k|        }
  294|   166k|    }
  295|   172k|    return 0;
  296|   172k|}

inflate_table:
   48|  40.1k|                                unsigned FAR *bits, unsigned short FAR *work) {
   49|  40.1k|    unsigned len;               /* a code's length in bits */
   50|  40.1k|    unsigned sym;               /* index of code symbols */
   51|  40.1k|    unsigned min, max;          /* minimum and maximum code lengths */
   52|  40.1k|    unsigned root;              /* number of index bits for root table */
   53|  40.1k|    unsigned curr;              /* number of index bits for current table */
   54|  40.1k|    unsigned drop;              /* code bits to drop for sub-table */
   55|  40.1k|    int left;                   /* number of prefix codes available */
   56|  40.1k|    unsigned used;              /* code entries in table used */
   57|  40.1k|    unsigned huff;              /* Huffman code */
   58|  40.1k|    unsigned incr;              /* for incrementing code, index */
   59|  40.1k|    unsigned fill;              /* index for replicating entries */
   60|  40.1k|    unsigned low;               /* low bits for current root entry */
   61|  40.1k|    unsigned mask;              /* mask for low root bits */
   62|  40.1k|    code here;                  /* table entry for duplication */
   63|  40.1k|    code FAR *next;             /* next available space in table */
   64|  40.1k|    const unsigned short FAR *base = NULL;  /* base value table to use */
   65|  40.1k|    const unsigned short FAR *extra = NULL; /* extra bits table to use */
   66|  40.1k|    unsigned match = 0;         /* use base and extra for symbol >= match */
   67|  40.1k|    unsigned short count[MAXBITS+1];    /* number of codes of each length */
   68|  40.1k|    unsigned short offs[MAXBITS+1];     /* offsets in table for each length */
   69|  40.1k|    static const unsigned short lbase[31] = { /* Length codes 257..285 base */
   70|  40.1k|        3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
   71|  40.1k|        35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
   72|  40.1k|    static const unsigned short lext[31] = { /* Length codes 257..285 extra */
   73|  40.1k|        16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
   74|  40.1k|        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 68, 193};
   75|  40.1k|    static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
   76|  40.1k|        1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
   77|  40.1k|        257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
   78|  40.1k|        8193, 12289, 16385, 24577, 0, 0};
   79|  40.1k|    static const unsigned short dext[32] = { /* Distance codes 0..29 extra */
   80|  40.1k|        16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
   81|  40.1k|        23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
   82|  40.1k|        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|   682k|    for (len = 0; len <= MAXBITS; len++)
  ------------------
  |  |   23|   682k|#define MAXBITS 15
  ------------------
  |  Branch (116:19): [True: 642k, False: 40.1k]
  ------------------
  117|   642k|        count[len] = 0;
  118|  4.19M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (118:19): [True: 4.15M, False: 40.1k]
  ------------------
  119|  4.15M|        count[lens[sym]]++;
  120|       |
  121|       |    /* bound code lengths, force root to be within code lengths */
  122|  40.1k|    root = *bits;
  123|   372k|    for (max = MAXBITS; max >= 1; max--)
  ------------------
  |  |   23|  40.1k|#define MAXBITS 15
  ------------------
  |  Branch (123:25): [True: 372k, False: 125]
  ------------------
  124|   372k|        if (count[max] != 0) break;
  ------------------
  |  Branch (124:13): [True: 40.0k, False: 332k]
  ------------------
  125|  40.1k|    if (root > max) root = max;
  ------------------
  |  Branch (125:9): [True: 23.3k, False: 16.8k]
  ------------------
  126|  40.1k|    if (max == 0) {                     /* no symbols to code at all */
  ------------------
  |  Branch (126:9): [True: 125, False: 40.0k]
  ------------------
  127|    125|        here.op = (unsigned char)64;    /* invalid code marker */
  128|    125|        here.bits = (unsigned char)1;
  129|    125|        here.val = (unsigned short)0;
  130|    125|        *(*table)++ = here;             /* make a table to force an error */
  131|    125|        *(*table)++ = here;
  132|    125|        *bits = 1;
  133|    125|        return 0;     /* no symbols, but wait for decoding to report error */
  134|    125|    }
  135|  80.8k|    for (min = 1; min < max; min++)
  ------------------
  |  Branch (135:19): [True: 80.6k, False: 197]
  ------------------
  136|  80.6k|        if (count[min] != 0) break;
  ------------------
  |  Branch (136:13): [True: 39.8k, False: 40.7k]
  ------------------
  137|  40.0k|    if (root < min) root = min;
  ------------------
  |  Branch (137:9): [True: 13, False: 40.0k]
  ------------------
  138|       |
  139|       |    /* check for an over-subscribed or incomplete set of lengths */
  140|  40.0k|    left = 1;
  141|   639k|    for (len = 1; len <= MAXBITS; len++) {
  ------------------
  |  |   23|   639k|#define MAXBITS 15
  ------------------
  |  Branch (141:19): [True: 599k, False: 39.8k]
  ------------------
  142|   599k|        left <<= 1;
  143|   599k|        left -= count[len];
  144|   599k|        if (left < 0) return -1;        /* over-subscribed */
  ------------------
  |  Branch (144:13): [True: 134, False: 599k]
  ------------------
  145|   599k|    }
  146|  39.8k|    if (left > 0 && (type == CODES || max != 1))
  ------------------
  |  Branch (146:9): [True: 113, False: 39.7k]
  |  Branch (146:22): [True: 50, False: 63]
  |  Branch (146:39): [True: 53, False: 10]
  ------------------
  147|    103|        return -1;                      /* incomplete set */
  148|       |
  149|       |    /* generate offsets into symbol table for each length for sorting */
  150|  39.7k|    offs[1] = 0;
  151|   596k|    for (len = 1; len < MAXBITS; len++)
  ------------------
  |  |   23|   596k|#define MAXBITS 15
  ------------------
  |  Branch (151:19): [True: 557k, False: 39.7k]
  ------------------
  152|   557k|        offs[len + 1] = offs[len] + count[len];
  153|       |
  154|       |    /* sort symbols by length, by symbol order within each length */
  155|  4.16M|    for (sym = 0; sym < codes; sym++)
  ------------------
  |  Branch (155:19): [True: 4.12M, False: 39.7k]
  ------------------
  156|  4.12M|        if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym;
  ------------------
  |  Branch (156:13): [True: 1.03M, False: 3.08M]
  ------------------
  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|  39.7k|    switch (type) {
  ------------------
  |  Branch (190:13): [True: 39.7k, False: 0]
  ------------------
  191|  14.6k|    case CODES:
  ------------------
  |  Branch (191:5): [True: 14.6k, False: 25.1k]
  ------------------
  192|  14.6k|        match = 20;
  193|  14.6k|        break;
  194|  12.5k|    case LENS:
  ------------------
  |  Branch (194:5): [True: 12.5k, False: 27.2k]
  ------------------
  195|  12.5k|        base = lbase;
  196|  12.5k|        extra = lext;
  197|  12.5k|        match = 257;
  198|  12.5k|        break;
  199|  12.5k|    case DISTS:
  ------------------
  |  Branch (199:5): [True: 12.5k, False: 27.2k]
  ------------------
  200|  12.5k|        base = dbase;
  201|  12.5k|        extra = dext;
  202|  39.7k|    }
  203|       |
  204|       |    /* initialize state for loop */
  205|  39.7k|    huff = 0;                   /* starting code */
  206|  39.7k|    sym = 0;                    /* starting code symbol */
  207|  39.7k|    len = min;                  /* starting code length */
  208|  39.7k|    next = *table;              /* current table to fill in */
  209|  39.7k|    curr = root;                /* current table index bits */
  210|  39.7k|    drop = 0;                   /* current bits to drop from code for index */
  211|  39.7k|    low = (unsigned)(-1);       /* trigger new sub-table when len > root */
  212|  39.7k|    used = 1U << root;          /* use root table entries */
  213|  39.7k|    mask = used - 1;            /* mask for comparing low */
  214|       |
  215|       |    /* check available table space */
  216|  39.7k|    if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  12.5k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (216:10): [True: 12.5k, False: 27.2k]
  |  Branch (216:26): [True: 0, False: 12.5k]
  ------------------
  217|  39.7k|        (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  12.5k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (217:10): [True: 12.5k, False: 27.2k]
  |  Branch (217:27): [True: 0, False: 12.5k]
  ------------------
  218|      0|        return 1;
  219|       |
  220|       |    /* process all codes and make table entries */
  221|  1.03M|    for (;;) {
  222|       |        /* create table entry */
  223|  1.03M|        here.bits = (unsigned char)(len - drop);
  224|  1.03M|        if (work[sym] + 1U < match) {
  ------------------
  |  Branch (224:13): [True: 651k, False: 387k]
  ------------------
  225|   651k|            here.op = (unsigned char)0;
  226|   651k|            here.val = work[sym];
  227|   651k|        }
  228|   387k|        else if (work[sym] >= match) {
  ------------------
  |  Branch (228:18): [True: 374k, False: 12.5k]
  ------------------
  229|   374k|            here.op = (unsigned char)(extra[work[sym] - match]);
  230|   374k|            here.val = base[work[sym] - match];
  231|   374k|        }
  232|  12.5k|        else {
  233|  12.5k|            here.op = (unsigned char)(32 + 64);         /* end of block */
  234|  12.5k|            here.val = 0;
  235|  12.5k|        }
  236|       |
  237|       |        /* replicate for those indices with low len bits equal to huff */
  238|  1.03M|        incr = 1U << (len - drop);
  239|  1.03M|        fill = 1U << curr;
  240|  1.03M|        min = fill;                 /* save offset to next table */
  241|  5.54M|        do {
  242|  5.54M|            fill -= incr;
  243|  5.54M|            next[(huff >> drop) + fill] = here;
  244|  5.54M|        } while (fill != 0);
  ------------------
  |  Branch (244:18): [True: 4.51M, False: 1.03M]
  ------------------
  245|       |
  246|       |        /* backwards increment the len-bit code huff */
  247|  1.03M|        incr = 1U << (len - 1);
  248|  2.03M|        while (huff & incr)
  ------------------
  |  Branch (248:16): [True: 998k, False: 1.03M]
  ------------------
  249|   998k|            incr >>= 1;
  250|  1.03M|        if (incr != 0) {
  ------------------
  |  Branch (250:13): [True: 998k, False: 39.7k]
  ------------------
  251|   998k|            huff &= incr - 1;
  252|   998k|            huff += incr;
  253|   998k|        }
  254|  39.7k|        else
  255|  39.7k|            huff = 0;
  256|       |
  257|       |        /* go to next symbol, update count, len */
  258|  1.03M|        sym++;
  259|  1.03M|        if (--(count[len]) == 0) {
  ------------------
  |  Branch (259:13): [True: 208k, False: 830k]
  ------------------
  260|   208k|            if (len == max) break;
  ------------------
  |  Branch (260:17): [True: 39.7k, False: 168k]
  ------------------
  261|   168k|            len = lens[work[sym]];
  262|   168k|        }
  263|       |
  264|       |        /* create new sub-table if needed */
  265|   998k|        if (len > root && (huff & mask) != low) {
  ------------------
  |  Branch (265:13): [True: 225k, False: 772k]
  |  Branch (265:27): [True: 68.4k, False: 157k]
  ------------------
  266|       |            /* if first time, transition to sub-tables */
  267|  68.4k|            if (drop == 0)
  ------------------
  |  Branch (267:17): [True: 12.2k, False: 56.1k]
  ------------------
  268|  12.2k|                drop = root;
  269|       |
  270|       |            /* increment past last table */
  271|  68.4k|            next += min;            /* here min is 1 << curr */
  272|       |
  273|       |            /* determine length of next table */
  274|  68.4k|            curr = len - drop;
  275|  68.4k|            left = (int)(1 << curr);
  276|  89.9k|            while (curr + drop < max) {
  ------------------
  |  Branch (276:20): [True: 67.5k, False: 22.3k]
  ------------------
  277|  67.5k|                left -= count[curr + drop];
  278|  67.5k|                if (left <= 0) break;
  ------------------
  |  Branch (278:21): [True: 46.0k, False: 21.5k]
  ------------------
  279|  21.5k|                curr++;
  280|  21.5k|                left <<= 1;
  281|  21.5k|            }
  282|       |
  283|       |            /* check for enough space */
  284|  68.4k|            used += 1U << curr;
  285|  68.4k|            if ((type == LENS && used > ENOUGH_LENS) ||
  ------------------
  |  |   50|  48.8k|#  define ENOUGH_LENS 852
  ------------------
  |  Branch (285:18): [True: 48.8k, False: 19.6k]
  |  Branch (285:34): [True: 0, False: 48.8k]
  ------------------
  286|  68.4k|                (type == DISTS && used > ENOUGH_DISTS))
  ------------------
  |  |   51|  19.6k|#  define ENOUGH_DISTS 592
  ------------------
  |  Branch (286:18): [True: 19.6k, False: 48.8k]
  |  Branch (286:35): [True: 0, False: 19.6k]
  ------------------
  287|      0|                return 1;
  288|       |
  289|       |            /* point entry in root table to sub-table */
  290|  68.4k|            low = huff & mask;
  291|  68.4k|            (*table)[low].op = (unsigned char)curr;
  292|  68.4k|            (*table)[low].bits = (unsigned char)root;
  293|  68.4k|            (*table)[low].val = (unsigned short)(next - *table);
  294|  68.4k|        }
  295|   998k|    }
  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|  39.7k|    if (huff != 0) {
  ------------------
  |  Branch (300:9): [True: 10, False: 39.7k]
  ------------------
  301|     10|        here.op = (unsigned char)64;            /* invalid code marker */
  302|     10|        here.bits = (unsigned char)(len - drop);
  303|     10|        here.val = (unsigned short)0;
  304|     10|        next[huff] = here;
  305|     10|    }
  306|       |
  307|       |    /* set return parameters */
  308|  39.7k|    *table += used;
  309|  39.7k|    *bits = root;
  310|  39.7k|    return 0;
  311|  39.7k|}
inflate_fixed:
  364|  11.9k|void inflate_fixed(struct inflate_state FAR *state) {
  365|       |#ifdef BUILDFIXED
  366|       |    z_once(&built, buildtables);
  367|       |#endif /* BUILDFIXED */
  368|  11.9k|    state->lencode = lenfix;
  369|  11.9k|    state->lenbits = 9;
  370|  11.9k|    state->distcode = distfix;
  371|  11.9k|    state->distbits = 5;
  372|  11.9k|}

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

