jsimd_set_ycc_rgb:
  241|  1.41k|{
  242|  1.41k|  init_simd((j_common_ptr)cinfo);
  243|       |
  244|  1.41k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  1.41k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (244:7): [Folded, False: 1.41k]
  ------------------
  245|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  246|  1.41k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (246:7): [Folded, False: 1.41k]
  ------------------
  247|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  248|  1.41k|  if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
  ------------------
  |  |  302|  1.41k|#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 (248:7): [Folded, False: 1.41k]
  |  Branch (248:31): [True: 0, Folded]
  ------------------
  249|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  250|  1.41k|  if (!cinfo->cconvert)
  ------------------
  |  Branch (250:7): [True: 0, False: 1.41k]
  ------------------
  251|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  252|       |
  253|  1.41k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  254|  1.41k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  1.41k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (254:7): [True: 0, False: 1.41k]
  ------------------
  255|      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]
  |  |  ------------------
  ------------------
  256|      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|}
  ------------------
  257|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  258|      0|  }
  259|  1.41k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  1.41k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (259:7): [True: 0, False: 1.41k]
  ------------------
  260|      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]
  |  |  ------------------
  ------------------
  261|      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|}
  ------------------
  262|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  263|      0|  }
  264|       |#if SIMD_ARCHITECTURE == I386
  265|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  266|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(mmx);
  267|       |    return JSIMD_MMX;
  268|       |  }
  269|       |#endif
  270|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  271|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  272|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(neon);
  273|       |    return JSIMD_NEON;
  274|       |  }
  275|       |#elif SIMD_ARCHITECTURE == POWERPC
  276|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  277|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(altivec);
  278|       |    return JSIMD_ALTIVEC;
  279|       |  }
  280|       |#elif SIMD_ARCHITECTURE == RISCV64
  281|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  282|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(rvv);
  283|       |    return JSIMD_RVV;
  284|       |  }
  285|       |#elif SIMD_ARCHITECTURE == MIPS64
  286|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  287|       |    SET_SIMD_EXTRGB_COLOR_DECONVERTER(mmi);
  288|       |    return JSIMD_MMI;
  289|       |  }
  290|       |#endif
  291|       |
  292|  1.41k|  return JSIMD_NONE;
  ------------------
  |  |   38|  1.41k|#define JSIMD_NONE       0x00
  ------------------
  293|  1.41k|}
jsimd_set_h2v1_upsample:
  456|    225|{
  457|    225|  init_simd((j_common_ptr)cinfo);
  458|       |
  459|    225|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    225|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (459:7): [Folded, False: 225]
  ------------------
  460|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  461|    225|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (461:7): [Folded, False: 225]
  ------------------
  462|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  463|    225|  if (!cinfo->upsample)
  ------------------
  |  Branch (463:7): [True: 0, False: 225]
  ------------------
  464|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  465|       |
  466|    225|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  467|    225|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|    225|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (467:7): [True: 0, False: 225]
  ------------------
  468|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_avx2;
  469|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  470|      0|  }
  471|    225|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|    225|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (471:7): [True: 0, False: 225]
  ------------------
  472|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_sse2;
  473|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  474|      0|  }
  475|       |#if SIMD_ARCHITECTURE == I386
  476|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  477|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_mmx;
  478|       |    return JSIMD_MMX;
  479|       |  }
  480|       |#endif
  481|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  482|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  483|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_neon;
  484|       |    return JSIMD_NEON;
  485|       |  }
  486|       |#elif SIMD_ARCHITECTURE == POWERPC
  487|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  488|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_altivec;
  489|       |    return JSIMD_ALTIVEC;
  490|       |  }
  491|       |#elif SIMD_ARCHITECTURE == RISCV64
  492|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  493|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_upsample_rvv;
  494|       |    return JSIMD_RVV;
  495|       |  }
  496|       |#endif
  497|       |
  498|    225|  return JSIMD_NONE;
  ------------------
  |  |   38|    225|#define JSIMD_NONE       0x00
  ------------------
  499|    225|}
jsimd_set_h2v2_upsample:
  514|    160|{
  515|    160|  init_simd((j_common_ptr)cinfo);
  516|       |
  517|    160|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    160|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (517:7): [Folded, False: 160]
  ------------------
  518|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  519|    160|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (519:7): [Folded, False: 160]
  ------------------
  520|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  521|    160|  if (!cinfo->upsample)
  ------------------
  |  Branch (521:7): [True: 0, False: 160]
  ------------------
  522|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  523|       |
  524|    160|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  525|    160|  if (cinfo->master->simd_support & JSIMD_AVX2) {
  ------------------
  |  |   46|    160|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (525:7): [True: 0, False: 160]
  ------------------
  526|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_avx2;
  527|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  528|      0|  }
  529|    160|  if (cinfo->master->simd_support & JSIMD_SSE2) {
  ------------------
  |  |   42|    160|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (529:7): [True: 0, False: 160]
  ------------------
  530|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_sse2;
  531|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  532|      0|  }
  533|       |#if SIMD_ARCHITECTURE == I386
  534|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  535|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_mmx;
  536|       |    return JSIMD_MMX;
  537|       |  }
  538|       |#endif
  539|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  540|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  541|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_neon;
  542|       |    return JSIMD_NEON;
  543|       |  }
  544|       |#elif SIMD_ARCHITECTURE == POWERPC
  545|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  546|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_altivec;
  547|       |    return JSIMD_ALTIVEC;
  548|       |  }
  549|       |#elif SIMD_ARCHITECTURE == RISCV64
  550|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  551|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_upsample_rvv;
  552|       |    return JSIMD_RVV;
  553|       |  }
  554|       |#endif
  555|       |
  556|    160|  return JSIMD_NONE;
  ------------------
  |  |   38|    160|#define JSIMD_NONE       0x00
  ------------------
  557|    160|}
jsimd_set_h2v1_fancy_upsample:
  572|    346|{
  573|    346|  init_simd((j_common_ptr)cinfo);
  574|       |
  575|    346|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|    346|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (575:7): [Folded, False: 346]
  ------------------
  576|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  577|    346|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (577:7): [Folded, False: 346]
  ------------------
  578|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  579|    346|  if (!cinfo->upsample)
  ------------------
  |  Branch (579:7): [True: 0, False: 346]
  ------------------
  580|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  581|       |
  582|    346|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  583|    346|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|    346|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (583:7): [True: 0, False: 346]
  ------------------
  584|      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]
  |  |  ------------------
  ------------------
  585|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_avx2;
  586|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  587|      0|  }
  588|    346|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|    346|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (588:7): [True: 0, False: 346]
  ------------------
  589|      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]
  |  |  ------------------
  ------------------
  590|      0|    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_sse2;
  591|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  592|      0|  }
  593|       |#if SIMD_ARCHITECTURE == I386
  594|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  595|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_mmx;
  596|       |    return JSIMD_MMX;
  597|       |  }
  598|       |#endif
  599|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  600|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  601|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_neon;
  602|       |    return JSIMD_NEON;
  603|       |  }
  604|       |#elif SIMD_ARCHITECTURE == POWERPC
  605|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  606|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_altivec;
  607|       |    return JSIMD_ALTIVEC;
  608|       |  }
  609|       |#elif SIMD_ARCHITECTURE == RISCV64
  610|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  611|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_rvv;
  612|       |    return JSIMD_RVV;
  613|       |  }
  614|       |#elif SIMD_ARCHITECTURE == MIPS64
  615|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  616|       |    cinfo->upsample->h2v1_upsample_simd = jsimd_h2v1_fancy_upsample_mmi;
  617|       |    return JSIMD_MMI;
  618|       |  }
  619|       |#endif
  620|       |
  621|    346|  return JSIMD_NONE;
  ------------------
  |  |   38|    346|#define JSIMD_NONE       0x00
  ------------------
  622|    346|}
jsimd_set_h2v2_fancy_upsample:
  637|  2.50k|{
  638|  2.50k|  init_simd((j_common_ptr)cinfo);
  639|       |
  640|  2.50k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  2.50k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (640:7): [Folded, False: 2.50k]
  ------------------
  641|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  642|  2.50k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (642:7): [Folded, False: 2.50k]
  ------------------
  643|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  644|  2.50k|  if (!cinfo->upsample)
  ------------------
  |  Branch (644:7): [True: 0, False: 2.50k]
  ------------------
  645|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
  646|       |
  647|  2.50k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
  648|  2.50k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  2.50k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (648:7): [True: 0, False: 2.50k]
  ------------------
  649|      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]
  |  |  ------------------
  ------------------
  650|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_avx2;
  651|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
  652|      0|  }
  653|  2.50k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  2.50k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (653:7): [True: 0, False: 2.50k]
  ------------------
  654|      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]
  |  |  ------------------
  ------------------
  655|      0|    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_sse2;
  656|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
  657|      0|  }
  658|       |#if SIMD_ARCHITECTURE == I386
  659|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
  660|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_mmx;
  661|       |    return JSIMD_MMX;
  662|       |  }
  663|       |#endif
  664|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
  665|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
  666|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_neon;
  667|       |    return JSIMD_NEON;
  668|       |  }
  669|       |#elif SIMD_ARCHITECTURE == POWERPC
  670|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
  671|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_altivec;
  672|       |    return JSIMD_ALTIVEC;
  673|       |  }
  674|       |#elif SIMD_ARCHITECTURE == RISCV64
  675|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
  676|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_rvv;
  677|       |    return JSIMD_RVV;
  678|       |  }
  679|       |#elif SIMD_ARCHITECTURE == MIPS64
  680|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
  681|       |    cinfo->upsample->h2v2_upsample_simd = jsimd_h2v2_fancy_upsample_mmi;
  682|       |    return JSIMD_MMI;
  683|       |  }
  684|       |#endif
  685|       |
  686|  2.50k|  return JSIMD_NONE;
  ------------------
  |  |   38|  2.50k|#define JSIMD_NONE       0x00
  ------------------
  687|  2.50k|}
jsimd_set_idct_islow:
 1153|  4.37k|{
 1154|  4.37k|  init_simd((j_common_ptr)cinfo);
 1155|       |
 1156|  4.37k|  if (sizeof(JCOEF) != 2)
  ------------------
  |  Branch (1156:7): [Folded, False: 4.37k]
  ------------------
 1157|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1158|  4.37k|  if (BITS_IN_JSAMPLE != 8)
  ------------------
  |  |   34|  4.37k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (1158:7): [Folded, False: 4.37k]
  ------------------
 1159|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1160|  4.37k|  if (sizeof(JDIMENSION) != 4)
  ------------------
  |  Branch (1160:7): [Folded, False: 4.37k]
  ------------------
 1161|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1162|  4.37k|  if (sizeof(ISLOW_MULT_TYPE) != 2)
  ------------------
  |  Branch (1162:7): [Folded, False: 4.37k]
  ------------------
 1163|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1164|  4.37k|  if (!cinfo->idct)
  ------------------
  |  Branch (1164:7): [True: 0, False: 4.37k]
  ------------------
 1165|      0|    return JSIMD_NONE;
  ------------------
  |  |   38|      0|#define JSIMD_NONE       0x00
  ------------------
 1166|       |
 1167|  4.37k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
 1168|  4.37k|  if ((cinfo->master->simd_support & JSIMD_AVX2) &&
  ------------------
  |  |   46|  4.37k|#define JSIMD_AVX2       0x80
  ------------------
  |  Branch (1168:7): [True: 0, False: 4.37k]
  ------------------
 1169|      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]
  |  |  ------------------
  ------------------
 1170|      0|    cinfo->idct->idct_simd = jsimd_idct_islow_avx2;
 1171|      0|    return JSIMD_AVX2;
  ------------------
  |  |   46|      0|#define JSIMD_AVX2       0x80
  ------------------
 1172|      0|  }
 1173|  4.37k|  if ((cinfo->master->simd_support & JSIMD_SSE2) &&
  ------------------
  |  |   42|  4.37k|#define JSIMD_SSE2       0x08
  ------------------
  |  Branch (1173:7): [True: 0, False: 4.37k]
  ------------------
 1174|      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]
  |  |  ------------------
  ------------------
 1175|      0|    cinfo->idct->idct_simd = jsimd_idct_islow_sse2;
 1176|      0|    return JSIMD_SSE2;
  ------------------
  |  |   42|      0|#define JSIMD_SSE2       0x08
  ------------------
 1177|      0|  }
 1178|       |#if SIMD_ARCHITECTURE == I386
 1179|       |  if (cinfo->master->simd_support & JSIMD_MMX) {
 1180|       |    cinfo->idct->idct_simd = jsimd_idct_islow_mmx;
 1181|       |    return JSIMD_MMX;
 1182|       |  }
 1183|       |#endif
 1184|       |#elif SIMD_ARCHITECTURE == ARM64 || SIMD_ARCHITECTURE == ARM
 1185|       |  if (cinfo->master->simd_support & JSIMD_NEON) {
 1186|       |    cinfo->idct->idct_simd = jsimd_idct_islow_neon;
 1187|       |    return JSIMD_NEON;
 1188|       |  }
 1189|       |#elif SIMD_ARCHITECTURE == POWERPC
 1190|       |  if (cinfo->master->simd_support & JSIMD_ALTIVEC) {
 1191|       |    cinfo->idct->idct_simd = jsimd_idct_islow_altivec;
 1192|       |    return JSIMD_ALTIVEC;
 1193|       |  }
 1194|       |#elif SIMD_ARCHITECTURE == RISCV64
 1195|       |  if (cinfo->master->simd_support & JSIMD_RVV) {
 1196|       |    cinfo->idct->idct_simd = jsimd_idct_islow_rvv;
 1197|       |    return JSIMD_RVV;
 1198|       |  }
 1199|       |#elif SIMD_ARCHITECTURE == MIPS64
 1200|       |  if (cinfo->master->simd_support & JSIMD_MMI) {
 1201|       |    cinfo->idct->idct_simd = jsimd_idct_islow_mmi;
 1202|       |    return JSIMD_MMI;
 1203|       |  }
 1204|       |#endif
 1205|       |
 1206|  4.37k|  return JSIMD_NONE;
  ------------------
  |  |   38|  4.37k|#define JSIMD_NONE       0x00
  ------------------
 1207|  4.37k|}
jsimd.c:init_simd:
   56|  9.02k|{
   57|  9.02k|#ifndef NO_GETENV
   58|  9.02k|  char env[2] = { 0 };
   59|  9.02k|#endif
   60|  9.02k|  unsigned int simd_support = cinfo->is_decompressor ?
  ------------------
  |  Branch (60:31): [True: 9.02k, False: 0]
  ------------------
   61|  9.02k|                              ((j_decompress_ptr)cinfo)->master->simd_support :
   62|  9.02k|                              ((j_compress_ptr)cinfo)->master->simd_support;
   63|  9.02k|  unsigned int simd_huffman = cinfo->is_decompressor ?
  ------------------
  |  Branch (63:31): [True: 9.02k, False: 0]
  ------------------
   64|  9.02k|                              ((j_decompress_ptr)cinfo)->master->simd_huffman :
   65|  9.02k|                              ((j_compress_ptr)cinfo)->master->simd_huffman;
   66|       |
   67|  9.02k|  if (simd_support != JSIMD_UNDEFINED)
  ------------------
  |  |   49|  9.02k|#define JSIMD_UNDEFINED  ~(JSIMD_MAX * 2U - 1U)
  |  |  ------------------
  |  |  |  |   48|  9.02k|#define JSIMD_MAX        0x100
  |  |  ------------------
  ------------------
  |  Branch (67:7): [True: 6.10k, False: 2.91k]
  ------------------
   68|  6.10k|    return;
   69|       |
   70|  2.91k|  simd_support = jpeg_simd_cpu_support();
   71|       |
   72|  2.91k|#ifndef NO_GETENV
   73|       |  /* Force different settings through environment variables */
   74|  2.91k|#if SIMD_ARCHITECTURE == X86_64 || SIMD_ARCHITECTURE == I386
   75|  2.91k|  if (!GETENV_S(env, 2, "JSIMD_FORCESSE2") && !strcmp(env, "1"))
  ------------------
  |  Branch (75:7): [True: 2.91k, False: 0]
  |  Branch (75:47): [True: 0, False: 2.91k]
  ------------------
   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|  2.91k|  if (!GETENV_S(env, 2, "JSIMD_FORCENONE") && !strcmp(env, "1"))
  ------------------
  |  Branch (95:7): [True: 2.91k, False: 0]
  |  Branch (95:47): [True: 2.91k, False: 0]
  ------------------
   96|  2.91k|    simd_support = 0;
   97|       |#ifdef WITH_SIMDE
   98|       |  if (!GETENV_S(env, 2, "JSIMD_HUFFENC") && !strcmp(env, "1"))
   99|       |    simd_huffman = 1;
  100|       |#else
  101|  2.91k|  if (!GETENV_S(env, 2, "JSIMD_NOHUFFENC") && !strcmp(env, "1"))
  ------------------
  |  Branch (101:7): [True: 2.91k, False: 0]
  |  Branch (101:47): [True: 0, False: 2.91k]
  ------------------
  102|      0|    simd_huffman = 0;
  103|  2.91k|#endif
  104|  2.91k|#endif
  105|       |
  106|  2.91k|  if (cinfo->is_decompressor) {
  ------------------
  |  Branch (106:7): [True: 2.91k, False: 0]
  ------------------
  107|  2.91k|    ((j_decompress_ptr)cinfo)->master->simd_support = simd_support;
  108|  2.91k|    ((j_decompress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  109|  2.91k|  } else {
  110|      0|    ((j_compress_ptr)cinfo)->master->simd_support = simd_support;
  111|      0|    ((j_compress_ptr)cinfo)->master->simd_huffman = simd_huffman;
  112|      0|  }
  113|  2.91k|}

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

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

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

jinit_arith_decoder:
  751|  1.33k|{
  752|  1.33k|  arith_entropy_ptr entropy;
  753|  1.33k|  int i;
  754|       |
  755|  1.33k|  entropy = (arith_entropy_ptr)
  756|  1.33k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.33k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  757|  1.33k|                                sizeof(arith_entropy_decoder));
  758|  1.33k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  759|  1.33k|  entropy->pub.start_pass = start_pass;
  760|       |
  761|       |  /* Mark tables unallocated */
  762|  22.7k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|  22.7k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (762:15): [True: 21.4k, False: 1.33k]
  ------------------
  763|  21.4k|    entropy->dc_stats[i] = NULL;
  764|  21.4k|    entropy->ac_stats[i] = NULL;
  765|  21.4k|  }
  766|       |
  767|       |  /* Initialize index for fixed probability estimation */
  768|  1.33k|  entropy->fixed_bin[0] = 113;
  769|       |
  770|  1.33k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (770:7): [True: 999, False: 339]
  ------------------
  771|       |    /* Create progression status table */
  772|    999|    int *coef_bit_ptr, ci;
  773|    999|    cinfo->coef_bits = (int (*)[DCTSIZE2])
  774|    999|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    999|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  775|    999|                                  cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|    999|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  776|    999|                                  sizeof(int));
  777|    999|    coef_bit_ptr = &cinfo->coef_bits[0][0];
  778|  3.21k|    for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (778:18): [True: 2.21k, False: 999]
  ------------------
  779|   143k|      for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|   143k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (779:19): [True: 141k, False: 2.21k]
  ------------------
  780|   141k|        *coef_bit_ptr++ = -1;
  781|    999|  }
  782|  1.33k|}
jdarith.c:start_pass:
  633|  2.52k|{
  634|  2.52k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  635|  2.52k|  int ci, tbl;
  636|  2.52k|  jpeg_component_info *compptr;
  637|       |
  638|  2.52k|  if (cinfo->progressive_mode) {
  ------------------
  |  Branch (638:7): [True: 2.20k, False: 323]
  ------------------
  639|       |    /* Validate progressive scan parameters */
  640|  2.20k|    if (cinfo->Ss == 0) {
  ------------------
  |  Branch (640:9): [True: 1.48k, False: 721]
  ------------------
  641|  1.48k|      if (cinfo->Se != 0)
  ------------------
  |  Branch (641:11): [True: 12, False: 1.47k]
  ------------------
  642|     12|        goto bad;
  643|  1.48k|    } else {
  644|       |      /* need not check Ss/Se < 0 since they came from unsigned bytes */
  645|    721|      if (cinfo->Se < cinfo->Ss || cinfo->Se > DCTSIZE2 - 1)
  ------------------
  |  |   67|    710|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (645:11): [True: 11, False: 710]
  |  Branch (645:36): [True: 26, False: 684]
  ------------------
  646|     37|        goto bad;
  647|       |      /* AC scans may have only one component */
  648|    684|      if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (648:11): [True: 9, False: 675]
  ------------------
  649|      9|        goto bad;
  650|    684|    }
  651|  2.14k|    if (cinfo->Ah != 0) {
  ------------------
  |  Branch (651:9): [True: 185, False: 1.96k]
  ------------------
  652|       |      /* Successive approximation refinement scan: must have Al = Ah-1. */
  653|    185|      if (cinfo->Ah - 1 != cinfo->Al)
  ------------------
  |  Branch (653:11): [True: 7, False: 178]
  ------------------
  654|      7|        goto bad;
  655|    185|    }
  656|  2.14k|    if (cinfo->Al > 13) {       /* need not check for < 0 */
  ------------------
  |  Branch (656:9): [True: 9, False: 2.13k]
  ------------------
  657|     74|bad:
  658|     74|      ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     74|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     74|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     74|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     74|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     74|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     74|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  659|     74|               cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  660|     74|    }
  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|  6.42k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (665:18): [True: 4.21k, False: 2.20k]
  ------------------
  666|  4.21k|      int coefi, cindex = cinfo->cur_comp_info[ci]->component_index;
  667|  4.21k|      int *coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  668|  4.21k|      int *prev_coef_bit_ptr =
  669|  4.21k|        &cinfo->coef_bits[cindex + cinfo->num_components][0];
  670|  4.21k|      if (cinfo->Ss && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (670:11): [True: 667, False: 3.54k]
  |  Branch (670:24): [True: 2, False: 665]
  ------------------
  671|      2|        WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      2|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      2|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  672|  71.2k|      for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  4.21k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 3.54k, False: 667]
  |  |  ------------------
  ------------------
                    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|  71.2k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 32.0k, False: 39.1k]
  |  |  ------------------
  ------------------
  |  Branch (672:39): [True: 67.0k, False: 4.21k]
  ------------------
  673|  67.0k|        if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (673:13): [True: 47.8k, False: 19.2k]
  ------------------
  674|  47.8k|          prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  675|  19.2k|        else
  676|  19.2k|          prev_coef_bit_ptr[coefi] = 0;
  677|  67.0k|      }
  678|  33.3k|      for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (678:31): [True: 29.1k, False: 4.21k]
  ------------------
  679|  29.1k|        int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (679:24): [True: 15.1k, False: 14.0k]
  ------------------
  680|  29.1k|        if (cinfo->Ah != expected)
  ------------------
  |  Branch (680:13): [True: 11, False: 29.1k]
  ------------------
  681|     11|          WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, coefi);
  ------------------
  |  |  290|     11|  ((cinfo)->err->msg_code = (code), \
  |  |  291|     11|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|     11|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|     11|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  682|  29.1k|        coef_bit_ptr[coefi] = cinfo->Al;
  683|  29.1k|      }
  684|  4.21k|    }
  685|       |    /* Select MCU decoding routine */
  686|  2.20k|    if (cinfo->Ah == 0) {
  ------------------
  |  Branch (686:9): [True: 1.95k, False: 249]
  ------------------
  687|  1.95k|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (687:11): [True: 1.35k, False: 605]
  ------------------
  688|  1.35k|        entropy->pub.decode_mcu = decode_mcu_DC_first;
  689|    605|      else
  690|    605|        entropy->pub.decode_mcu = decode_mcu_AC_first;
  691|  1.95k|    } else {
  692|    249|      if (cinfo->Ss == 0)
  ------------------
  |  Branch (692:11): [True: 107, False: 142]
  ------------------
  693|    107|        entropy->pub.decode_mcu = decode_mcu_DC_refine;
  694|    142|      else
  695|    142|        entropy->pub.decode_mcu = decode_mcu_AC_refine;
  696|    249|    }
  697|  2.20k|  } 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|    323|    if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|    320|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (701:9): [True: 3, False: 320]
  |  Branch (701:27): [True: 4, False: 316]
  ------------------
  702|    316|        cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (702:9): [True: 6, False: 310]
  |  Branch (702:27): [True: 6, False: 304]
  ------------------
  703|     19|      WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|     19|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     19|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  704|       |    /* Select MCU decoding routine */
  705|    323|    entropy->pub.decode_mcu = decode_mcu;
  706|    323|  }
  707|       |
  708|       |  /* Allocate & initialize requested statistics areas */
  709|  7.58k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (709:16): [True: 5.05k, False: 2.52k]
  ------------------
  710|  5.05k|    compptr = cinfo->cur_comp_info[ci];
  711|  5.05k|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (711:9): [True: 856, False: 4.20k]
  |  Branch (711:38): [True: 3.54k, False: 660]
  |  Branch (711:56): [True: 3.24k, False: 293]
  ------------------
  712|  4.10k|      tbl = compptr->dc_tbl_no;
  713|  4.10k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  4.10k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (713:11): [True: 0, False: 4.10k]
  |  Branch (713:22): [True: 0, False: 4.10k]
  ------------------
  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|  4.10k|      if (entropy->dc_stats[tbl] == NULL)
  ------------------
  |  Branch (715:11): [True: 2.13k, False: 1.96k]
  ------------------
  716|  2.13k|        entropy->dc_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  717|  2.13k|          ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |  889|  2.13k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, DC_STAT_BINS);
  ------------------
  |  |   69|  2.13k|#define DC_STAT_BINS  64
  ------------------
  718|  4.10k|      memset(entropy->dc_stats[tbl], 0, DC_STAT_BINS);
  ------------------
  |  |   69|  4.10k|#define DC_STAT_BINS  64
  ------------------
  719|       |      /* Initialize DC predictions to 0 */
  720|  4.10k|      entropy->last_dc_val[ci] = 0;
  721|  4.10k|      entropy->dc_context[ci] = 0;
  722|  4.10k|    }
  723|  5.05k|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (723:9): [True: 856, False: 4.20k]
  |  Branch (723:37): [True: 660, False: 3.54k]
  ------------------
  724|  1.51k|      tbl = compptr->ac_tbl_no;
  725|  1.51k|      if (tbl < 0 || tbl >= NUM_ARITH_TBLS)
  ------------------
  |  |   70|  1.51k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (725:11): [True: 0, False: 1.51k]
  |  Branch (725:22): [True: 0, False: 1.51k]
  ------------------
  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|  1.51k|      if (entropy->ac_stats[tbl] == NULL)
  ------------------
  |  Branch (727:11): [True: 968, False: 548]
  ------------------
  728|    968|        entropy->ac_stats[tbl] = (unsigned char *)(*cinfo->mem->alloc_small)
  729|    968|          ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |  889|    968|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                        ((j_common_ptr)cinfo, JPOOL_IMAGE, AC_STAT_BINS);
  ------------------
  |  |   70|    968|#define AC_STAT_BINS  256
  ------------------
  730|  1.51k|      memset(entropy->ac_stats[tbl], 0, AC_STAT_BINS);
  ------------------
  |  |   70|  1.51k|#define AC_STAT_BINS  256
  ------------------
  731|  1.51k|    }
  732|  5.05k|  }
  733|       |
  734|       |  /* Initialize arithmetic decoding variables */
  735|  2.52k|  entropy->c = 0;
  736|  2.52k|  entropy->a = 0;
  737|  2.52k|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  738|  2.52k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.52k|#define FALSE   0               /* values of boolean */
  ------------------
  739|       |
  740|       |  /* Initialize restart counter */
  741|  2.52k|  entropy->restarts_to_go = cinfo->restart_interval;
  742|  2.52k|}
jdarith.c:decode_mcu_DC_first:
  251|  2.17M|{
  252|  2.17M|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  253|  2.17M|  JBLOCKROW block;
  254|  2.17M|  unsigned char *st;
  255|  2.17M|  int blkn, ci, tbl, sign;
  256|  2.17M|  int v, m;
  257|       |
  258|       |  /* Process restart marker if needed */
  259|  2.17M|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (259:7): [True: 17.7k, False: 2.15M]
  ------------------
  260|  17.7k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (260:9): [True: 4, False: 17.7k]
  ------------------
  261|      4|      process_restart(cinfo);
  262|  17.7k|    entropy->restarts_to_go--;
  263|  17.7k|  }
  264|       |
  265|  2.17M|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (265:7): [True: 0, False: 2.17M]
  ------------------
  266|       |
  267|       |  /* Outer loop handles each block in the MCU */
  268|       |
  269|  9.49M|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (269:18): [True: 7.32M, False: 2.17M]
  ------------------
  270|  7.32M|    block = MCU_data[blkn];
  271|  7.32M|    ci = cinfo->MCU_membership[blkn];
  272|  7.32M|    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|  7.32M|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  278|       |
  279|       |    /* Figure F.19: Decode_DC_DIFF */
  280|  7.32M|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (280:9): [True: 3.73M, False: 3.59M]
  ------------------
  281|  3.73M|      entropy->dc_context[ci] = 0;
  282|  3.59M|    else {
  283|       |      /* Figure F.21: Decoding nonzero value v */
  284|       |      /* Figure F.22: Decoding the sign of v */
  285|  3.59M|      sign = arith_decode(cinfo, st + 1);
  286|  3.59M|      st += 2;  st += sign;
  287|       |      /* Figure F.23: Decoding the magnitude category of v */
  288|  3.59M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (288:11): [True: 1.82M, False: 1.76M]
  ------------------
  289|  1.82M|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  290|  3.84M|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (290:16): [True: 2.01M, False: 1.82M]
  ------------------
  291|  2.01M|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (291:15): [True: 9, False: 2.01M]
  ------------------
  292|      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))
  ------------------
  293|      9|            entropy->ct = -1;                   /* magnitude overflow */
  294|      9|            return TRUE;
  ------------------
  |  |  210|      9|#define TRUE    1
  ------------------
  295|      9|          }
  296|  2.01M|          st += 1;
  297|  2.01M|        }
  298|  1.82M|      }
  299|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  300|  3.59M|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (300:11): [True: 150k, False: 3.44M]
  ------------------
  301|   150k|        entropy->dc_context[ci] = 0;               /* zero diff category */
  302|  3.44M|      else if (m > (int)((1L << cinfo->arith_dc_U[tbl]) >> 1))
  ------------------
  |  Branch (302:16): [True: 733k, False: 2.70M]
  ------------------
  303|   733k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  304|  2.70M|      else
  305|  2.70M|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  306|  3.59M|      v = m;
  307|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  308|  3.59M|      st += 14;
  309|  5.61M|      while (m >>= 1)
  ------------------
  |  Branch (309:14): [True: 2.01M, False: 3.59M]
  ------------------
  310|  2.01M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (310:13): [True: 1.03M, False: 985k]
  ------------------
  311|  3.59M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (311:20): [True: 1.72M, False: 1.86M]
  ------------------
  312|  3.59M|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  313|  3.59M|    }
  314|       |
  315|       |    /* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
  316|  7.32M|    (*block)[0] = (JCOEF)LEFT_SHIFT(entropy->last_dc_val[ci], cinfo->Al);
  ------------------
  |  |   85|  7.32M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  317|  7.32M|  }
  318|       |
  319|  2.17M|  return TRUE;
  ------------------
  |  |  210|  2.17M|#define TRUE    1
  ------------------
  320|  2.17M|}
jdarith.c:process_restart:
  200|     17|{
  201|     17|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  202|     17|  int ci;
  203|     17|  jpeg_component_info *compptr;
  204|       |
  205|       |  /* Advance past the RSTn marker */
  206|     17|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (206:7): [True: 0, False: 17]
  ------------------
  207|      0|    ERREXIT(cinfo, JERR_CANT_SUSPEND);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  208|       |
  209|       |  /* Re-initialize statistics areas */
  210|     29|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (210:16): [True: 12, False: 17]
  ------------------
  211|     12|    compptr = cinfo->cur_comp_info[ci];
  212|     12|    if (!cinfo->progressive_mode || (cinfo->Ss == 0 && cinfo->Ah == 0)) {
  ------------------
  |  Branch (212:9): [True: 11, False: 1]
  |  Branch (212:38): [True: 1, False: 0]
  |  Branch (212:56): [True: 1, False: 0]
  ------------------
  213|     12|      memset(entropy->dc_stats[compptr->dc_tbl_no], 0, DC_STAT_BINS);
  ------------------
  |  |   69|     12|#define DC_STAT_BINS  64
  ------------------
  214|       |      /* Reset DC predictions to 0 */
  215|     12|      entropy->last_dc_val[ci] = 0;
  216|     12|      entropy->dc_context[ci] = 0;
  217|     12|    }
  218|     12|    if (!cinfo->progressive_mode || cinfo->Ss) {
  ------------------
  |  Branch (218:9): [True: 11, False: 1]
  |  Branch (218:37): [True: 0, False: 1]
  ------------------
  219|     11|      memset(entropy->ac_stats[compptr->ac_tbl_no], 0, AC_STAT_BINS);
  ------------------
  |  |   70|     11|#define AC_STAT_BINS  256
  ------------------
  220|     11|    }
  221|     12|  }
  222|       |
  223|       |  /* Reset arithmetic decoding variables */
  224|     17|  entropy->c = 0;
  225|     17|  entropy->a = 0;
  226|     17|  entropy->ct = -16;    /* force reading 2 initial bytes to fill C */
  227|       |
  228|       |  /* Reset restart counter */
  229|     17|  entropy->restarts_to_go = cinfo->restart_interval;
  230|     17|}
jdarith.c:arith_decode:
  116|  40.4M|{
  117|  40.4M|  register arith_entropy_ptr e = (arith_entropy_ptr)cinfo->entropy;
  118|  40.4M|  register unsigned char nl, nm;
  119|  40.4M|  register JLONG qe, temp;
  120|  40.4M|  register int sv, data;
  121|       |
  122|       |  /* Renormalization & data input per section D.2.6 */
  123|  54.7M|  while (e->a < 0x8000L) {
  ------------------
  |  Branch (123:10): [True: 14.2M, False: 40.4M]
  ------------------
  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.71M, False: 73.2k]
  ------------------
  127|  1.71M|        data = 0;               /* stuff zero data */
  128|  73.2k|      else {
  129|  73.2k|        data = get_byte(cinfo); /* read next input byte */
  130|  73.2k|        if (data == 0xFF) {     /* zero stuff or marker code */
  ------------------
  |  Branch (130:13): [True: 2.56k, False: 70.6k]
  ------------------
  131|  4.16k|          do data = get_byte(cinfo);
  132|  4.16k|          while (data == 0xFF); /* swallow extra 0xFF bytes */
  ------------------
  |  Branch (132:18): [True: 1.60k, False: 2.56k]
  ------------------
  133|  2.56k|          if (data == 0)
  ------------------
  |  Branch (133:15): [True: 430, False: 2.13k]
  ------------------
  134|    430|            data = 0xFF;        /* discard stuffed zero byte */
  135|  2.13k|          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.13k|            cinfo->unread_marker = data;
  143|  2.13k|            data = 0;
  144|  2.13k|          }
  145|  2.56k|        }
  146|  73.2k|      }
  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.85k, False: 1.78M]
  ------------------
  149|       |        /* Need more initial bytes */
  150|  4.85k|        if (++e->ct == 0)
  ------------------
  |  Branch (150:13): [True: 2.42k, False: 2.43k]
  ------------------
  151|       |          /* Got 2 initial bytes -> re-init A and exit loop */
  152|  2.42k|          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|  40.4M|  sv = *st;
  161|  40.4M|  qe = jpeg_aritab[sv & 0x7F];  /* => Qe_Value */
  162|  40.4M|  nl = qe & 0xFF;  qe >>= 8;    /* Next_Index_LPS + Switch_MPS */
  163|  40.4M|  nm = qe & 0xFF;  qe >>= 8;    /* Next_Index_MPS */
  164|       |
  165|       |  /* Decode & estimation procedures per sections D.2.4 & D.2.5 */
  166|  40.4M|  temp = e->a - qe;
  167|  40.4M|  e->a = temp;
  168|  40.4M|  temp <<= e->ct;
  169|  40.4M|  if (e->c >= temp) {
  ------------------
  |  Branch (169:7): [True: 4.79M, False: 35.7M]
  ------------------
  170|  4.79M|    e->c -= temp;
  171|       |    /* Conditional LPS (less probable symbol) exchange */
  172|  4.79M|    if (e->a < qe) {
  ------------------
  |  Branch (172:9): [True: 1.25M, False: 3.53M]
  ------------------
  173|  1.25M|      e->a = qe;
  174|  1.25M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  175|  3.53M|    } else {
  176|  3.53M|      e->a = qe;
  177|  3.53M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  178|  3.53M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  179|  3.53M|    }
  180|  35.7M|  } else if (e->a < 0x8000L) {
  ------------------
  |  Branch (180:14): [True: 5.70M, False: 29.9M]
  ------------------
  181|       |    /* Conditional MPS (more probable symbol) exchange */
  182|  5.70M|    if (e->a < qe) {
  ------------------
  |  Branch (182:9): [True: 1.49M, False: 4.20M]
  ------------------
  183|  1.49M|      *st = (sv & 0x80) ^ nl;   /* Estimate_after_LPS */
  184|  1.49M|      sv ^= 0x80;               /* Exchange LPS/MPS */
  185|  4.20M|    } else {
  186|  4.20M|      *st = (sv & 0x80) ^ nm;   /* Estimate_after_MPS */
  187|  4.20M|    }
  188|  5.70M|  }
  189|       |
  190|  40.4M|  return sv >> 7;
  191|  40.4M|}
jdarith.c:get_byte:
   76|  77.4k|{
   77|  77.4k|  struct jpeg_source_mgr *src = cinfo->src;
   78|       |
   79|  77.4k|  if (src->bytes_in_buffer == 0)
  ------------------
  |  Branch (79:7): [True: 243, False: 77.1k]
  ------------------
   80|    243|    if (!(*src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (80:9): [True: 0, False: 243]
  ------------------
   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|  77.4k|  src->bytes_in_buffer--;
   83|  77.4k|  return *src->next_input_byte++;
   84|  77.4k|}
jdarith.c:decode_mcu_AC_first:
  330|   820k|{
  331|   820k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  332|   820k|  JBLOCKROW block;
  333|   820k|  unsigned char *st;
  334|   820k|  int tbl, sign, k;
  335|   820k|  int v, m;
  336|       |
  337|       |  /* Process restart marker if needed */
  338|   820k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (338:7): [True: 5.68k, False: 815k]
  ------------------
  339|  5.68k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (339:9): [True: 0, False: 5.68k]
  ------------------
  340|      0|      process_restart(cinfo);
  341|  5.68k|    entropy->restarts_to_go--;
  342|  5.68k|  }
  343|       |
  344|   820k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (344:7): [True: 0, False: 820k]
  ------------------
  345|       |
  346|       |  /* There is always only one block per MCU */
  347|   820k|  block = MCU_data[0];
  348|   820k|  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|  1.83M|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (353:23): [True: 1.83M, False: 327]
  ------------------
  354|  1.83M|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  355|  1.83M|    if (arith_decode(cinfo, st)) break;         /* EOB flag */
  ------------------
  |  Branch (355:9): [True: 820k, False: 1.01M]
  ------------------
  356|  1.96M|    while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (356:12): [True: 955k, False: 1.01M]
  ------------------
  357|   955k|      st += 3;  k++;
  358|   955k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (358:11): [True: 18, False: 955k]
  ------------------
  359|     18|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     18|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  360|     18|        entropy->ct = -1;                       /* spectral overflow */
  361|     18|        return TRUE;
  ------------------
  |  |  210|     18|#define TRUE    1
  ------------------
  362|     18|      }
  363|   955k|    }
  364|       |    /* Figure F.21: Decoding nonzero value v */
  365|       |    /* Figure F.22: Decoding the sign of v */
  366|  1.01M|    sign = arith_decode(cinfo, entropy->fixed_bin);
  367|  1.01M|    st += 2;
  368|       |    /* Figure F.23: Decoding the magnitude category of v */
  369|  1.01M|    if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (369:9): [True: 552k, False: 461k]
  ------------------
  370|   552k|      if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (370:11): [True: 429k, False: 123k]
  ------------------
  371|   429k|        m <<= 1;
  372|   429k|        st = entropy->ac_stats[tbl] +
  373|   429k|             (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (373:15): [True: 103k, False: 326k]
  ------------------
  374|   906k|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (374:16): [True: 477k, False: 429k]
  ------------------
  375|   477k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (375:15): [True: 12, False: 477k]
  ------------------
  376|     12|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     12|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  377|     12|            entropy->ct = -1;                   /* magnitude overflow */
  378|     12|            return TRUE;
  ------------------
  |  |  210|     12|#define TRUE    1
  ------------------
  379|     12|          }
  380|   477k|          st += 1;
  381|   477k|        }
  382|   429k|      }
  383|   552k|    }
  384|  1.01M|    v = m;
  385|       |    /* Figure F.24: Decoding the magnitude bit pattern of v */
  386|  1.01M|    st += 14;
  387|  1.92M|    while (m >>= 1)
  ------------------
  |  Branch (387:12): [True: 906k, False: 1.01M]
  ------------------
  388|   906k|      if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (388:11): [True: 470k, False: 435k]
  ------------------
  389|  1.01M|    v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (389:18): [True: 458k, False: 556k]
  ------------------
  390|       |    /* Scale and output coefficient in natural (dezigzagged) order */
  391|  1.01M|    (*block)[jpeg_natural_order[k]] = (JCOEF)((unsigned)v << cinfo->Al);
  392|  1.01M|  }
  393|       |
  394|   820k|  return TRUE;
  ------------------
  |  |  210|   820k|#define TRUE    1
  ------------------
  395|   820k|}
jdarith.c:decode_mcu_DC_refine:
  404|  46.5k|{
  405|  46.5k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  406|  46.5k|  unsigned char *st;
  407|  46.5k|  int p1, blkn;
  408|       |
  409|       |  /* Process restart marker if needed */
  410|  46.5k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (410:7): [True: 0, False: 46.5k]
  ------------------
  411|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (411:9): [True: 0, False: 0]
  ------------------
  412|      0|      process_restart(cinfo);
  413|      0|    entropy->restarts_to_go--;
  414|      0|  }
  415|       |
  416|  46.5k|  st = entropy->fixed_bin;      /* use fixed probability estimation */
  417|  46.5k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  418|       |
  419|       |  /* Outer loop handles each block in the MCU */
  420|       |
  421|   297k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (421:18): [True: 251k, False: 46.5k]
  ------------------
  422|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  423|   251k|    if (arith_decode(cinfo, st))
  ------------------
  |  Branch (423:9): [True: 125k, False: 125k]
  ------------------
  424|   125k|      MCU_data[blkn][0][0] |= p1;
  425|   251k|  }
  426|       |
  427|  46.5k|  return TRUE;
  ------------------
  |  |  210|  46.5k|#define TRUE    1
  ------------------
  428|  46.5k|}
jdarith.c:decode_mcu_AC_refine:
  437|  43.4k|{
  438|  43.4k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  439|  43.4k|  JBLOCKROW block;
  440|  43.4k|  JCOEFPTR thiscoef;
  441|  43.4k|  unsigned char *st;
  442|  43.4k|  int tbl, k, kex;
  443|  43.4k|  int p1, m1;
  444|       |
  445|       |  /* Process restart marker if needed */
  446|  43.4k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (446:7): [True: 1.07k, False: 42.3k]
  ------------------
  447|  1.07k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 1.07k]
  ------------------
  448|      0|      process_restart(cinfo);
  449|  1.07k|    entropy->restarts_to_go--;
  450|  1.07k|  }
  451|       |
  452|  43.4k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (452:7): [True: 0, False: 43.4k]
  ------------------
  453|       |
  454|       |  /* There is always only one block per MCU */
  455|  43.4k|  block = MCU_data[0];
  456|  43.4k|  tbl = cinfo->cur_comp_info[0]->ac_tbl_no;
  457|       |
  458|  43.4k|  p1 = 1 << cinfo->Al;          /* 1 in the bit position being coded */
  459|  43.4k|  m1 = (NEG_1) << cinfo->Al;    /* -1 in the bit position being coded */
  ------------------
  |  |   27|  43.4k|#define NEG_1  ((unsigned int)-1)
  ------------------
  460|       |
  461|       |  /* Establish EOBx (previous stage end-of-block) index */
  462|  2.11M|  for (kex = cinfo->Se; kex > 0; kex--)
  ------------------
  |  Branch (462:25): [True: 2.11M, False: 8.14k]
  ------------------
  463|  2.11M|    if ((*block)[jpeg_natural_order[kex]]) break;
  ------------------
  |  Branch (463:9): [True: 35.2k, False: 2.07M]
  ------------------
  464|       |
  465|   527k|  for (k = cinfo->Ss; k <= cinfo->Se; k++) {
  ------------------
  |  Branch (465:23): [True: 526k, False: 393]
  ------------------
  466|   526k|    st = entropy->ac_stats[tbl] + 3 * (k - 1);
  467|   526k|    if (k > kex)
  ------------------
  |  Branch (467:9): [True: 97.1k, False: 429k]
  ------------------
  468|  97.1k|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (468:11): [True: 43.0k, False: 54.1k]
  ------------------
  469|   625k|    for (;;) {
  470|   625k|      thiscoef = *block + jpeg_natural_order[k];
  471|   625k|      if (*thiscoef) {                          /* previously nonzero coef */
  ------------------
  |  Branch (471:11): [True: 355k, False: 269k]
  ------------------
  472|   355k|        if (arith_decode(cinfo, st + 2)) {
  ------------------
  |  Branch (472:13): [True: 178k, False: 177k]
  ------------------
  473|   178k|          if (*thiscoef < 0)
  ------------------
  |  Branch (473:15): [True: 79.8k, False: 98.6k]
  ------------------
  474|  79.8k|            *thiscoef += (JCOEF)m1;
  475|  98.6k|          else
  476|  98.6k|            *thiscoef += (JCOEF)p1;
  477|   178k|        }
  478|   355k|        break;
  479|   355k|      }
  480|   269k|      if (arith_decode(cinfo, st + 1)) {        /* newly nonzero coef */
  ------------------
  |  Branch (480:11): [True: 127k, False: 141k]
  ------------------
  481|   127k|        if (arith_decode(cinfo, entropy->fixed_bin))
  ------------------
  |  Branch (481:13): [True: 56.6k, False: 71.1k]
  ------------------
  482|  56.6k|          *thiscoef = (JCOEF)m1;
  483|  71.1k|        else
  484|  71.1k|          *thiscoef = (JCOEF)p1;
  485|   127k|        break;
  486|   127k|      }
  487|   141k|      st += 3;  k++;
  488|   141k|      if (k > cinfo->Se) {
  ------------------
  |  Branch (488:11): [True: 19, False: 141k]
  ------------------
  489|     19|        WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|     19|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     19|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  490|     19|        entropy->ct = -1;                       /* spectral overflow */
  491|     19|        return TRUE;
  ------------------
  |  |  210|     19|#define TRUE    1
  ------------------
  492|     19|      }
  493|   141k|    }
  494|   483k|  }
  495|       |
  496|  43.4k|  return TRUE;
  ------------------
  |  |  210|  43.4k|#define TRUE    1
  ------------------
  497|  43.4k|}
jdarith.c:decode_mcu:
  506|  81.9k|{
  507|  81.9k|  arith_entropy_ptr entropy = (arith_entropy_ptr)cinfo->entropy;
  508|  81.9k|  jpeg_component_info *compptr;
  509|  81.9k|  JBLOCKROW block;
  510|  81.9k|  unsigned char *st;
  511|  81.9k|  int blkn, ci, tbl, sign, k;
  512|  81.9k|  int v, m;
  513|       |
  514|       |  /* Process restart marker if needed */
  515|  81.9k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (515:7): [True: 1.14k, False: 80.7k]
  ------------------
  516|  1.14k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (516:9): [True: 13, False: 1.13k]
  ------------------
  517|     13|      process_restart(cinfo);
  518|  1.14k|    entropy->restarts_to_go--;
  519|  1.14k|  }
  520|       |
  521|  81.9k|  if (entropy->ct == -1) return TRUE;   /* if error do nothing */
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  |  Branch (521:7): [True: 0, False: 81.9k]
  ------------------
  522|       |
  523|       |  /* Outer loop handles each block in the MCU */
  524|       |
  525|   767k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (525:18): [True: 685k, False: 81.8k]
  ------------------
  526|   685k|    block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (526:13): [True: 685k, False: 0]
  ------------------
  527|   685k|    ci = cinfo->MCU_membership[blkn];
  528|   685k|    compptr = cinfo->cur_comp_info[ci];
  529|       |
  530|       |    /* Sections F.2.4.1 & F.1.4.4.1: Decoding of DC coefficients */
  531|       |
  532|   685k|    tbl = compptr->dc_tbl_no;
  533|       |
  534|       |    /* Table F.4: Point to statistics bin S0 for DC coefficient coding */
  535|   685k|    st = entropy->dc_stats[tbl] + entropy->dc_context[ci];
  536|       |
  537|       |    /* Figure F.19: Decode_DC_DIFF */
  538|   685k|    if (arith_decode(cinfo, st) == 0)
  ------------------
  |  Branch (538:9): [True: 445k, False: 239k]
  ------------------
  539|   445k|      entropy->dc_context[ci] = 0;
  540|   239k|    else {
  541|       |      /* Figure F.21: Decoding nonzero value v */
  542|       |      /* Figure F.22: Decoding the sign of v */
  543|   239k|      sign = arith_decode(cinfo, st + 1);
  544|   239k|      st += 2;  st += sign;
  545|       |      /* Figure F.23: Decoding the magnitude category of v */
  546|   239k|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (546:11): [True: 142k, False: 96.5k]
  ------------------
  547|   142k|        st = entropy->dc_stats[tbl] + 20;       /* Table F.4: X1 = 20 */
  548|   436k|        while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (548:16): [True: 293k, False: 142k]
  ------------------
  549|   293k|          if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (549:15): [True: 7, False: 293k]
  ------------------
  550|      7|            WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      7|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  551|      7|            entropy->ct = -1;                   /* magnitude overflow */
  552|      7|            return TRUE;
  ------------------
  |  |  210|      7|#define TRUE    1
  ------------------
  553|      7|          }
  554|   293k|          st += 1;
  555|   293k|        }
  556|   142k|      }
  557|       |      /* Section F.1.4.4.1.2: Establish dc_context conditioning category */
  558|   239k|      if (m < (int)((1L << cinfo->arith_dc_L[tbl]) >> 1))
  ------------------
  |  Branch (558:11): [True: 8.59k, False: 230k]
  ------------------
  559|  8.59k|        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: 88.3k, False: 142k]
  ------------------
  561|  88.3k|        entropy->dc_context[ci] = 12 + (sign * 4); /* large diff category */
  562|   142k|      else
  563|   142k|        entropy->dc_context[ci] = 4 + (sign * 4);  /* small diff category */
  564|   239k|      v = m;
  565|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  566|   239k|      st += 14;
  567|   532k|      while (m >>= 1)
  ------------------
  |  Branch (567:14): [True: 293k, False: 239k]
  ------------------
  568|   293k|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (568:13): [True: 198k, False: 95.1k]
  ------------------
  569|   239k|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (569:20): [True: 138k, False: 101k]
  ------------------
  570|   239k|      entropy->last_dc_val[ci] = (entropy->last_dc_val[ci] + v) & 0xffff;
  571|   239k|    }
  572|       |
  573|   685k|    if (block)
  ------------------
  |  Branch (573:9): [True: 685k, False: 17]
  ------------------
  574|   685k|      (*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|   685k|    tbl = compptr->ac_tbl_no;
  579|       |
  580|       |    /* Figure F.20: Decode_AC_coefficients */
  581|  1.75M|    for (k = 1; k <= DCTSIZE2 - 1; k++) {
  ------------------
  |  |   67|  1.75M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (581:17): [True: 1.75M, False: 343]
  ------------------
  582|  1.75M|      st = entropy->ac_stats[tbl] + 3 * (k - 1);
  583|  1.75M|      if (arith_decode(cinfo, st)) break;       /* EOB flag */
  ------------------
  |  Branch (583:11): [True: 684k, False: 1.07M]
  ------------------
  584|  2.14M|      while (arith_decode(cinfo, st + 1) == 0) {
  ------------------
  |  Branch (584:14): [True: 1.07M, False: 1.07M]
  ------------------
  585|  1.07M|        st += 3;  k++;
  586|  1.07M|        if (k > DCTSIZE2 - 1) {
  ------------------
  |  |   67|  1.07M|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (586:13): [True: 2, False: 1.07M]
  ------------------
  587|      2|          WARNMS(cinfo, JWRN_ARITH_BAD_CODE);
  ------------------
  |  |  283|      2|  ((cinfo)->err->msg_code = (code), \
  |  |  284|      2|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  588|      2|          entropy->ct = -1;                     /* spectral overflow */
  589|      2|          return TRUE;
  ------------------
  |  |  210|      2|#define TRUE    1
  ------------------
  590|      2|        }
  591|  1.07M|      }
  592|       |      /* Figure F.21: Decoding nonzero value v */
  593|       |      /* Figure F.22: Decoding the sign of v */
  594|  1.07M|      sign = arith_decode(cinfo, entropy->fixed_bin);
  595|  1.07M|      st += 2;
  596|       |      /* Figure F.23: Decoding the magnitude category of v */
  597|  1.07M|      if ((m = arith_decode(cinfo, st)) != 0) {
  ------------------
  |  Branch (597:11): [True: 736k, False: 337k]
  ------------------
  598|   736k|        if (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (598:13): [True: 667k, False: 69.0k]
  ------------------
  599|   667k|          m <<= 1;
  600|   667k|          st = entropy->ac_stats[tbl] +
  601|   667k|               (k <= cinfo->arith_ac_K[tbl] ? 189 : 217);
  ------------------
  |  Branch (601:17): [True: 596k, False: 70.3k]
  ------------------
  602|  1.06M|          while (arith_decode(cinfo, st)) {
  ------------------
  |  Branch (602:18): [True: 400k, False: 667k]
  ------------------
  603|   400k|            if ((m <<= 1) == 0x8000) {
  ------------------
  |  Branch (603:17): [True: 11, False: 400k]
  ------------------
  604|     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))
  ------------------
  605|     11|              entropy->ct = -1;                 /* magnitude overflow */
  606|     11|              return TRUE;
  ------------------
  |  |  210|     11|#define TRUE    1
  ------------------
  607|     11|            }
  608|   400k|            st += 1;
  609|   400k|          }
  610|   667k|        }
  611|   736k|      }
  612|  1.07M|      v = m;
  613|       |      /* Figure F.24: Decoding the magnitude bit pattern of v */
  614|  1.07M|      st += 14;
  615|  2.14M|      while (m >>= 1)
  ------------------
  |  Branch (615:14): [True: 1.06M, False: 1.07M]
  ------------------
  616|  1.06M|        if (arith_decode(cinfo, st)) v |= m;
  ------------------
  |  Branch (616:13): [True: 319k, False: 747k]
  ------------------
  617|  1.07M|      v += 1;  if (sign) v = -v;
  ------------------
  |  Branch (617:20): [True: 538k, False: 535k]
  ------------------
  618|  1.07M|      if (block)
  ------------------
  |  Branch (618:11): [True: 1.07M, False: 69]
  ------------------
  619|  1.07M|        (*block)[jpeg_natural_order[k]] = (JCOEF)v;
  620|  1.07M|    }
  621|   685k|  }
  622|       |
  623|  81.8k|  return TRUE;
  ------------------
  |  |  210|  81.8k|#define TRUE    1
  ------------------
  624|  81.9k|}

jinit_d_coef_controller:
  869|  2.99k|{
  870|  2.99k|  my_coef_ptr coef;
  871|       |
  872|  2.99k|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  2.99k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (872:7): [True: 0, False: 2.99k]
  ------------------
  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|  2.99k|  coef = (my_coef_ptr)
  876|  2.99k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.99k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|  2.99k|                                sizeof(my_coef_controller));
  878|  2.99k|  memset(coef, 0, sizeof(my_coef_controller));
  879|  2.99k|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|  2.99k|  coef->pub.start_input_pass = start_input_pass;
  881|  2.99k|  coef->pub.start_output_pass = start_output_pass;
  882|  2.99k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|  2.99k|  coef->coef_bits_latch = NULL;
  884|  2.99k|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|  2.99k|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 1.30k, False: 1.68k]
  ------------------
  888|  1.30k|#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|  1.30k|    int ci, access_rows;
  893|  1.30k|    jpeg_component_info *compptr;
  894|       |
  895|  4.49k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 3.19k, False: 1.30k]
  ------------------
  896|  3.19k|         ci++, compptr++) {
  897|  3.19k|      access_rows = compptr->v_samp_factor;
  898|  3.19k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|  3.19k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 3.16k, False: 33]
  ------------------
  901|  3.16k|        access_rows *= 5;
  902|  3.19k|#endif
  903|  3.19k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|  3.19k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  3.19k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  3.19k|#define TRUE    1
  ------------------
  905|  3.19k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|  3.19k|                               (long)compptr->h_samp_factor),
  907|  3.19k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|  3.19k|                               (long)compptr->v_samp_factor),
  909|  3.19k|         (JDIMENSION)access_rows);
  910|  3.19k|    }
  911|  1.30k|    coef->pub.consume_data = consume_data;
  912|  1.30k|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|  1.30k|#define _decompress_data  decompress_data
  ------------------
  913|  1.30k|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|  1.68k|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|  1.68k|    JBLOCKROW buffer;
  920|  1.68k|    int i;
  921|       |
  922|  1.68k|    buffer = (JBLOCKROW)
  923|  1.68k|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.68k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|  1.68k|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|  1.68k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|  18.5k|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|  18.5k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 16.8k, False: 1.68k]
  ------------------
  926|  16.8k|      coef->MCU_buffer[i] = buffer + i;
  927|  16.8k|    }
  928|  1.68k|    coef->pub.consume_data = dummy_consume_data;
  929|  1.68k|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  258|  1.68k|#define _decompress_data  decompress_data
  ------------------
  930|  1.68k|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|  1.68k|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|  2.99k|  coef->workspace = (JCOEF *)
  935|  2.99k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.99k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|  2.99k|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|  2.99k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|  2.99k|}
jdcoefct-8.c:start_input_pass:
   50|  5.15k|{
   51|  5.15k|  cinfo->input_iMCU_row = 0;
   52|  5.15k|  start_iMCU_row(cinfo);
   53|  5.15k|}
jdcoefct-8.c:start_output_pass:
   62|  2.00k|{
   63|  2.00k|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|  2.00k|  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|  2.00k|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 480, False: 1.52k]
  ------------------
   68|    480|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 480, False: 0]
  |  Branch (68:38): [True: 355, False: 125]
  ------------------
   69|    355|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  258|    355|#define _decompress_data  decompress_data
  ------------------
   70|    125|    else
   71|    125|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    125|#define _decompress_data  decompress_data
  ------------------
   72|    480|  }
   73|  2.00k|#endif
   74|  2.00k|  cinfo->output_iMCU_row = 0;
   75|  2.00k|}
jdcoefct-8.c:smoothing_ok:
  405|    480|{
  406|    480|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|    480|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|    480|#define FALSE   0               /* values of boolean */
  ------------------
  408|    480|  int ci, coefi;
  409|    480|  jpeg_component_info *compptr;
  410|    480|  JQUANT_TBL *qtable;
  411|    480|  int *coef_bits, *prev_coef_bits;
  412|    480|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|    480|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 7, False: 473]
  |  Branch (414:35): [True: 0, False: 473]
  ------------------
  415|      7|    return FALSE;
  ------------------
  |  |  207|      7|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|    473|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 473, False: 0]
  ------------------
  419|    473|    coef->coef_bits_latch = (int *)
  420|    473|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    473|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|    473|                                  cinfo->num_components * 2 *
  422|    473|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|    473|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|    473|  coef_bits_latch = coef->coef_bits_latch;
  424|    473|  prev_coef_bits_latch =
  425|    473|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|    473|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|  1.21k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 831, False: 387]
  ------------------
  428|    831|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    831|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 5, False: 826]
  ------------------
  431|      5|      return FALSE;
  ------------------
  |  |  207|      5|#define FALSE   0               /* values of boolean */
  ------------------
  432|       |    /* Verify DC & first 9 AC quantizers are nonzero to avoid zero-divide. */
  433|    826|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 23, False: 803]
  ------------------
  434|    803|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    803|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 3, False: 800]
  ------------------
  435|    800|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    800|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 2, False: 798]
  ------------------
  436|    798|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    798|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 1, False: 797]
  ------------------
  437|    797|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    797|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 9, False: 788]
  ------------------
  438|    788|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    788|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 5, False: 783]
  ------------------
  439|    783|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    783|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 11, False: 772]
  ------------------
  440|    772|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    772|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 7, False: 765]
  ------------------
  441|    765|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    765|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 10, False: 755]
  ------------------
  442|    755|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    755|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 10, False: 745]
  ------------------
  443|     81|      return FALSE;
  ------------------
  |  |  207|     81|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    745|    coef_bits = cinfo->coef_bits[ci];
  446|    745|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    745|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 745]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|    745|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  7.45k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  7.45k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 6.70k, False: 745]
  ------------------
  452|  6.70k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 4.59k, False: 2.11k]
  ------------------
  453|  4.59k|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|  2.11k|      else
  455|  2.11k|        prev_coef_bits_latch[coefi] = -1;
  456|  6.70k|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|  6.70k|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 5.66k, False: 1.04k]
  ------------------
  458|  5.66k|        smoothing_useful = TRUE;
  ------------------
  |  |  210|  5.66k|#define TRUE    1
  ------------------
  459|  6.70k|    }
  460|    745|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    745|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    745|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    745|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    745|  }
  463|       |
  464|    387|  return smoothing_useful;
  465|    473|}
jdcoefct-8.c:decompress_smooth_data:
  474|  22.0k|{
  475|  22.0k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  476|  22.0k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  477|  22.0k|  JDIMENSION block_num, last_block_column;
  478|  22.0k|  int ci, block_row, block_rows, access_rows, image_block_row,
  479|  22.0k|    image_block_rows;
  480|  22.0k|  JBLOCKARRAY buffer;
  481|  22.0k|  JBLOCKROW buffer_ptr, prev_prev_block_row, prev_block_row;
  482|  22.0k|  JBLOCKROW next_block_row, next_next_block_row;
  483|  22.0k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  22.0k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  484|  22.0k|  JDIMENSION output_col;
  485|  22.0k|  jpeg_component_info *compptr;
  486|  22.0k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  22.0k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  487|  22.0k|  boolean change_dc;
  488|  22.0k|  JCOEF *workspace;
  489|  22.0k|  int *coef_bits;
  490|  22.0k|  JQUANT_TBL *quanttbl;
  491|  22.0k|  JLONG Q00, Q01, Q02, Q03 = 0, Q10, Q11, Q12 = 0, Q20, Q21 = 0, Q30 = 0, num;
  492|  22.0k|  int DC01, DC02, DC03, DC04, DC05, DC06, DC07, DC08, DC09, DC10, DC11, DC12,
  493|  22.0k|      DC13, DC14, DC15, DC16, DC17, DC18, DC19, DC20, DC21, DC22, DC23, DC24,
  494|  22.0k|      DC25;
  495|  22.0k|  int Al, pred;
  496|       |
  497|       |  /* Keep a local variable to avoid looking it up more than once */
  498|  22.0k|  workspace = coef->workspace;
  499|       |
  500|       |  /* Force some input to be done if we are getting ahead of the input. */
  501|  22.0k|  while (cinfo->input_scan_number <= cinfo->output_scan_number &&
  ------------------
  |  Branch (501:10): [True: 22.0k, False: 0]
  ------------------
  502|  22.0k|         !cinfo->inputctl->eoi_reached) {
  ------------------
  |  Branch (502:10): [True: 0, False: 22.0k]
  ------------------
  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|  70.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (518:44): [True: 48.2k, False: 22.0k]
  ------------------
  519|  48.2k|       ci++, compptr++) {
  520|       |    /* Don't bother to IDCT an uninteresting component. */
  521|  48.2k|    if (!compptr->component_needed)
  ------------------
  |  Branch (521:9): [True: 0, False: 48.2k]
  ------------------
  522|      0|      continue;
  523|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  524|  48.2k|    if (cinfo->output_iMCU_row + 1 < last_iMCU_row) {
  ------------------
  |  Branch (524:9): [True: 47.0k, False: 1.11k]
  ------------------
  525|  47.0k|      block_rows = compptr->v_samp_factor;
  526|  47.0k|      access_rows = block_rows * 3; /* this and next two iMCU rows */
  527|  47.0k|    } else if (cinfo->output_iMCU_row < last_iMCU_row) {
  ------------------
  |  Branch (527:16): [True: 510, False: 608]
  ------------------
  528|    510|      block_rows = compptr->v_samp_factor;
  529|    510|      access_rows = block_rows * 2; /* this and next iMCU row */
  530|    608|    } else {
  531|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  532|    608|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  533|    608|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (533:11): [True: 396, False: 212]
  ------------------
  534|    608|      access_rows = block_rows; /* this iMCU row only */
  535|    608|    }
  536|       |    /* Align the virtual buffer for this component. */
  537|  48.2k|    if (cinfo->output_iMCU_row > 1) {
  ------------------
  |  Branch (537:9): [True: 47.0k, False: 1.11k]
  ------------------
  538|  47.0k|      access_rows += 2 * compptr->v_samp_factor; /* prior two iMCU rows too */
  539|  47.0k|      buffer = (*cinfo->mem->access_virt_barray)
  540|  47.0k|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  541|  47.0k|         (cinfo->output_iMCU_row - 2) * compptr->v_samp_factor,
  542|  47.0k|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|  47.0k|#define FALSE   0               /* values of boolean */
  ------------------
  543|  47.0k|      buffer += 2 * compptr->v_samp_factor; /* point to current iMCU row */
  544|  47.0k|    } else if (cinfo->output_iMCU_row > 0) {
  ------------------
  |  Branch (544:16): [True: 510, False: 608]
  ------------------
  545|    510|      access_rows += compptr->v_samp_factor; /* prior iMCU row too */
  546|    510|      buffer = (*cinfo->mem->access_virt_barray)
  547|    510|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  548|    510|         (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
  549|    510|         (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    510|#define FALSE   0               /* values of boolean */
  ------------------
  550|    510|      buffer += compptr->v_samp_factor; /* point to current iMCU row */
  551|    608|    } else {
  552|    608|      buffer = (*cinfo->mem->access_virt_barray)
  553|    608|        ((j_common_ptr)cinfo, coef->whole_image[ci],
  554|    608|         (JDIMENSION)0, (JDIMENSION)access_rows, FALSE);
  ------------------
  |  |  207|    608|#define FALSE   0               /* values of boolean */
  ------------------
  555|    608|    }
  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|  48.2k|    if (cinfo->output_iMCU_row > cinfo->master->last_good_iMCU_row)
  ------------------
  |  Branch (560:9): [True: 0, False: 48.2k]
  ------------------
  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|  48.2k|    else
  564|  48.2k|      coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
  ------------------
  |  |   58|  48.2k|#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|  48.2k|    change_dc =
  568|  48.2k|      coef_bits[1] == -1 && coef_bits[2] == -1 && coef_bits[3] == -1 &&
  ------------------
  |  Branch (568:7): [True: 46.7k, False: 1.42k]
  |  Branch (568:29): [True: 45.1k, False: 1.65k]
  |  Branch (568:51): [True: 42.0k, False: 3.08k]
  ------------------
  569|  42.0k|      coef_bits[4] == -1 && coef_bits[5] == -1 && coef_bits[6] == -1 &&
  ------------------
  |  Branch (569:7): [True: 41.0k, False: 1.01k]
  |  Branch (569:29): [True: 40.2k, False: 768]
  |  Branch (569:51): [True: 40.1k, False: 132]
  ------------------
  570|  40.1k|      coef_bits[7] == -1 && coef_bits[8] == -1 && coef_bits[9] == -1;
  ------------------
  |  Branch (570:7): [True: 39.8k, False: 231]
  |  Branch (570:29): [True: 39.2k, False: 654]
  |  Branch (570:51): [True: 39.2k, False: 0]
  ------------------
  571|       |
  572|  48.2k|    quanttbl = compptr->quant_table;
  573|  48.2k|    Q00 = quanttbl->quantval[0];
  574|  48.2k|    Q01 = quanttbl->quantval[Q01_POS];
  ------------------
  |  |  385|  48.2k|#define Q01_POS  1
  ------------------
  575|  48.2k|    Q10 = quanttbl->quantval[Q10_POS];
  ------------------
  |  |  386|  48.2k|#define Q10_POS  8
  ------------------
  576|  48.2k|    Q20 = quanttbl->quantval[Q20_POS];
  ------------------
  |  |  387|  48.2k|#define Q20_POS  16
  ------------------
  577|  48.2k|    Q11 = quanttbl->quantval[Q11_POS];
  ------------------
  |  |  388|  48.2k|#define Q11_POS  9
  ------------------
  578|  48.2k|    Q02 = quanttbl->quantval[Q02_POS];
  ------------------
  |  |  389|  48.2k|#define Q02_POS  2
  ------------------
  579|  48.2k|    if (change_dc) {
  ------------------
  |  Branch (579:9): [True: 39.2k, False: 8.96k]
  ------------------
  580|  39.2k|      Q03 = quanttbl->quantval[Q03_POS];
  ------------------
  |  |  390|  39.2k|#define Q03_POS  3
  ------------------
  581|  39.2k|      Q12 = quanttbl->quantval[Q12_POS];
  ------------------
  |  |  391|  39.2k|#define Q12_POS  10
  ------------------
  582|  39.2k|      Q21 = quanttbl->quantval[Q21_POS];
  ------------------
  |  |  392|  39.2k|#define Q21_POS  17
  ------------------
  583|  39.2k|      Q30 = quanttbl->quantval[Q30_POS];
  ------------------
  |  |  393|  39.2k|#define Q30_POS  24
  ------------------
  584|  39.2k|    }
  585|  48.2k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  48.2k|#define _inverse_DCT  inverse_DCT
  ------------------
  586|  48.2k|    output_ptr = output_buf[ci];
  587|       |    /* Loop over all DCT blocks to be processed. */
  588|  48.2k|    image_block_rows = block_rows * cinfo->total_iMCU_rows;
  589|   112k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (589:25): [True: 64.7k, False: 48.2k]
  ------------------
  590|  64.7k|      image_block_row = cinfo->output_iMCU_row * block_rows + block_row;
  591|  64.7k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  592|       |
  593|  64.7k|      if (image_block_row > 0)
  ------------------
  |  Branch (593:11): [True: 64.1k, False: 608]
  ------------------
  594|  64.1k|        prev_block_row =
  595|  64.1k|          buffer[block_row - 1] + cinfo->master->first_MCU_col[ci];
  596|    608|      else
  597|    608|        prev_block_row = buffer_ptr;
  598|       |
  599|  64.7k|      if (image_block_row > 1)
  ------------------
  |  Branch (599:11): [True: 63.5k, False: 1.13k]
  ------------------
  600|  63.5k|        prev_prev_block_row =
  601|  63.5k|          buffer[block_row - 2] + cinfo->master->first_MCU_col[ci];
  602|  1.13k|      else
  603|  1.13k|        prev_prev_block_row = prev_block_row;
  604|       |
  605|  64.7k|      if (image_block_row < image_block_rows - 1)
  ------------------
  |  Branch (605:11): [True: 64.1k, False: 608]
  ------------------
  606|  64.1k|        next_block_row =
  607|  64.1k|          buffer[block_row + 1] + cinfo->master->first_MCU_col[ci];
  608|    608|      else
  609|    608|        next_block_row = buffer_ptr;
  610|       |
  611|  64.7k|      if (image_block_row < image_block_rows - 2)
  ------------------
  |  Branch (611:11): [True: 63.7k, False: 968]
  ------------------
  612|  63.7k|        next_next_block_row =
  613|  63.7k|          buffer[block_row + 2] + cinfo->master->first_MCU_col[ci];
  614|    968|      else
  615|    968|        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|  64.7k|      DC01 = DC02 = DC03 = DC04 = DC05 = (int)prev_prev_block_row[0][0];
  621|  64.7k|      DC06 = DC07 = DC08 = DC09 = DC10 = (int)prev_block_row[0][0];
  622|  64.7k|      DC11 = DC12 = DC13 = DC14 = DC15 = (int)buffer_ptr[0][0];
  623|  64.7k|      DC16 = DC17 = DC18 = DC19 = DC20 = (int)next_block_row[0][0];
  624|  64.7k|      DC21 = DC22 = DC23 = DC24 = DC25 = (int)next_next_block_row[0][0];
  625|  64.7k|      output_col = 0;
  626|  64.7k|      last_block_column = compptr->width_in_blocks - 1;
  627|  64.7k|      for (block_num = cinfo->master->first_MCU_col[ci];
  628|  1.12M|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (628:12): [True: 1.06M, False: 64.7k]
  ------------------
  629|       |        /* Fetch current DCT block into workspace so we can modify it. */
  630|  1.06M|        jcopy_block_row(buffer_ptr, (JBLOCKROW)workspace, (JDIMENSION)1);
  631|       |        /* Update DC values */
  632|  1.06M|        if (block_num == cinfo->master->first_MCU_col[ci] &&
  ------------------
  |  Branch (632:13): [True: 64.7k, False: 998k]
  ------------------
  633|  64.7k|            block_num < last_block_column) {
  ------------------
  |  Branch (633:13): [True: 36.0k, False: 28.6k]
  ------------------
  634|  36.0k|          DC04 = DC05 = (int)prev_prev_block_row[1][0];
  635|  36.0k|          DC09 = DC10 = (int)prev_block_row[1][0];
  636|  36.0k|          DC14 = DC15 = (int)buffer_ptr[1][0];
  637|  36.0k|          DC19 = DC20 = (int)next_block_row[1][0];
  638|  36.0k|          DC24 = DC25 = (int)next_next_block_row[1][0];
  639|  36.0k|        }
  640|  1.06M|        if (block_num + 1 < last_block_column) {
  ------------------
  |  Branch (640:13): [True: 962k, False: 100k]
  ------------------
  641|   962k|          DC05 = (int)prev_prev_block_row[2][0];
  642|   962k|          DC10 = (int)prev_block_row[2][0];
  643|   962k|          DC15 = (int)buffer_ptr[2][0];
  644|   962k|          DC20 = (int)next_block_row[2][0];
  645|   962k|          DC25 = (int)next_next_block_row[2][0];
  646|   962k|        }
  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.06M|        if ((Al = coef_bits[1]) != 0 && workspace[1] == 0) {
  ------------------
  |  Branch (658:13): [True: 1.06M, False: 710]
  |  Branch (658:41): [True: 1.02M, False: 33.3k]
  ------------------
  659|  1.02M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (659:24): [True: 770k, False: 259k]
  ------------------
  660|   770k|                (-DC01 - DC02 + DC04 + DC05 - 3 * DC06 + 13 * DC07 -
  661|   770k|                 13 * DC09 + 3 * DC10 - 3 * DC11 + 38 * DC12 - 38 * DC14 +
  662|   770k|                 3 * DC15 - 3 * DC16 + 13 * DC17 - 13 * DC19 + 3 * DC20 -
  663|   770k|                 DC21 - DC22 + DC24 + DC25) :
  664|  1.02M|                (-7 * DC11 + 50 * DC12 - 50 * DC14 + 7 * DC15));
  665|  1.02M|          if (num >= 0) {
  ------------------
  |  Branch (665:15): [True: 635k, False: 393k]
  ------------------
  666|   635k|            pred = (int)(((Q01 << 7) + num) / (Q01 << 8));
  667|   635k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (667:17): [True: 30.7k, False: 605k]
  |  Branch (667:27): [True: 2.17k, False: 28.6k]
  ------------------
  668|  2.17k|              pred = (1 << Al) - 1;
  669|   635k|          } else {
  670|   393k|            pred = (int)(((Q01 << 7) - num) / (Q01 << 8));
  671|   393k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (671:17): [True: 15.2k, False: 378k]
  |  Branch (671:27): [True: 3.66k, False: 11.6k]
  ------------------
  672|  3.66k|              pred = (1 << Al) - 1;
  673|   393k|            pred = -pred;
  674|   393k|          }
  675|  1.02M|          workspace[1] = (JCOEF)pred;
  676|  1.02M|        }
  677|       |        /* AC10 */
  678|  1.06M|        if ((Al = coef_bits[2]) != 0 && workspace[8] == 0) {
  ------------------
  |  Branch (678:13): [True: 1.06M, False: 1.22k]
  |  Branch (678:41): [True: 989k, False: 72.9k]
  ------------------
  679|   989k|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (679:24): [True: 770k, False: 219k]
  ------------------
  680|   770k|                (-DC01 - 3 * DC02 - 3 * DC03 - 3 * DC04 - DC05 - DC06 +
  681|   770k|                 13 * DC07 + 38 * DC08 + 13 * DC09 - DC10 + DC16 -
  682|   770k|                 13 * DC17 - 38 * DC18 - 13 * DC19 + DC20 + DC21 +
  683|   770k|                 3 * DC22 + 3 * DC23 + 3 * DC24 + DC25) :
  684|   989k|                (-7 * DC03 + 50 * DC08 - 50 * DC18 + 7 * DC23));
  685|   989k|          if (num >= 0) {
  ------------------
  |  Branch (685:15): [True: 638k, False: 351k]
  ------------------
  686|   638k|            pred = (int)(((Q10 << 7) + num) / (Q10 << 8));
  687|   638k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (687:17): [True: 124k, False: 513k]
  |  Branch (687:27): [True: 42.3k, False: 82.3k]
  ------------------
  688|  42.3k|              pred = (1 << Al) - 1;
  689|   638k|          } else {
  690|   351k|            pred = (int)(((Q10 << 7) - num) / (Q10 << 8));
  691|   351k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (691:17): [True: 48.1k, False: 303k]
  |  Branch (691:27): [True: 23.3k, False: 24.8k]
  ------------------
  692|  23.3k|              pred = (1 << Al) - 1;
  693|   351k|            pred = -pred;
  694|   351k|          }
  695|   989k|          workspace[8] = (JCOEF)pred;
  696|   989k|        }
  697|       |        /* AC20 */
  698|  1.06M|        if ((Al = coef_bits[3]) != 0 && workspace[16] == 0) {
  ------------------
  |  Branch (698:13): [True: 1.06M, False: 2.38k]
  |  Branch (698:41): [True: 1.02M, False: 32.7k]
  ------------------
  699|  1.02M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (699:24): [True: 770k, False: 258k]
  ------------------
  700|   770k|                (DC03 + 2 * DC07 + 7 * DC08 + 2 * DC09 - 5 * DC12 - 14 * DC13 -
  701|   770k|                 5 * DC14 + 2 * DC17 + 7 * DC18 + 2 * DC19 + DC23) :
  702|  1.02M|                (-DC03 + 13 * DC08 - 24 * DC13 + 13 * DC18 - DC23));
  703|  1.02M|          if (num >= 0) {
  ------------------
  |  Branch (703:15): [True: 562k, False: 466k]
  ------------------
  704|   562k|            pred = (int)(((Q20 << 7) + num) / (Q20 << 8));
  705|   562k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (705:17): [True: 119k, False: 443k]
  |  Branch (705:27): [True: 25.4k, False: 93.6k]
  ------------------
  706|  25.4k|              pred = (1 << Al) - 1;
  707|   562k|          } else {
  708|   466k|            pred = (int)(((Q20 << 7) - num) / (Q20 << 8));
  709|   466k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (709:17): [True: 106k, False: 360k]
  |  Branch (709:27): [True: 27.9k, False: 78.0k]
  ------------------
  710|  27.9k|              pred = (1 << Al) - 1;
  711|   466k|            pred = -pred;
  712|   466k|          }
  713|  1.02M|          workspace[16] = (JCOEF)pred;
  714|  1.02M|        }
  715|       |        /* AC11 */
  716|  1.06M|        if ((Al = coef_bits[4]) != 0 && workspace[9] == 0) {
  ------------------
  |  Branch (716:13): [True: 1.05M, False: 9.78k]
  |  Branch (716:41): [True: 1.01M, False: 38.2k]
  ------------------
  717|  1.01M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (717:24): [True: 770k, False: 245k]
  ------------------
  718|   770k|                (-DC01 + DC05 + 9 * DC07 - 9 * DC09 - 9 * DC17 +
  719|   770k|                 9 * DC19 + DC21 - DC25) :
  720|  1.01M|                (DC10 + DC16 - 10 * DC17 + 10 * DC19 - DC02 - DC20 + DC22 -
  721|   245k|                 DC24 + DC04 - DC06 + 10 * DC07 - 10 * DC09));
  722|  1.01M|          if (num >= 0) {
  ------------------
  |  Branch (722:15): [True: 634k, False: 381k]
  ------------------
  723|   634k|            pred = (int)(((Q11 << 7) + num) / (Q11 << 8));
  724|   634k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (724:17): [True: 132k, False: 502k]
  |  Branch (724:27): [True: 2.28k, False: 129k]
  ------------------
  725|  2.28k|              pred = (1 << Al) - 1;
  726|   634k|          } else {
  727|   381k|            pred = (int)(((Q11 << 7) - num) / (Q11 << 8));
  728|   381k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (728:17): [True: 88.5k, False: 293k]
  |  Branch (728:27): [True: 2.26k, False: 86.2k]
  ------------------
  729|  2.26k|              pred = (1 << Al) - 1;
  730|   381k|            pred = -pred;
  731|   381k|          }
  732|  1.01M|          workspace[9] = (JCOEF)pred;
  733|  1.01M|        }
  734|       |        /* AC02 */
  735|  1.06M|        if ((Al = coef_bits[5]) != 0 && workspace[2] == 0) {
  ------------------
  |  Branch (735:13): [True: 1.04M, False: 15.3k]
  |  Branch (735:41): [True: 1.02M, False: 23.5k]
  ------------------
  736|  1.02M|          num = Q00 * (change_dc ?
  ------------------
  |  Branch (736:24): [True: 770k, False: 254k]
  ------------------
  737|   770k|                (2 * DC07 - 5 * DC08 + 2 * DC09 + DC11 + 7 * DC12 - 14 * DC13 +
  738|   770k|                 7 * DC14 + DC15 + 2 * DC17 - 5 * DC18 + 2 * DC19) :
  739|  1.02M|                (-DC11 + 13 * DC12 - 24 * DC13 + 13 * DC14 - DC15));
  740|  1.02M|          if (num >= 0) {
  ------------------
  |  Branch (740:15): [True: 583k, False: 441k]
  ------------------
  741|   583k|            pred = (int)(((Q02 << 7) + num) / (Q02 << 8));
  742|   583k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (742:17): [True: 141k, False: 441k]
  |  Branch (742:27): [True: 8.87k, False: 132k]
  ------------------
  743|  8.87k|              pred = (1 << Al) - 1;
  744|   583k|          } else {
  745|   441k|            pred = (int)(((Q02 << 7) - num) / (Q02 << 8));
  746|   441k|            if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (746:17): [True: 94.3k, False: 347k]
  |  Branch (746:27): [True: 8.45k, False: 85.9k]
  ------------------
  747|  8.45k|              pred = (1 << Al) - 1;
  748|   441k|            pred = -pred;
  749|   441k|          }
  750|  1.02M|          workspace[2] = (JCOEF)pred;
  751|  1.02M|        }
  752|  1.06M|        if (change_dc) {
  ------------------
  |  Branch (752:13): [True: 770k, False: 293k]
  ------------------
  753|       |          /* AC03 */
  754|   770k|          if ((Al = coef_bits[6]) != 0 && workspace[3] == 0) {
  ------------------
  |  Branch (754:15): [True: 770k, False: 0]
  |  Branch (754:43): [True: 770k, False: 0]
  ------------------
  755|   770k|            num = Q00 * (DC07 - DC09 + 2 * DC12 - 2 * DC14 + DC17 - DC19);
  756|   770k|            if (num >= 0) {
  ------------------
  |  Branch (756:17): [True: 479k, False: 290k]
  ------------------
  757|   479k|              pred = (int)(((Q03 << 7) + num) / (Q03 << 8));
  758|   479k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (758:19): [True: 0, False: 479k]
  |  Branch (758:29): [True: 0, False: 0]
  ------------------
  759|      0|                pred = (1 << Al) - 1;
  760|   479k|            } else {
  761|   290k|              pred = (int)(((Q03 << 7) - num) / (Q03 << 8));
  762|   290k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (762:19): [True: 0, False: 290k]
  |  Branch (762:29): [True: 0, False: 0]
  ------------------
  763|      0|                pred = (1 << Al) - 1;
  764|   290k|              pred = -pred;
  765|   290k|            }
  766|   770k|            workspace[3] = (JCOEF)pred;
  767|   770k|          }
  768|       |          /* AC12 */
  769|   770k|          if ((Al = coef_bits[7]) != 0 && workspace[10] == 0) {
  ------------------
  |  Branch (769:15): [True: 770k, False: 0]
  |  Branch (769:43): [True: 770k, False: 0]
  ------------------
  770|   770k|            num = Q00 * (DC07 - 3 * DC08 + DC09 - DC17 + 3 * DC18 - DC19);
  771|   770k|            if (num >= 0) {
  ------------------
  |  Branch (771:17): [True: 419k, False: 351k]
  ------------------
  772|   419k|              pred = (int)(((Q12 << 7) + num) / (Q12 << 8));
  773|   419k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (773:19): [True: 0, False: 419k]
  |  Branch (773:29): [True: 0, False: 0]
  ------------------
  774|      0|                pred = (1 << Al) - 1;
  775|   419k|            } else {
  776|   351k|              pred = (int)(((Q12 << 7) - num) / (Q12 << 8));
  777|   351k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (777:19): [True: 0, False: 351k]
  |  Branch (777:29): [True: 0, False: 0]
  ------------------
  778|      0|                pred = (1 << Al) - 1;
  779|   351k|              pred = -pred;
  780|   351k|            }
  781|   770k|            workspace[10] = (JCOEF)pred;
  782|   770k|          }
  783|       |          /* AC21 */
  784|   770k|          if ((Al = coef_bits[8]) != 0 && workspace[17] == 0) {
  ------------------
  |  Branch (784:15): [True: 770k, False: 0]
  |  Branch (784:43): [True: 770k, False: 0]
  ------------------
  785|   770k|            num = Q00 * (DC07 - DC09 - 3 * DC12 + 3 * DC14 + DC17 - DC19);
  786|   770k|            if (num >= 0) {
  ------------------
  |  Branch (786:17): [True: 410k, False: 359k]
  ------------------
  787|   410k|              pred = (int)(((Q21 << 7) + num) / (Q21 << 8));
  788|   410k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (788:19): [True: 0, False: 410k]
  |  Branch (788:29): [True: 0, False: 0]
  ------------------
  789|      0|                pred = (1 << Al) - 1;
  790|   410k|            } else {
  791|   359k|              pred = (int)(((Q21 << 7) - num) / (Q21 << 8));
  792|   359k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (792:19): [True: 0, False: 359k]
  |  Branch (792:29): [True: 0, False: 0]
  ------------------
  793|      0|                pred = (1 << Al) - 1;
  794|   359k|              pred = -pred;
  795|   359k|            }
  796|   770k|            workspace[17] = (JCOEF)pred;
  797|   770k|          }
  798|       |          /* AC30 */
  799|   770k|          if ((Al = coef_bits[9]) != 0 && workspace[24] == 0) {
  ------------------
  |  Branch (799:15): [True: 770k, False: 0]
  |  Branch (799:43): [True: 770k, False: 0]
  ------------------
  800|   770k|            num = Q00 * (DC07 + 2 * DC08 + DC09 - DC17 - 2 * DC18 - DC19);
  801|   770k|            if (num >= 0) {
  ------------------
  |  Branch (801:17): [True: 480k, False: 289k]
  ------------------
  802|   480k|              pred = (int)(((Q30 << 7) + num) / (Q30 << 8));
  803|   480k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (803:19): [True: 0, False: 480k]
  |  Branch (803:29): [True: 0, False: 0]
  ------------------
  804|      0|                pred = (1 << Al) - 1;
  805|   480k|            } else {
  806|   289k|              pred = (int)(((Q30 << 7) - num) / (Q30 << 8));
  807|   289k|              if (Al > 0 && pred >= (1 << Al))
  ------------------
  |  Branch (807:19): [True: 0, False: 289k]
  |  Branch (807:29): [True: 0, False: 0]
  ------------------
  808|      0|                pred = (1 << Al) - 1;
  809|   289k|              pred = -pred;
  810|   289k|            }
  811|   770k|            workspace[24] = (JCOEF)pred;
  812|   770k|          }
  813|       |          /* coef_bits[0] is non-negative.  Otherwise this function would not
  814|       |           * be called.
  815|       |           */
  816|   770k|          num = Q00 *
  817|   770k|                (-2 * DC01 - 6 * DC02 - 8 * DC03 - 6 * DC04 - 2 * DC05 -
  818|   770k|                 6 * DC06 + 6 * DC07 + 42 * DC08 + 6 * DC09 - 6 * DC10 -
  819|   770k|                 8 * DC11 + 42 * DC12 + 152 * DC13 + 42 * DC14 - 8 * DC15 -
  820|   770k|                 6 * DC16 + 6 * DC17 + 42 * DC18 + 6 * DC19 - 6 * DC20 -
  821|   770k|                 2 * DC21 - 6 * DC22 - 8 * DC23 - 6 * DC24 - 2 * DC25);
  822|   770k|          if (num >= 0) {
  ------------------
  |  Branch (822:15): [True: 344k, False: 425k]
  ------------------
  823|   344k|            pred = (int)(((Q00 << 7) + num) / (Q00 << 8));
  824|   425k|          } else {
  825|   425k|            pred = (int)(((Q00 << 7) - num) / (Q00 << 8));
  826|   425k|            pred = -pred;
  827|   425k|          }
  828|   770k|          workspace[0] = (JCOEF)pred;
  829|   770k|        }  /* change_dc */
  830|       |
  831|       |        /* OK, do the IDCT */
  832|       |#ifdef WITH_PROFILE
  833|       |        cinfo->master->start = getTime();
  834|       |#endif
  835|  1.06M|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)workspace, output_ptr,
  836|  1.06M|                        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.06M|        DC01 = DC02;  DC02 = DC03;  DC03 = DC04;  DC04 = DC05;
  843|  1.06M|        DC06 = DC07;  DC07 = DC08;  DC08 = DC09;  DC09 = DC10;
  844|  1.06M|        DC11 = DC12;  DC12 = DC13;  DC13 = DC14;  DC14 = DC15;
  845|  1.06M|        DC16 = DC17;  DC17 = DC18;  DC18 = DC19;  DC19 = DC20;
  846|  1.06M|        DC21 = DC22;  DC22 = DC23;  DC23 = DC24;  DC24 = DC25;
  847|  1.06M|        buffer_ptr++, prev_block_row++, next_block_row++,
  848|  1.06M|          prev_prev_block_row++, next_next_block_row++;
  849|  1.06M|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  1.06M|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  850|  1.06M|      }
  851|  64.7k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  64.7k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  852|  64.7k|    }
  853|  48.2k|  }
  854|       |
  855|  22.0k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (855:7): [True: 21.7k, False: 355]
  ------------------
  856|  21.7k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  21.7k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  857|    355|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    355|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  858|  22.0k|}
jdcoefct-8.c:consume_data:
  218|  96.9k|{
  219|  96.9k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  96.9k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  96.9k|  int blkn, ci, xindex, yindex, yoffset;
  222|  96.9k|  JDIMENSION start_col;
  223|  96.9k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  96.9k|  JBLOCKROW buffer_ptr;
  225|  96.9k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|   340k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 243k, False: 96.9k]
  ------------------
  229|   243k|    compptr = cinfo->cur_comp_info[ci];
  230|   243k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|   243k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|   243k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|   243k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|   243k|#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|   243k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|   210k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 113k, False: 96.9k]
  ------------------
  242|   113k|       yoffset++) {
  243|  2.36M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 2.24M, False: 113k]
  ------------------
  244|  2.24M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  2.24M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  5.36M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 3.11M, False: 2.24M]
  ------------------
  248|  3.11M|        compptr = cinfo->cur_comp_info[ci];
  249|  3.11M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  6.57M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 3.46M, False: 3.11M]
  ------------------
  251|  3.46M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  7.24M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 3.78M, False: 3.46M]
  ------------------
  253|  3.78M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  3.78M|          }
  255|  3.46M|        }
  256|  3.11M|      }
  257|  2.24M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 2.24M, False: 0]
  ------------------
  258|  2.24M|        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|  2.24M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 2.24M]
  ------------------
  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|  2.24M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|   113k|    coef->MCU_ctr = 0;
  282|   113k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  96.9k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 93.3k, False: 3.62k]
  ------------------
  285|  93.3k|    start_iMCU_row(cinfo);
  286|  93.3k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  93.3k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  93.3k|  }
  288|       |  /* Completed the scan */
  289|  3.62k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  3.62k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  3.62k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  96.9k|}
jdcoefct-8.c:decompress_data:
  304|  5.01k|{
  305|  5.01k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  306|  5.01k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  307|  5.01k|  JDIMENSION block_num;
  308|  5.01k|  int ci, block_row, block_rows;
  309|  5.01k|  JBLOCKARRAY buffer;
  310|  5.01k|  JBLOCKROW buffer_ptr;
  311|  5.01k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  5.01k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  312|  5.01k|  JDIMENSION output_col;
  313|  5.01k|  jpeg_component_info *compptr;
  314|  5.01k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  5.01k|#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|  5.01k|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (317:10): [True: 0, False: 5.01k]
  ------------------
  318|  5.01k|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (318:11): [True: 5.01k, False: 0]
  ------------------
  319|  5.01k|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (319:11): [True: 0, False: 5.01k]
  ------------------
  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|  18.5k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (325:44): [True: 13.5k, False: 5.01k]
  ------------------
  326|  13.5k|       ci++, compptr++) {
  327|       |    /* Don't bother to IDCT an uninteresting component. */
  328|  13.5k|    if (!compptr->component_needed)
  ------------------
  |  Branch (328:9): [True: 0, False: 13.5k]
  ------------------
  329|      0|      continue;
  330|       |    /* Align the virtual buffer for this component. */
  331|  13.5k|    buffer = (*cinfo->mem->access_virt_barray)
  332|  13.5k|      ((j_common_ptr)cinfo, coef->whole_image[ci],
  333|  13.5k|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  334|  13.5k|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|  13.5k|#define FALSE   0               /* values of boolean */
  ------------------
  335|       |    /* Count non-dummy DCT block rows in this iMCU row. */
  336|  13.5k|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (336:9): [True: 13.2k, False: 332]
  ------------------
  337|  13.2k|      block_rows = compptr->v_samp_factor;
  338|    332|    else {
  339|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  340|    332|      block_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  341|    332|      if (block_rows == 0) block_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (341:11): [True: 239, False: 93]
  ------------------
  342|    332|    }
  343|  13.5k|    inverse_DCT = cinfo->idct->_inverse_DCT[ci];
  ------------------
  |  |  263|  13.5k|#define _inverse_DCT  inverse_DCT
  ------------------
  344|  13.5k|    output_ptr = output_buf[ci];
  345|       |    /* Loop over all DCT blocks to be processed. */
  346|  31.4k|    for (block_row = 0; block_row < block_rows; block_row++) {
  ------------------
  |  Branch (346:25): [True: 17.8k, False: 13.5k]
  ------------------
  347|  17.8k|      buffer_ptr = buffer[block_row] + cinfo->master->first_MCU_col[ci];
  348|  17.8k|      output_col = 0;
  349|  17.8k|      for (block_num = cinfo->master->first_MCU_col[ci];
  350|   286k|           block_num <= cinfo->master->last_MCU_col[ci]; block_num++) {
  ------------------
  |  Branch (350:12): [True: 268k, False: 17.8k]
  ------------------
  351|       |#ifdef WITH_PROFILE
  352|       |        cinfo->master->start = getTime();
  353|       |#endif
  354|   268k|        (*inverse_DCT) (cinfo, compptr, (JCOEFPTR)buffer_ptr, output_ptr,
  355|   268k|                        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|   268k|        buffer_ptr++;
  361|   268k|        output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   268k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  362|   268k|      }
  363|  17.8k|      output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  17.8k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  364|  17.8k|    }
  365|  13.5k|  }
  366|       |
  367|  5.01k|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (367:7): [True: 4.89k, False: 125]
  ------------------
  368|  4.89k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  4.89k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  369|    125|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|    125|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  370|  5.01k|}
jdcoefct-8.c:decompress_onepass:
   90|  17.8k|{
   91|  17.8k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
   92|  17.8k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
   93|  17.8k|  JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
   94|  17.8k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
   95|  17.8k|  int blkn, ci, xindex, yindex, yoffset, useful_width;
   96|  17.8k|  _JSAMPARRAY output_ptr;
  ------------------
  |  |  230|  17.8k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   97|  17.8k|  JDIMENSION start_col, output_col;
   98|  17.8k|  jpeg_component_info *compptr;
   99|  17.8k|  _inverse_DCT_method_ptr inverse_DCT;
  ------------------
  |  |  262|  17.8k|#define _inverse_DCT_method_ptr  inverse_DCT_method_ptr
  ------------------
  100|       |
  101|       |  /* Loop to process as much as one whole iMCU row */
  102|  36.4k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (102:41): [True: 18.6k, False: 17.8k]
  ------------------
  103|  18.6k|       yoffset++) {
  104|   225k|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
  ------------------
  |  Branch (104:39): [True: 206k, False: 18.6k]
  ------------------
  105|   206k|         MCU_col_num++) {
  106|       |      /* Try to fetch an MCU.  Entropy decoder expects buffer to be zeroed. */
  107|   206k|      jzero_far((void *)coef->MCU_buffer[0],
  108|   206k|                (size_t)(cinfo->blocks_in_MCU * sizeof(JBLOCK)));
  109|   206k|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (109:11): [True: 206k, False: 0]
  ------------------
  110|   206k|        cinfo->master->last_good_iMCU_row = cinfo->input_iMCU_row;
  111|       |#ifdef WITH_PROFILE
  112|       |      cinfo->master->start = getTime();
  113|       |#endif
  114|   206k|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (114:11): [True: 0, False: 206k]
  ------------------
  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|   206k|      if (MCU_col_num >= cinfo->master->first_iMCU_col &&
  ------------------
  |  Branch (134:11): [True: 205k, False: 1.22k]
  ------------------
  135|   205k|          MCU_col_num <= cinfo->master->last_iMCU_col) {
  ------------------
  |  Branch (135:11): [True: 205k, 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|   205k|        blkn = 0;               /* index of current DCT block within MCU */
  142|   595k|        for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (142:22): [True: 389k, False: 205k]
  ------------------
  143|   389k|          compptr = cinfo->cur_comp_info[ci];
  144|       |          /* Don't bother to IDCT an uninteresting component. */
  145|   389k|          if (!compptr->component_needed) {
  ------------------
  |  Branch (145:15): [True: 0, False: 389k]
  ------------------
  146|      0|            blkn += compptr->MCU_blocks;
  147|      0|            continue;
  148|      0|          }
  149|   389k|          inverse_DCT = cinfo->idct->_inverse_DCT[compptr->component_index];
  ------------------
  |  |  263|   389k|#define _inverse_DCT  inverse_DCT
  ------------------
  150|   389k|          useful_width = (MCU_col_num < last_MCU_col) ?
  ------------------
  |  Branch (150:26): [True: 346k, False: 43.1k]
  ------------------
  151|   346k|                         compptr->MCU_width : compptr->last_col_width;
  152|   389k|          output_ptr = output_buf[compptr->component_index] +
  153|   389k|                       yoffset * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   389k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  154|   389k|          start_col = (MCU_col_num - cinfo->master->first_iMCU_col) *
  155|   389k|                      compptr->MCU_sample_width;
  156|  1.10M|          for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (156:28): [True: 719k, False: 389k]
  ------------------
  157|   719k|            if (cinfo->input_iMCU_row < last_iMCU_row ||
  ------------------
  |  Branch (157:17): [True: 455k, False: 264k]
  ------------------
  158|   562k|                yoffset + yindex < compptr->last_row_height) {
  ------------------
  |  Branch (158:17): [True: 107k, False: 156k]
  ------------------
  159|   562k|              output_col = start_col;
  160|  1.24M|              for (xindex = 0; xindex < useful_width; xindex++) {
  ------------------
  |  Branch (160:32): [True: 679k, False: 562k]
  ------------------
  161|       |#ifdef WITH_PROFILE
  162|       |                cinfo->master->start = getTime();
  163|       |#endif
  164|   679k|                (*inverse_DCT) (cinfo, compptr,
  165|   679k|                                (JCOEFPTR)coef->MCU_buffer[blkn + xindex],
  166|   679k|                                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|   679k|                output_col += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   679k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  173|   679k|              }
  174|   562k|            }
  175|   719k|            blkn += compptr->MCU_width;
  176|   719k|            output_ptr += compptr->_DCT_scaled_size;
  ------------------
  |  |   24|   719k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  177|   719k|          }
  178|   389k|        }
  179|   205k|      }
  180|   206k|    }
  181|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  182|  18.6k|    coef->MCU_ctr = 0;
  183|  18.6k|  }
  184|       |  /* Completed the iMCU row, advance counters for next one */
  185|  17.8k|  cinfo->output_iMCU_row++;
  186|  17.8k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (186:7): [True: 16.2k, False: 1.52k]
  ------------------
  187|  16.2k|    start_iMCU_row(cinfo);
  188|  16.2k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  16.2k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  189|  16.2k|  }
  190|       |  /* Completed the scan */
  191|  1.52k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  192|  1.52k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.52k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  193|  17.8k|}
j12init_d_coef_controller:
  869|    461|{
  870|    461|  my_coef_ptr coef;
  871|       |
  872|    461|  if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    461|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (872:7): [True: 0, False: 461]
  ------------------
  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|    461|  coef = (my_coef_ptr)
  876|    461|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    461|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  877|    461|                                sizeof(my_coef_controller));
  878|    461|  memset(coef, 0, sizeof(my_coef_controller));
  879|    461|  cinfo->coef = (struct jpeg_d_coef_controller *)coef;
  880|    461|  coef->pub.start_input_pass = start_input_pass;
  881|    461|  coef->pub.start_output_pass = start_output_pass;
  882|    461|#ifdef BLOCK_SMOOTHING_SUPPORTED
  883|    461|  coef->coef_bits_latch = NULL;
  884|    461|#endif
  885|       |
  886|       |  /* Create the coefficient buffer. */
  887|    461|  if (need_full_buffer) {
  ------------------
  |  Branch (887:7): [True: 443, False: 18]
  ------------------
  888|    443|#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|    443|    int ci, access_rows;
  893|    443|    jpeg_component_info *compptr;
  894|       |
  895|  1.74k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (895:46): [True: 1.30k, False: 443]
  ------------------
  896|  1.30k|         ci++, compptr++) {
  897|  1.30k|      access_rows = compptr->v_samp_factor;
  898|  1.30k|#ifdef BLOCK_SMOOTHING_SUPPORTED
  899|       |      /* If block smoothing could be used, need a bigger window */
  900|  1.30k|      if (cinfo->progressive_mode)
  ------------------
  |  Branch (900:11): [True: 1.27k, False: 27]
  ------------------
  901|  1.27k|        access_rows *= 5;
  902|  1.30k|#endif
  903|  1.30k|      coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
  904|  1.30k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  889|  1.30k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, TRUE,
  ------------------
  |  |  210|  1.30k|#define TRUE    1
  ------------------
  905|  1.30k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  906|  1.30k|                               (long)compptr->h_samp_factor),
  907|  1.30k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  908|  1.30k|                               (long)compptr->v_samp_factor),
  909|  1.30k|         (JDIMENSION)access_rows);
  910|  1.30k|    }
  911|    443|    coef->pub.consume_data = consume_data;
  912|    443|    coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|    443|#define _decompress_data  decompress_data_12
  ------------------
  913|    443|    coef->pub.coef_arrays = coef->whole_image; /* link to virtual arrays */
  914|       |#else
  915|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  916|       |#endif
  917|    443|  } else {
  918|       |    /* We only need a single-MCU buffer. */
  919|     18|    JBLOCKROW buffer;
  920|     18|    int i;
  921|       |
  922|     18|    buffer = (JBLOCKROW)
  923|     18|      (*cinfo->mem->alloc_large) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     18|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  924|     18|                                  D_MAX_BLOCKS_IN_MCU * sizeof(JBLOCK));
  ------------------
  |  |   82|     18|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  925|    198|    for (i = 0; i < D_MAX_BLOCKS_IN_MCU; i++) {
  ------------------
  |  |   82|    198|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (925:17): [True: 180, False: 18]
  ------------------
  926|    180|      coef->MCU_buffer[i] = buffer + i;
  927|    180|    }
  928|     18|    coef->pub.consume_data = dummy_consume_data;
  929|     18|    coef->pub._decompress_data = decompress_onepass;
  ------------------
  |  |  142|     18|#define _decompress_data  decompress_data_12
  ------------------
  930|     18|    coef->pub.coef_arrays = NULL; /* flag for no virtual arrays */
  931|     18|  }
  932|       |
  933|       |  /* Allocate the workspace buffer */
  934|    461|  coef->workspace = (JCOEF *)
  935|    461|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    461|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  936|    461|                                sizeof(JCOEF) * DCTSIZE2);
  ------------------
  |  |   67|    461|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  937|    461|}
jdcoefct-12.c:start_input_pass:
   50|  1.05k|{
   51|  1.05k|  cinfo->input_iMCU_row = 0;
   52|  1.05k|  start_iMCU_row(cinfo);
   53|  1.05k|}
jdcoefct-12.c:start_output_pass:
   62|    106|{
   63|    106|#ifdef BLOCK_SMOOTHING_SUPPORTED
   64|    106|  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|    106|  if (coef->pub.coef_arrays != NULL) {
  ------------------
  |  Branch (67:7): [True: 93, False: 13]
  ------------------
   68|     93|    if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
  ------------------
  |  Branch (68:9): [True: 93, False: 0]
  |  Branch (68:38): [True: 31, False: 62]
  ------------------
   69|     31|      coef->pub._decompress_data = decompress_smooth_data;
  ------------------
  |  |  142|     31|#define _decompress_data  decompress_data_12
  ------------------
   70|     62|    else
   71|     62|      coef->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     62|#define _decompress_data  decompress_data_12
  ------------------
   72|     93|  }
   73|    106|#endif
   74|    106|  cinfo->output_iMCU_row = 0;
   75|    106|}
jdcoefct-12.c:smoothing_ok:
  405|     93|{
  406|     93|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  407|     93|  boolean smoothing_useful = FALSE;
  ------------------
  |  |  207|     93|#define FALSE   0               /* values of boolean */
  ------------------
  408|     93|  int ci, coefi;
  409|     93|  jpeg_component_info *compptr;
  410|     93|  JQUANT_TBL *qtable;
  411|     93|  int *coef_bits, *prev_coef_bits;
  412|     93|  int *coef_bits_latch, *prev_coef_bits_latch;
  413|       |
  414|     93|  if (!cinfo->progressive_mode || cinfo->coef_bits == NULL)
  ------------------
  |  Branch (414:7): [True: 1, False: 92]
  |  Branch (414:35): [True: 0, False: 92]
  ------------------
  415|      1|    return FALSE;
  ------------------
  |  |  207|      1|#define FALSE   0               /* values of boolean */
  ------------------
  416|       |
  417|       |  /* Allocate latch area if not already done */
  418|     92|  if (coef->coef_bits_latch == NULL)
  ------------------
  |  Branch (418:7): [True: 92, False: 0]
  ------------------
  419|     92|    coef->coef_bits_latch = (int *)
  420|     92|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     92|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  421|     92|                                  cinfo->num_components * 2 *
  422|     92|                                  (SAVED_COEFS * sizeof(int)));
  ------------------
  |  |   58|     92|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  423|     92|  coef_bits_latch = coef->coef_bits_latch;
  424|     92|  prev_coef_bits_latch =
  425|     92|    &coef->coef_bits_latch[cinfo->num_components * SAVED_COEFS];
  ------------------
  |  |   58|     92|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  426|       |
  427|    196|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (427:44): [True: 164, False: 32]
  ------------------
  428|    164|       ci++, compptr++) {
  429|       |    /* All components' quantization values must already be latched. */
  430|    164|    if ((qtable = compptr->quant_table) == NULL)
  ------------------
  |  Branch (430:9): [True: 0, False: 164]
  ------------------
  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|    164|    if (qtable->quantval[0] == 0 ||
  ------------------
  |  Branch (433:9): [True: 6, False: 158]
  ------------------
  434|    158|        qtable->quantval[Q01_POS] == 0 ||
  ------------------
  |  |  385|    158|#define Q01_POS  1
  ------------------
  |  Branch (434:9): [True: 1, False: 157]
  ------------------
  435|    157|        qtable->quantval[Q10_POS] == 0 ||
  ------------------
  |  |  386|    157|#define Q10_POS  8
  ------------------
  |  Branch (435:9): [True: 10, False: 147]
  ------------------
  436|    147|        qtable->quantval[Q20_POS] == 0 ||
  ------------------
  |  |  387|    147|#define Q20_POS  16
  ------------------
  |  Branch (436:9): [True: 3, False: 144]
  ------------------
  437|    144|        qtable->quantval[Q11_POS] == 0 ||
  ------------------
  |  |  388|    144|#define Q11_POS  9
  ------------------
  |  Branch (437:9): [True: 1, False: 143]
  ------------------
  438|    143|        qtable->quantval[Q02_POS] == 0 ||
  ------------------
  |  |  389|    143|#define Q02_POS  2
  ------------------
  |  Branch (438:9): [True: 11, False: 132]
  ------------------
  439|    132|        qtable->quantval[Q03_POS] == 0 ||
  ------------------
  |  |  390|    132|#define Q03_POS  3
  ------------------
  |  Branch (439:9): [True: 7, False: 125]
  ------------------
  440|    125|        qtable->quantval[Q12_POS] == 0 ||
  ------------------
  |  |  391|    125|#define Q12_POS  10
  ------------------
  |  Branch (440:9): [True: 1, False: 124]
  ------------------
  441|    124|        qtable->quantval[Q21_POS] == 0 ||
  ------------------
  |  |  392|    124|#define Q21_POS  17
  ------------------
  |  Branch (441:9): [True: 7, False: 117]
  ------------------
  442|    117|        qtable->quantval[Q30_POS] == 0)
  ------------------
  |  |  393|    117|#define Q30_POS  24
  ------------------
  |  Branch (442:9): [True: 13, False: 104]
  ------------------
  443|     60|      return FALSE;
  ------------------
  |  |  207|     60|#define FALSE   0               /* values of boolean */
  ------------------
  444|       |    /* DC values must be at least partly known for all components. */
  445|    104|    coef_bits = cinfo->coef_bits[ci];
  446|    104|    prev_coef_bits = cinfo->coef_bits[ci + cinfo->num_components];
  447|    104|    if (coef_bits[0] < 0)
  ------------------
  |  Branch (447:9): [True: 0, False: 104]
  ------------------
  448|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  449|    104|    coef_bits_latch[0] = coef_bits[0];
  450|       |    /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
  451|  1.04k|    for (coefi = 1; coefi < SAVED_COEFS; coefi++) {
  ------------------
  |  |   58|  1.04k|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  |  Branch (451:21): [True: 936, False: 104]
  ------------------
  452|    936|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (452:11): [True: 243, False: 693]
  ------------------
  453|    243|        prev_coef_bits_latch[coefi] = prev_coef_bits[coefi];
  454|    693|      else
  455|    693|        prev_coef_bits_latch[coefi] = -1;
  456|    936|      coef_bits_latch[coefi] = coef_bits[coefi];
  457|    936|      if (coef_bits[coefi] != 0)
  ------------------
  |  Branch (457:11): [True: 896, False: 40]
  ------------------
  458|    896|        smoothing_useful = TRUE;
  ------------------
  |  |  210|    896|#define TRUE    1
  ------------------
  459|    936|    }
  460|    104|    coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    104|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  461|    104|    prev_coef_bits_latch += SAVED_COEFS;
  ------------------
  |  |   58|    104|#define SAVED_COEFS  10         /* we save coef_bits[0..9] */
  ------------------
  462|    104|  }
  463|       |
  464|     32|  return smoothing_useful;
  465|     92|}
jdcoefct-12.c:consume_data:
  218|  12.7k|{
  219|  12.7k|  my_coef_ptr coef = (my_coef_ptr)cinfo->coef;
  220|  12.7k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  221|  12.7k|  int blkn, ci, xindex, yindex, yoffset;
  222|  12.7k|  JDIMENSION start_col;
  223|  12.7k|  JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
  224|  12.7k|  JBLOCKROW buffer_ptr;
  225|  12.7k|  jpeg_component_info *compptr;
  226|       |
  227|       |  /* Align the virtual buffers for the components used in this scan. */
  228|  44.6k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (228:16): [True: 31.9k, False: 12.7k]
  ------------------
  229|  31.9k|    compptr = cinfo->cur_comp_info[ci];
  230|  31.9k|    buffer[ci] = (*cinfo->mem->access_virt_barray)
  231|  31.9k|      ((j_common_ptr)cinfo, coef->whole_image[compptr->component_index],
  232|  31.9k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  233|  31.9k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  31.9k|#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|  31.9k|  }
  239|       |
  240|       |  /* Loop to process one whole iMCU row */
  241|  28.7k|  for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (241:41): [True: 15.9k, False: 12.7k]
  ------------------
  242|  15.9k|       yoffset++) {
  243|  1.31M|    for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
  ------------------
  |  Branch (243:39): [True: 1.30M, False: 15.9k]
  ------------------
  244|  1.30M|         MCU_col_num++) {
  245|       |      /* Construct list of pointers to DCT blocks belonging to this MCU */
  246|  1.30M|      blkn = 0;                 /* index of current DCT block within MCU */
  247|  4.26M|      for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (247:20): [True: 2.96M, False: 1.30M]
  ------------------
  248|  2.96M|        compptr = cinfo->cur_comp_info[ci];
  249|  2.96M|        start_col = MCU_col_num * compptr->MCU_width;
  250|  7.35M|        for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
  ------------------
  |  Branch (250:26): [True: 4.39M, False: 2.96M]
  ------------------
  251|  4.39M|          buffer_ptr = buffer[ci][yindex + yoffset] + start_col;
  252|  9.80M|          for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
  ------------------
  |  Branch (252:28): [True: 5.41M, False: 4.39M]
  ------------------
  253|  5.41M|            coef->MCU_buffer[blkn++] = buffer_ptr++;
  254|  5.41M|          }
  255|  4.39M|        }
  256|  2.96M|      }
  257|  1.30M|      if (!cinfo->entropy->insufficient_data)
  ------------------
  |  Branch (257:11): [True: 1.30M, False: 0]
  ------------------
  258|  1.30M|        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|  1.30M|      if (!(*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
  ------------------
  |  Branch (263:11): [True: 0, False: 1.30M]
  ------------------
  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|  1.30M|    }
  280|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  281|  15.9k|    coef->MCU_ctr = 0;
  282|  15.9k|  }
  283|       |  /* Completed the iMCU row, advance counters for next one */
  284|  12.7k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (284:7): [True: 11.7k, False: 1.03k]
  ------------------
  285|  11.7k|    start_iMCU_row(cinfo);
  286|  11.7k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  11.7k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  287|  11.7k|  }
  288|       |  /* Completed the scan */
  289|  1.03k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  290|  1.03k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.03k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  291|  12.7k|}

jdcoefct-8.c:start_iMCU_row:
   68|   114k|{
   69|   114k|  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|   114k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 69.5k, False: 45.2k]
  ------------------
   76|  69.5k|    coef->MCU_rows_per_iMCU_row = 1;
   77|  69.5k|  } else {
   78|  45.2k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 42.9k, False: 2.33k]
  ------------------
   79|  42.9k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|  2.33k|    else
   81|  2.33k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  45.2k|  }
   83|       |
   84|   114k|  coef->MCU_ctr = 0;
   85|   114k|  coef->MCU_vert_offset = 0;
   86|   114k|}
jdcoefct-12.c:start_iMCU_row:
   68|  12.7k|{
   69|  12.7k|  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|  12.7k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (75:7): [True: 9.05k, False: 3.69k]
  ------------------
   76|  9.05k|    coef->MCU_rows_per_iMCU_row = 1;
   77|  9.05k|  } else {
   78|  3.69k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows - 1))
  ------------------
  |  Branch (78:9): [True: 3.33k, False: 356]
  ------------------
   79|  3.33k|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   80|    356|    else
   81|    356|      coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   82|  3.69k|  }
   83|       |
   84|  12.7k|  coef->MCU_ctr = 0;
   85|  12.7k|  coef->MCU_vert_offset = 0;
   86|  12.7k|}

jdcolor-8.c:ycc_rgb_convert:
   33|   237k|{
   34|   237k|#if BITS_IN_JSAMPLE != 16
   35|   237k|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
   36|   237k|  register int y, cb, cr;
   37|   237k|  register _JSAMPROW outptr;
   38|   237k|  register _JSAMPROW inptr0, inptr1, inptr2;
   39|   237k|  register JDIMENSION col;
   40|   237k|  JDIMENSION num_cols = cinfo->output_width;
   41|       |  /* copy these pointers into registers if possible */
   42|   237k|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
   43|   237k|  register int *Crrtab = cconvert->Cr_r_tab;
   44|   237k|  register int *Cbbtab = cconvert->Cb_b_tab;
   45|   237k|  register JLONG *Crgtab = cconvert->Cr_g_tab;
   46|   237k|  register JLONG *Cbgtab = cconvert->Cb_g_tab;
   47|   237k|  SHIFT_TEMPS
   48|       |
   49|   475k|  while (--num_rows >= 0) {
  ------------------
  |  Branch (49:10): [True: 237k, False: 237k]
  ------------------
   50|   237k|    inptr0 = input_buf[0][input_row];
   51|   237k|    inptr1 = input_buf[1][input_row];
   52|   237k|    inptr2 = input_buf[2][input_row];
   53|   237k|    input_row++;
   54|   237k|    outptr = *output_buf++;
   55|  13.8M|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (55:19): [True: 13.6M, False: 237k]
  ------------------
   56|  13.6M|      y  = inptr0[col];
   57|  13.6M|      cb = inptr1[col];
   58|  13.6M|      cr = inptr2[col];
   59|       |      /* Range-limiting is essential due to noise introduced by DCT losses. */
   60|  13.6M|      outptr[RGB_RED] =   range_limit[y + Crrtab[cr]];
  ------------------
  |  |  299|  13.6M|#define RGB_RED         0       /* Offset of Red in an RGB scanline element */
  ------------------
   61|  13.6M|      outptr[RGB_GREEN] = range_limit[y +
  ------------------
  |  |  300|  13.6M|#define RGB_GREEN       1       /* Offset of Green */
  ------------------
   62|  13.6M|                              ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  542|  13.6M|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
   63|  13.6M|                                                SCALEBITS))];
   64|  13.6M|      outptr[RGB_BLUE] =  range_limit[y + Cbbtab[cb]];
  ------------------
  |  |  301|  13.6M|#define RGB_BLUE        2       /* Offset of Blue */
  ------------------
   65|       |      /* Set unused byte to _MAXJSAMPLE so it can be interpreted as an */
   66|       |      /* opaque alpha channel value */
   67|       |#ifdef RGB_ALPHA
   68|       |      outptr[RGB_ALPHA] = _MAXJSAMPLE;
   69|       |#endif
   70|  13.6M|      outptr += RGB_PIXELSIZE;
  ------------------
  |  |  302|  13.6M|#define RGB_PIXELSIZE   3       /* JSAMPLEs per RGB scanline element */
  ------------------
   71|  13.6M|    }
   72|   237k|  }
   73|       |#else
   74|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
   75|       |#endif
   76|   237k|}

jinit_color_deconverter:
  625|  3.52k|{
  626|  3.52k|  my_cconvert_ptr cconvert;
  627|  3.52k|  int ci;
  628|       |
  629|  3.52k|#ifdef D_LOSSLESS_SUPPORTED
  630|  3.52k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 530, False: 2.99k]
  ------------------
  631|    530|#if BITS_IN_JSAMPLE == 8
  632|    530|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.06k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (632:9): [True: 0, False: 530]
  |  Branch (632:52): [True: 0, False: 530]
  ------------------
  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|    530|  } else
  639|  2.99k|#endif
  640|  2.99k|  {
  641|  2.99k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  2.99k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (641:9): [True: 0, False: 2.99k]
  ------------------
  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|  2.99k|  }
  644|       |
  645|  3.52k|  cconvert = (my_cconvert_ptr)
  646|  3.52k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.52k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|  3.52k|                                sizeof(my_color_deconverter));
  648|  3.52k|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|  3.52k|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|  3.52k|  switch (cinfo->jpeg_color_space) {
  653|  1.02k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 1.02k, False: 2.50k]
  ------------------
  654|  1.02k|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 1.02k]
  ------------------
  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.02k|    break;
  657|       |
  658|    864|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 864, False: 2.66k]
  ------------------
  659|  2.28k|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 1.41k, False: 2.10k]
  ------------------
  660|  2.28k|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 2.28k]
  ------------------
  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|  2.28k|    break;
  663|       |
  664|    194|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 194, False: 3.33k]
  ------------------
  665|    220|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 26, False: 3.49k]
  ------------------
  666|    220|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 220]
  ------------------
  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|    220|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 3.52k]
  ------------------
  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|  3.52k|  }
  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|  3.52k|  switch (cinfo->out_color_space) {
  684|  1.02k|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 1.02k, False: 2.50k]
  ------------------
  685|  1.02k|#ifdef D_LOSSLESS_SUPPORTED
  686|  1.02k|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 4, False: 1.01k]
  ------------------
  687|      4|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 4]
  ------------------
  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.02k|#endif
  690|  1.02k|    cinfo->out_color_components = 1;
  691|  1.02k|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 1.02k, False: 0]
  ------------------
  692|  1.02k|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|  1.02k|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |  267|  1.02k|#define _color_convert  color_convert
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|  1.02k|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 1.02k]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|  1.02k|    } 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.02k|    break;
  703|       |
  704|  2.28k|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 2.28k, False: 1.24k]
  ------------------
  705|  2.28k|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 3.52k]
  ------------------
  706|  2.28k|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 3.52k]
  ------------------
  707|  2.28k|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 3.52k]
  ------------------
  708|  2.28k|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 3.52k]
  ------------------
  709|  2.28k|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 3.52k]
  ------------------
  710|  2.28k|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 3.52k]
  ------------------
  711|  2.28k|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 3.52k]
  ------------------
  712|  2.28k|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 3.52k]
  ------------------
  713|  2.28k|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 3.52k]
  ------------------
  714|  2.28k|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 3.52k]
  ------------------
  715|  2.28k|#ifdef D_LOSSLESS_SUPPORTED
  716|  2.28k|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 482, False: 1.80k]
  |  Branch (716:36): [True: 1, False: 481]
  ------------------
  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|  2.28k|#endif
  719|  2.28k|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|  2.28k|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 1.41k, False: 865]
  ------------------
  721|  1.41k|#ifdef WITH_SIMD
  722|  1.41k|      if (jsimd_set_ycc_rgb(cinfo))
  ------------------
  |  Branch (722:11): [True: 0, False: 1.41k]
  ------------------
  723|      0|        cconvert->pub._color_convert = jsimd_color_deconvert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  724|  1.41k|      else
  725|  1.41k|#endif
  726|  1.41k|      {
  727|  1.41k|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 1.41k]
  ------------------
  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: 1.41k]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 1.41k]
  ------------------
  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: 1.41k]
  ------------------
  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: 1.41k]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 1.41k]
  ------------------
  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: 1.41k]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 1.41k]
  ------------------
  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: 1.41k]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 1.41k]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  267|      0|#define _color_convert  color_convert
  ------------------
  749|      0|          break;
  750|  1.41k|        default:
  ------------------
  |  Branch (750:9): [True: 1.41k, False: 0]
  ------------------
  751|  1.41k|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  267|  1.41k|#define _color_convert  color_convert
  ------------------
  752|  1.41k|        }
  753|  1.41k|        build_ycc_rgb_table(cinfo);
  754|  1.41k|      }
  755|  1.41k|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 865]
  ------------------
  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|    865|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 864, False: 1]
  ------------------
  783|    864|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 864, False: 0]
  ------------------
  784|    864|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 864, False: 0]
  ------------------
  785|    864|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 864, False: 0]
  ------------------
  786|    864|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 864, False: 0]
  ------------------
  787|    864|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|    864|#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|    864|    } 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|  2.28k|    break;
  819|       |
  820|  2.28k|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 3.52k]
  ------------------
  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|    220|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 220, False: 3.30k]
  ------------------
  858|    220|#ifdef D_LOSSLESS_SUPPORTED
  859|    220|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 44, False: 176]
  ------------------
  860|     44|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 1, False: 43]
  ------------------
  861|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|    220|#endif
  863|    220|    cinfo->out_color_components = 4;
  864|    220|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 25, False: 195]
  ------------------
  865|     25|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  267|     25|#define _color_convert  color_convert
  ------------------
  866|     25|      build_ycc_rgb_table(cinfo);
  867|    195|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 194, False: 1]
  ------------------
  868|    194|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  267|    194|#define _color_convert  color_convert
  ------------------
  869|    194|    } else
  870|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|    220|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 3.52k]
  ------------------
  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|  3.52k|  }
  882|       |
  883|  3.52k|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 3.52k]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|  3.52k|  else
  886|  3.52k|    cinfo->output_components = cinfo->out_color_components;
  887|  3.52k|}
jdcolor-8.c:start_pass_dcolor:
  614|  2.15k|{
  615|       |  /* no work needed */
  616|  2.15k|}
jdcolor-8.c:grayscale_convert:
  397|   142k|{
  398|   142k|  _jcopy_sample_rows(input_buf[0], (int)input_row, output_buf, 0, num_rows,
  ------------------
  |  |  297|   142k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  399|   142k|                     cinfo->output_width);
  400|   142k|}
jdcolor-8.c:build_ycc_rgb_table:
  218|  1.44k|{
  219|  1.44k|#if BITS_IN_JSAMPLE != 16
  220|  1.44k|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|  1.44k|  int i;
  222|  1.44k|  JLONG x;
  223|  1.44k|  SHIFT_TEMPS
  224|       |
  225|  1.44k|  cconvert->Cr_r_tab = (int *)
  226|  1.44k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.44k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|  1.44k|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|  1.44k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.44k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  228|  1.44k|  cconvert->Cb_b_tab = (int *)
  229|  1.44k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.44k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|  1.44k|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  226|  1.44k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.44k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  231|  1.44k|  cconvert->Cr_g_tab = (JLONG *)
  232|  1.44k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.44k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|  1.44k|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|  1.44k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.44k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  234|  1.44k|  cconvert->Cb_g_tab = (JLONG *)
  235|  1.44k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.44k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|  1.44k|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  226|  1.44k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.44k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  237|       |
  238|   370k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  227|  1.44k|#define _CENTERJSAMPLE   CENTERJSAMPLE
  |  |  ------------------
  |  |  |  |   53|  1.44k|#define CENTERJSAMPLE    128
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  226|   370k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|   370k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 369k, False: 1.44k]
  ------------------
  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|   369k|    cconvert->Cr_r_tab[i] = (int)
  243|   369k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|   369k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|   369k|    cconvert->Cb_b_tab[i] = (int)
  246|   369k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|   369k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|   369k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|   369k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|   369k|#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|   369k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|   369k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|   369k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|   369k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|   369k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|   369k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|  1.44k|}
jdcolor-8.c:null_convert:
  336|   284k|{
  337|   284k|  register _JSAMPROW inptr, inptr0, inptr1, inptr2, inptr3, outptr;
  338|   284k|  register JDIMENSION col;
  339|   284k|  register int num_components = cinfo->num_components;
  340|   284k|  JDIMENSION num_cols = cinfo->output_width;
  341|   284k|  int ci;
  342|       |
  343|   284k|  if (num_components == 3) {
  ------------------
  |  Branch (343:7): [True: 263k, False: 21.5k]
  ------------------
  344|   526k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (344:12): [True: 263k, False: 263k]
  ------------------
  345|   263k|      inptr0 = input_buf[0][input_row];
  346|   263k|      inptr1 = input_buf[1][input_row];
  347|   263k|      inptr2 = input_buf[2][input_row];
  348|   263k|      input_row++;
  349|   263k|      outptr = *output_buf++;
  350|  16.0M|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (350:21): [True: 15.8M, False: 263k]
  ------------------
  351|  15.8M|        *outptr++ = inptr0[col];
  352|  15.8M|        *outptr++ = inptr1[col];
  353|  15.8M|        *outptr++ = inptr2[col];
  354|  15.8M|      }
  355|   263k|    }
  356|   263k|  } else if (num_components == 4) {
  ------------------
  |  Branch (356:14): [True: 21.5k, False: 0]
  ------------------
  357|  43.1k|    while (--num_rows >= 0) {
  ------------------
  |  Branch (357:12): [True: 21.5k, False: 21.5k]
  ------------------
  358|  21.5k|      inptr0 = input_buf[0][input_row];
  359|  21.5k|      inptr1 = input_buf[1][input_row];
  360|  21.5k|      inptr2 = input_buf[2][input_row];
  361|  21.5k|      inptr3 = input_buf[3][input_row];
  362|  21.5k|      input_row++;
  363|  21.5k|      outptr = *output_buf++;
  364|   645k|      for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (364:21): [True: 623k, False: 21.5k]
  ------------------
  365|   623k|        *outptr++ = inptr0[col];
  366|   623k|        *outptr++ = inptr1[col];
  367|   623k|        *outptr++ = inptr2[col];
  368|   623k|        *outptr++ = inptr3[col];
  369|   623k|      }
  370|  21.5k|    }
  371|  21.5k|  } else {
  372|      0|    while (--num_rows >= 0) {
  ------------------
  |  Branch (372:12): [True: 0, False: 0]
  ------------------
  373|      0|      for (ci = 0; ci < num_components; ci++) {
  ------------------
  |  Branch (373:20): [True: 0, False: 0]
  ------------------
  374|      0|        inptr = input_buf[ci][input_row];
  375|      0|        outptr = *output_buf;
  376|      0|        for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (376:23): [True: 0, False: 0]
  ------------------
  377|      0|          outptr[ci] = inptr[col];
  378|      0|          outptr += num_components;
  379|      0|        }
  380|      0|      }
  381|      0|      output_buf++;
  382|      0|      input_row++;
  383|      0|    }
  384|      0|  }
  385|   284k|}
jdcolor-8.c:ycck_cmyk_convert:
  413|    739|{
  414|    739|#if BITS_IN_JSAMPLE != 16
  415|    739|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  416|    739|  register int y, cb, cr;
  417|    739|  register _JSAMPROW outptr;
  418|    739|  register _JSAMPROW inptr0, inptr1, inptr2, inptr3;
  419|    739|  register JDIMENSION col;
  420|    739|  JDIMENSION num_cols = cinfo->output_width;
  421|       |  /* copy these pointers into registers if possible */
  422|    739|  register _JSAMPLE *range_limit = (_JSAMPLE *)cinfo->sample_range_limit;
  423|    739|  register int *Crrtab = cconvert->Cr_r_tab;
  424|    739|  register int *Cbbtab = cconvert->Cb_b_tab;
  425|    739|  register JLONG *Crgtab = cconvert->Cr_g_tab;
  426|    739|  register JLONG *Cbgtab = cconvert->Cb_g_tab;
  427|    739|  SHIFT_TEMPS
  428|       |
  429|  1.47k|  while (--num_rows >= 0) {
  ------------------
  |  Branch (429:10): [True: 739, False: 739]
  ------------------
  430|    739|    inptr0 = input_buf[0][input_row];
  431|    739|    inptr1 = input_buf[1][input_row];
  432|    739|    inptr2 = input_buf[2][input_row];
  433|    739|    inptr3 = input_buf[3][input_row];
  434|    739|    input_row++;
  435|    739|    outptr = *output_buf++;
  436|  2.43k|    for (col = 0; col < num_cols; col++) {
  ------------------
  |  Branch (436:19): [True: 1.70k, False: 739]
  ------------------
  437|  1.70k|      y  = inptr0[col];
  438|  1.70k|      cb = inptr1[col];
  439|  1.70k|      cr = inptr2[col];
  440|       |      /* Range-limiting is essential due to noise introduced by DCT losses. */
  441|  1.70k|      outptr[0] = range_limit[_MAXJSAMPLE - (y + Crrtab[cr])];  /* red */
  ------------------
  |  |  226|  1.70k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.70k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  442|  1.70k|      outptr[1] = range_limit[_MAXJSAMPLE - (y +                /* green */
  ------------------
  |  |  226|  1.70k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.70k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  443|  1.70k|                              ((int)RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
  ------------------
  |  |  542|  1.70k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  444|  1.70k|                                                 SCALEBITS)))];
  445|  1.70k|      outptr[2] = range_limit[_MAXJSAMPLE - (y + Cbbtab[cb])];  /* blue */
  ------------------
  |  |  226|  1.70k|#define _MAXJSAMPLE  MAXJSAMPLE
  |  |  ------------------
  |  |  |  |   52|  1.70k|#define MAXJSAMPLE       255
  |  |  ------------------
  ------------------
  446|       |      /* K passes through unchanged */
  447|  1.70k|      outptr[3] = inptr3[col];
  448|  1.70k|      outptr += 4;
  449|  1.70k|    }
  450|    739|  }
  451|       |#else
  452|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  453|       |#endif
  454|    739|}
j12init_color_deconverter:
  625|    920|{
  626|    920|  my_cconvert_ptr cconvert;
  627|    920|  int ci;
  628|       |
  629|    920|#ifdef D_LOSSLESS_SUPPORTED
  630|    920|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 459, False: 461]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|    459|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    918|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (634:9): [True: 0, False: 459]
  ------------------
  635|    459|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    459|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (635:9): [True: 0, False: 459]
  ------------------
  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|    459|  } else
  639|    461|#endif
  640|    461|  {
  641|    461|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    461|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (641:9): [True: 0, False: 461]
  ------------------
  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|    461|  }
  644|       |
  645|    920|  cconvert = (my_cconvert_ptr)
  646|    920|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    920|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|    920|                                sizeof(my_color_deconverter));
  648|    920|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|    920|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|    920|  switch (cinfo->jpeg_color_space) {
  653|     59|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 59, False: 861]
  ------------------
  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|    655|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 655, False: 265]
  ------------------
  659|    730|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 75, False: 845]
  ------------------
  660|    730|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 730]
  ------------------
  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|    730|    break;
  663|       |
  664|    120|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 120, False: 800]
  ------------------
  665|    131|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 11, False: 909]
  ------------------
  666|    131|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 131]
  ------------------
  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|    131|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 920]
  ------------------
  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|    920|  }
  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|    920|  switch (cinfo->out_color_space) {
  684|     59|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 59, False: 861]
  ------------------
  685|     59|#ifdef D_LOSSLESS_SUPPORTED
  686|     59|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 7, False: 52]
  ------------------
  687|      7|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 7]
  ------------------
  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|    730|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 730, False: 190]
  ------------------
  705|    730|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 920]
  ------------------
  706|    730|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 920]
  ------------------
  707|    730|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 920]
  ------------------
  708|    730|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 920]
  ------------------
  709|    730|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 920]
  ------------------
  710|    730|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 920]
  ------------------
  711|    730|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 920]
  ------------------
  712|    730|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 920]
  ------------------
  713|    730|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 920]
  ------------------
  714|    730|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 920]
  ------------------
  715|    730|#ifdef D_LOSSLESS_SUPPORTED
  716|    730|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 412, False: 318]
  |  Branch (716:36): [True: 1, False: 411]
  ------------------
  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|    730|#endif
  719|    730|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|    730|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 74, False: 656]
  ------------------
  721|       |#ifdef WITH_SIMD
  722|       |      if (jsimd_set_ycc_rgb(cinfo))
  723|       |        cconvert->pub._color_convert = jsimd_color_deconvert;
  724|       |      else
  725|       |#endif
  726|     74|      {
  727|     74|        switch (cinfo->out_color_space) {
  728|      0|        case JCS_EXT_RGB:
  ------------------
  |  Branch (728:9): [True: 0, False: 74]
  ------------------
  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: 74]
  ------------------
  732|      0|        case JCS_EXT_RGBA:
  ------------------
  |  Branch (732:9): [True: 0, False: 74]
  ------------------
  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: 74]
  ------------------
  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: 74]
  ------------------
  739|      0|        case JCS_EXT_BGRA:
  ------------------
  |  Branch (739:9): [True: 0, False: 74]
  ------------------
  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: 74]
  ------------------
  743|      0|        case JCS_EXT_ABGR:
  ------------------
  |  Branch (743:9): [True: 0, False: 74]
  ------------------
  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: 74]
  ------------------
  747|      0|        case JCS_EXT_ARGB:
  ------------------
  |  Branch (747:9): [True: 0, False: 74]
  ------------------
  748|      0|          cconvert->pub._color_convert = ycc_extxrgb_convert;
  ------------------
  |  |  151|      0|#define _color_convert  color_convert_12
  ------------------
  749|      0|          break;
  750|     74|        default:
  ------------------
  |  Branch (750:9): [True: 74, False: 0]
  ------------------
  751|     74|          cconvert->pub._color_convert = ycc_rgb_convert;
  ------------------
  |  |  151|     74|#define _color_convert  color_convert_12
  ------------------
  752|     74|        }
  753|     74|        build_ycc_rgb_table(cinfo);
  754|     74|      }
  755|    656|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 656]
  ------------------
  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|    656|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 655, False: 1]
  ------------------
  783|    655|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 655, False: 0]
  ------------------
  784|    655|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 655, False: 0]
  ------------------
  785|    655|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 655, False: 0]
  ------------------
  786|    655|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 655, False: 0]
  ------------------
  787|    655|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|    655|#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|    655|    } 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|    730|    break;
  819|       |
  820|    730|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 920]
  ------------------
  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|    131|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 131, False: 789]
  ------------------
  858|    131|#ifdef D_LOSSLESS_SUPPORTED
  859|    131|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 40, False: 91]
  ------------------
  860|     40|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 10, False: 30]
  ------------------
  861|     10|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|    131|#endif
  863|    131|    cinfo->out_color_components = 4;
  864|    131|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 1, False: 130]
  ------------------
  865|      1|      cconvert->pub._color_convert = ycck_cmyk_convert;
  ------------------
  |  |  151|      1|#define _color_convert  color_convert_12
  ------------------
  866|      1|      build_ycc_rgb_table(cinfo);
  867|    130|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 120, False: 10]
  ------------------
  868|    120|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |  151|    120|#define _color_convert  color_convert_12
  ------------------
  869|    120|    } else
  870|     10|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     10|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|    131|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 920]
  ------------------
  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|    920|  }
  882|       |
  883|    909|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 909]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|    909|  else
  886|    909|    cinfo->output_components = cinfo->out_color_components;
  887|    909|}
jdcolor-12.c:start_pass_dcolor:
  614|    112|{
  615|       |  /* no work needed */
  616|    112|}
jdcolor-12.c:build_ycc_rgb_table:
  218|     75|{
  219|     75|#if BITS_IN_JSAMPLE != 16
  220|     75|  my_cconvert_ptr cconvert = (my_cconvert_ptr)cinfo->cconvert;
  221|     75|  int i;
  222|     75|  JLONG x;
  223|     75|  SHIFT_TEMPS
  224|       |
  225|     75|  cconvert->Cr_r_tab = (int *)
  226|     75|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     75|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  227|     75|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|     75|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     75|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  228|     75|  cconvert->Cb_b_tab = (int *)
  229|     75|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     75|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  230|     75|                                (_MAXJSAMPLE + 1) * sizeof(int));
  ------------------
  |  |  110|     75|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     75|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  231|     75|  cconvert->Cr_g_tab = (JLONG *)
  232|     75|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     75|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  233|     75|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|     75|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     75|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  234|     75|  cconvert->Cb_g_tab = (JLONG *)
  235|     75|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|     75|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  236|     75|                                (_MAXJSAMPLE + 1) * sizeof(JLONG));
  ------------------
  |  |  110|     75|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|     75|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  237|       |
  238|   307k|  for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  111|     75|#define _CENTERJSAMPLE   CENTERJ12SAMPLE
  |  |  ------------------
  |  |  |  |   61|     75|#define CENTERJ12SAMPLE  2048
  |  |  ------------------
  ------------------
                for (i = 0, x = -_CENTERJSAMPLE; i <= _MAXJSAMPLE; i++, x++) {
  ------------------
  |  |  110|   307k|#define _MAXJSAMPLE  MAXJ12SAMPLE
  |  |  ------------------
  |  |  |  |   60|   307k|#define MAXJ12SAMPLE     4095
  |  |  ------------------
  ------------------
  |  Branch (238:36): [True: 307k, False: 75]
  ------------------
  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|   307k|    cconvert->Cr_r_tab[i] = (int)
  243|   307k|                    RIGHT_SHIFT(FIX(1.40200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|   307k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  244|       |    /* Cb=>B value is nearest int to 1.77200 * x */
  245|   307k|    cconvert->Cb_b_tab[i] = (int)
  246|   307k|                    RIGHT_SHIFT(FIX(1.77200) * x + ONE_HALF, SCALEBITS);
  ------------------
  |  |  542|   307k|#define RIGHT_SHIFT(x, shft)    ((x) >> (shft))
  ------------------
  247|       |    /* Cr=>G value is scaled-up -0.71414 * x */
  248|   307k|    cconvert->Cr_g_tab[i] = (-FIX(0.71414)) * x;
  ------------------
  |  |   84|   307k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|   307k|#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|   307k|    cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   84|   307k|#define FIX(x)          ((JLONG)((x) * (1L << SCALEBITS) + 0.5))
  |  |  ------------------
  |  |  |  |   82|   307k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
                  cconvert->Cb_g_tab[i] = (-FIX(0.34414)) * x + ONE_HALF;
  ------------------
  |  |   83|   307k|#define ONE_HALF        ((JLONG)1 << (SCALEBITS - 1))
  |  |  ------------------
  |  |  |  |   82|   307k|#define SCALEBITS       16      /* speediest right-shift on some machines */
  |  |  ------------------
  ------------------
  252|   307k|  }
  253|       |#else
  254|       |  ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  255|       |#endif
  256|     75|}
j16init_color_deconverter:
  625|    459|{
  626|    459|  my_cconvert_ptr cconvert;
  627|    459|  int ci;
  628|       |
  629|    459|#ifdef D_LOSSLESS_SUPPORTED
  630|    459|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (630:7): [True: 459, False: 0]
  ------------------
  631|       |#if BITS_IN_JSAMPLE == 8
  632|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  633|       |#else
  634|    459|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    918|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (634:9): [True: 0, False: 459]
  ------------------
  635|    459|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    459|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (635:9): [True: 0, False: 459]
  ------------------
  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|    459|  } 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|    459|  cconvert = (my_cconvert_ptr)
  646|    459|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    459|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  647|    459|                                sizeof(my_color_deconverter));
  648|    459|  cinfo->cconvert = (struct jpeg_color_deconverter *)cconvert;
  649|    459|  cconvert->pub.start_pass = start_pass_dcolor;
  650|       |
  651|       |  /* Make sure num_components agrees with jpeg_color_space */
  652|    459|  switch (cinfo->jpeg_color_space) {
  653|      1|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (653:3): [True: 1, False: 458]
  ------------------
  654|      1|    if (cinfo->num_components != 1)
  ------------------
  |  Branch (654:9): [True: 0, False: 1]
  ------------------
  655|      0|      ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  656|      1|    break;
  657|       |
  658|    447|  case JCS_RGB:
  ------------------
  |  Branch (658:3): [True: 447, False: 12]
  ------------------
  659|    448|  case JCS_YCbCr:
  ------------------
  |  Branch (659:3): [True: 1, False: 458]
  ------------------
  660|    448|    if (cinfo->num_components != 3)
  ------------------
  |  Branch (660:9): [True: 0, False: 448]
  ------------------
  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|    448|    break;
  663|       |
  664|      9|  case JCS_CMYK:
  ------------------
  |  Branch (664:3): [True: 9, False: 450]
  ------------------
  665|     10|  case JCS_YCCK:
  ------------------
  |  Branch (665:3): [True: 1, False: 458]
  ------------------
  666|     10|    if (cinfo->num_components != 4)
  ------------------
  |  Branch (666:9): [True: 0, False: 10]
  ------------------
  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|     10|    break;
  669|       |
  670|      0|  default:                      /* JCS_UNKNOWN can be anything */
  ------------------
  |  Branch (670:3): [True: 0, False: 459]
  ------------------
  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|    459|  }
  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|    459|  switch (cinfo->out_color_space) {
  684|      1|  case JCS_GRAYSCALE:
  ------------------
  |  Branch (684:3): [True: 1, False: 458]
  ------------------
  685|      1|#ifdef D_LOSSLESS_SUPPORTED
  686|      1|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (686:9): [True: 1, False: 0]
  ------------------
  687|      1|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (687:9): [True: 0, False: 1]
  ------------------
  688|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  689|      1|#endif
  690|      1|    cinfo->out_color_components = 1;
  691|      1|    if (cinfo->jpeg_color_space == JCS_GRAYSCALE ||
  ------------------
  |  Branch (691:9): [True: 1, False: 0]
  ------------------
  692|      1|        cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (692:9): [True: 0, False: 0]
  ------------------
  693|      1|      cconvert->pub._color_convert = grayscale_convert;
  ------------------
  |  |   59|      1|#define _color_convert  color_convert_16
  ------------------
  694|       |      /* For color->grayscale conversion, only the Y (0) component is needed */
  695|      1|      for (ci = 1; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (695:20): [True: 0, False: 1]
  ------------------
  696|      0|        cinfo->comp_info[ci].component_needed = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  697|      1|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (697:16): [True: 0, False: 0]
  ------------------
  698|      0|      cconvert->pub._color_convert = rgb_gray_convert;
  ------------------
  |  |   59|      0|#define _color_convert  color_convert_16
  ------------------
  699|      0|      build_rgb_y_table(cinfo);
  700|      0|    } else
  701|      0|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  702|      1|    break;
  703|       |
  704|    448|  case JCS_RGB:
  ------------------
  |  Branch (704:3): [True: 448, False: 11]
  ------------------
  705|    448|  case JCS_EXT_RGB:
  ------------------
  |  Branch (705:3): [True: 0, False: 459]
  ------------------
  706|    448|  case JCS_EXT_RGBX:
  ------------------
  |  Branch (706:3): [True: 0, False: 459]
  ------------------
  707|    448|  case JCS_EXT_BGR:
  ------------------
  |  Branch (707:3): [True: 0, False: 459]
  ------------------
  708|    448|  case JCS_EXT_BGRX:
  ------------------
  |  Branch (708:3): [True: 0, False: 459]
  ------------------
  709|    448|  case JCS_EXT_XBGR:
  ------------------
  |  Branch (709:3): [True: 0, False: 459]
  ------------------
  710|    448|  case JCS_EXT_XRGB:
  ------------------
  |  Branch (710:3): [True: 0, False: 459]
  ------------------
  711|    448|  case JCS_EXT_RGBA:
  ------------------
  |  Branch (711:3): [True: 0, False: 459]
  ------------------
  712|    448|  case JCS_EXT_BGRA:
  ------------------
  |  Branch (712:3): [True: 0, False: 459]
  ------------------
  713|    448|  case JCS_EXT_ABGR:
  ------------------
  |  Branch (713:3): [True: 0, False: 459]
  ------------------
  714|    448|  case JCS_EXT_ARGB:
  ------------------
  |  Branch (714:3): [True: 0, False: 459]
  ------------------
  715|    448|#ifdef D_LOSSLESS_SUPPORTED
  716|    448|    if (cinfo->master->lossless && cinfo->jpeg_color_space != JCS_RGB)
  ------------------
  |  Branch (716:9): [True: 448, False: 0]
  |  Branch (716:36): [True: 1, False: 447]
  ------------------
  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|    448|#endif
  719|    448|    cinfo->out_color_components = rgb_pixelsize[cinfo->out_color_space];
  720|    448|    if (cinfo->jpeg_color_space == JCS_YCbCr) {
  ------------------
  |  Branch (720:9): [True: 0, False: 448]
  ------------------
  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|    448|    } else if (cinfo->jpeg_color_space == JCS_GRAYSCALE) {
  ------------------
  |  Branch (755:16): [True: 0, False: 448]
  ------------------
  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|    448|    } else if (cinfo->jpeg_color_space == JCS_RGB) {
  ------------------
  |  Branch (782:16): [True: 447, False: 1]
  ------------------
  783|    447|      if (rgb_red[cinfo->out_color_space] == 0 &&
  ------------------
  |  Branch (783:11): [True: 447, False: 0]
  ------------------
  784|    447|          rgb_green[cinfo->out_color_space] == 1 &&
  ------------------
  |  Branch (784:11): [True: 447, False: 0]
  ------------------
  785|    447|          rgb_blue[cinfo->out_color_space] == 2 &&
  ------------------
  |  Branch (785:11): [True: 447, False: 0]
  ------------------
  786|    447|          rgb_pixelsize[cinfo->out_color_space] == 3)
  ------------------
  |  Branch (786:11): [True: 447, False: 0]
  ------------------
  787|    447|        cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|    447|#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|    447|    } 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|    448|    break;
  819|       |
  820|    448|  case JCS_RGB565:
  ------------------
  |  Branch (820:3): [True: 0, False: 459]
  ------------------
  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|     10|  case JCS_CMYK:
  ------------------
  |  Branch (857:3): [True: 10, False: 449]
  ------------------
  858|     10|#ifdef D_LOSSLESS_SUPPORTED
  859|     10|    if (cinfo->master->lossless &&
  ------------------
  |  Branch (859:9): [True: 10, False: 0]
  ------------------
  860|     10|        cinfo->jpeg_color_space != cinfo->out_color_space)
  ------------------
  |  Branch (860:9): [True: 1, False: 9]
  ------------------
  861|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  862|     10|#endif
  863|     10|    cinfo->out_color_components = 4;
  864|     10|    if (cinfo->jpeg_color_space == JCS_YCCK) {
  ------------------
  |  Branch (864:9): [True: 0, False: 10]
  ------------------
  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|     10|    } else if (cinfo->jpeg_color_space == JCS_CMYK) {
  ------------------
  |  Branch (867:16): [True: 9, False: 1]
  ------------------
  868|      9|      cconvert->pub._color_convert = null_convert;
  ------------------
  |  |   59|      9|#define _color_convert  color_convert_16
  ------------------
  869|      9|    } else
  870|      1|      ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
  ------------------
  |  |  240|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  871|     10|    break;
  872|       |
  873|      0|  default:
  ------------------
  |  Branch (873:3): [True: 0, False: 459]
  ------------------
  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|    459|  }
  882|       |
  883|    457|  if (cinfo->quantize_colors)
  ------------------
  |  Branch (883:7): [True: 0, False: 457]
  ------------------
  884|      0|    cinfo->output_components = 1; /* single colormapped output component */
  885|    457|  else
  886|    457|    cinfo->output_components = cinfo->out_color_components;
  887|    457|}
jdcolor-16.c:start_pass_dcolor:
  614|      5|{
  615|       |  /* no work needed */
  616|      5|}

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

jinit_d_diff_controller:
  348|    523|{
  349|    523|  my_diff_ptr diff;
  350|    523|  int ci;
  351|    523|  jpeg_component_info *compptr;
  352|       |
  353|    523|#if BITS_IN_JSAMPLE == 8
  354|    523|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.04k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (354:7): [True: 0, False: 523]
  |  Branch (354:50): [True: 0, False: 523]
  ------------------
  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|    523|  diff = (my_diff_ptr)
  362|    523|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    523|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    523|                                sizeof(my_diff_controller));
  364|    523|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    523|  diff->pub.start_input_pass = start_input_pass;
  366|    523|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  2.12k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1.60k, False: 523]
  ------------------
  370|  1.60k|       ci++, compptr++) {
  371|  1.60k|    diff->diff_buf[ci] =
  372|  1.60k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.60k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.60k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.60k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  1.60k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  1.60k|                                         (long)compptr->h_samp_factor),
  375|  1.60k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  1.60k|    diff->undiff_buf[ci] =
  377|  1.60k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.60k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.60k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.60k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  1.60k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  1.60k|                                         (long)compptr->h_samp_factor),
  380|  1.60k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  1.60k|  }
  382|       |
  383|    523|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 376, False: 147]
  ------------------
  384|    376|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|    376|    int access_rows;
  387|       |
  388|  1.50k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 1.12k, False: 376]
  ------------------
  389|  1.12k|         ci++, compptr++) {
  390|  1.12k|      access_rows = compptr->v_samp_factor;
  391|  1.12k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|  1.12k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  1.12k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  1.12k|#define FALSE   0               /* values of boolean */
  ------------------
  393|  1.12k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|  1.12k|                               (long)compptr->h_samp_factor),
  395|  1.12k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|  1.12k|                               (long)compptr->v_samp_factor),
  397|  1.12k|         (JDIMENSION)access_rows);
  398|  1.12k|    }
  399|    376|    diff->pub.consume_data = consume_data;
  400|    376|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  258|    376|#define _decompress_data  decompress_data
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    376|  } else {
  405|    147|    diff->pub.consume_data = dummy_consume_data;
  406|    147|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  258|    147|#define _decompress_data  decompress_data
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|    147|  }
  409|    523|}
jddiffct-8.c:start_input_pass:
   94|  1.49k|{
   95|  1.49k|  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|  1.49k|  (*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|  1.49k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 1, False: 1.49k]
  ------------------
  108|      1|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  1.49k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|  1.49k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|  1.49k|  cinfo->input_iMCU_row = 0;
  115|  1.49k|  start_iMCU_row(cinfo);
  116|  1.49k|}
jddiffct-8.c:start_iMCU_row:
   67|  13.8k|{
   68|  13.8k|  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|  13.8k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 2.19k, False: 11.6k]
  ------------------
   75|  2.19k|    diff->MCU_rows_per_iMCU_row = 1;
   76|  11.6k|  } else {
   77|  11.6k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 10.6k, False: 1.08k]
  ------------------
   78|  10.6k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|  1.08k|    else
   80|  1.08k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  11.6k|  }
   82|       |
   83|  13.8k|  diff->MCU_ctr = 0;
   84|  13.8k|  diff->MCU_vert_offset = 0;
   85|  13.8k|}
jddiffct-8.c:start_output_pass:
  147|    155|{
  148|    155|  cinfo->output_iMCU_row = 0;
  149|    155|}
jddiffct-8.c:consume_data:
  266|  11.6k|{
  267|  11.6k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  11.6k|  int ci, compi;
  269|  11.6k|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  230|  11.6k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  270|  11.6k|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|  23.3k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 11.6k, False: 11.6k]
  ------------------
  274|  11.6k|    compptr = cinfo->cur_comp_info[ci];
  275|  11.6k|    compi = compptr->component_index;
  276|  11.6k|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|  11.6k|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|  11.6k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|  11.6k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  11.6k|#define TRUE    1
  ------------------
  280|  11.6k|  }
  281|       |
  282|  11.6k|  return decompress_data(cinfo, buffer);
  283|  11.6k|}
jddiffct-8.c:output_data:
  296|     19|{
  297|     19|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  298|     19|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  299|     19|  int ci, samp_rows, row;
  300|     19|  _JSAMPARRAY buffer;
  ------------------
  |  |  230|     19|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  301|     19|  jpeg_component_info *compptr;
  302|       |
  303|       |  /* Force some input to be done if we are getting ahead of the input. */
  304|     19|  while (cinfo->input_scan_number < cinfo->output_scan_number ||
  ------------------
  |  Branch (304:10): [True: 0, False: 19]
  ------------------
  305|     19|         (cinfo->input_scan_number == cinfo->output_scan_number &&
  ------------------
  |  Branch (305:11): [True: 19, False: 0]
  ------------------
  306|     19|          cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
  ------------------
  |  Branch (306:11): [True: 0, False: 19]
  ------------------
  307|      0|    if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  |  Branch (307:9): [True: 0, False: 0]
  ------------------
  308|      0|      return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  309|      0|  }
  310|       |
  311|       |  /* OK, output from the virtual arrays. */
  312|     69|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (312:44): [True: 50, False: 19]
  ------------------
  313|     50|       ci++, compptr++) {
  314|       |    /* Align the virtual buffer for this component. */
  315|     50|    buffer = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  316|     50|      ((j_common_ptr)cinfo, diff->whole_image[ci],
  317|     50|       cinfo->output_iMCU_row * compptr->v_samp_factor,
  318|     50|       (JDIMENSION)compptr->v_samp_factor, FALSE);
  ------------------
  |  |  207|     50|#define FALSE   0               /* values of boolean */
  ------------------
  319|       |
  320|     50|    if (cinfo->output_iMCU_row < last_iMCU_row)
  ------------------
  |  Branch (320:9): [True: 9, False: 41]
  ------------------
  321|      9|      samp_rows = compptr->v_samp_factor;
  322|     41|    else {
  323|       |      /* NB: can't use last_row_height here; it is input-side-dependent! */
  324|     41|      samp_rows = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  325|     41|      if (samp_rows == 0) samp_rows = compptr->v_samp_factor;
  ------------------
  |  Branch (325:11): [True: 22, False: 19]
  ------------------
  326|     41|    }
  327|       |
  328|    110|    for (row = 0; row < samp_rows; row++) {
  ------------------
  |  Branch (328:19): [True: 60, False: 50]
  ------------------
  329|     60|      memcpy(output_buf[ci][row], buffer[row],
  330|     60|             compptr->width_in_blocks * sizeof(_JSAMPLE));
  331|     60|    }
  332|     50|  }
  333|       |
  334|     19|  if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
  ------------------
  |  Branch (334:7): [True: 2, False: 17]
  ------------------
  335|      2|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|      2|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  336|     17|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|     17|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  337|     19|}
jddiffct-8.c:decompress_data:
  164|  13.8k|{
  165|  13.8k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  13.8k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  13.8k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  13.8k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  13.8k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  13.8k|  int ci, compi, row, prev_row;
  171|  13.8k|  unsigned int yoffset;
  172|  13.8k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  41.3k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 27.4k, False: 13.8k]
  ------------------
  176|  27.4k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  27.4k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 234, False: 27.2k]
  ------------------
  180|    234|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 6, False: 228]
  ------------------
  181|      6|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 6]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|    234|    }
  184|       |
  185|  27.4k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  27.4k|    MCU_count =
  188|  27.4k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  27.4k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  27.4k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  27.4k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 27.4k]
  ------------------
  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|  27.4k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 224, False: 27.2k]
  ------------------
  200|    224|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  27.4k|    diff->MCU_ctr = 0;
  204|  27.4k|  }
  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|  31.8k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 17.9k, False: 13.8k]
  ------------------
  212|  17.9k|    compptr = cinfo->cur_comp_info[ci];
  213|  17.9k|    compi = compptr->component_index;
  214|  17.9k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  51.3k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 33.4k, False: 17.9k]
  |  Branch (215:17): [True: 2.54k, False: 48.8k]
  ------------------
  216|  48.8k|                compptr->last_row_height : compptr->v_samp_factor);
  217|  33.4k|         prev_row = row, row++) {
  218|  33.4k|      (*losslessd->predict_undifference[compi])
  219|  33.4k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  33.4k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  33.4k|          compptr->width_in_blocks);
  222|  33.4k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  33.4k|                                  output_buf[compi][row],
  224|  33.4k|                                  compptr->width_in_blocks);
  225|  33.4k|    }
  226|  17.9k|  }
  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|  13.8k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 12.4k, False: 1.45k]
  ------------------
  235|  12.4k|    start_iMCU_row(cinfo);
  236|  12.4k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  12.4k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  12.4k|  }
  238|       |  /* Completed the scan */
  239|  1.45k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|  1.45k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.45k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  13.8k|}
jddiffct-8.c:process_restart:
  126|      6|{
  127|      6|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|      6|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 6]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|      6|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|      6|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|      6|  return TRUE;
  ------------------
  |  |  210|      6|#define TRUE    1
  ------------------
  138|      6|}
j12init_d_diff_controller:
  348|    426|{
  349|    426|  my_diff_ptr diff;
  350|    426|  int ci;
  351|    426|  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|    426|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    852|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (356:7): [True: 0, False: 426]
  ------------------
  357|    426|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    426|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (357:7): [True: 0, False: 426]
  ------------------
  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|    426|  diff = (my_diff_ptr)
  362|    426|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    426|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    426|                                sizeof(my_diff_controller));
  364|    426|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    426|  diff->pub.start_input_pass = start_input_pass;
  366|    426|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  1.72k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1.29k, False: 426]
  ------------------
  370|  1.29k|       ci++, compptr++) {
  371|  1.29k|    diff->diff_buf[ci] =
  372|  1.29k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.29k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.29k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.29k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  1.29k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  1.29k|                                         (long)compptr->h_samp_factor),
  375|  1.29k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  1.29k|    diff->undiff_buf[ci] =
  377|  1.29k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.29k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.29k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.29k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  1.29k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  1.29k|                                         (long)compptr->h_samp_factor),
  380|  1.29k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  1.29k|  }
  382|       |
  383|    426|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 402, False: 24]
  ------------------
  384|    402|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|    402|    int access_rows;
  387|       |
  388|  1.60k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 1.20k, False: 402]
  ------------------
  389|  1.20k|         ci++, compptr++) {
  390|  1.20k|      access_rows = compptr->v_samp_factor;
  391|  1.20k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|  1.20k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  1.20k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  1.20k|#define FALSE   0               /* values of boolean */
  ------------------
  393|  1.20k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|  1.20k|                               (long)compptr->h_samp_factor),
  395|  1.20k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|  1.20k|                               (long)compptr->v_samp_factor),
  397|  1.20k|         (JDIMENSION)access_rows);
  398|  1.20k|    }
  399|    402|    diff->pub.consume_data = consume_data;
  400|    402|    diff->pub._decompress_data = output_data;
  ------------------
  |  |  142|    402|#define _decompress_data  decompress_data_12
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    402|  } else {
  405|     24|    diff->pub.consume_data = dummy_consume_data;
  406|     24|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |  142|     24|#define _decompress_data  decompress_data_12
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|     24|  }
  409|    426|}
jddiffct-12.c:start_input_pass:
   94|  1.24k|{
   95|  1.24k|  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|  1.24k|  (*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|  1.24k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 1, False: 1.24k]
  ------------------
  108|      1|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  1.24k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|  1.24k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|  1.24k|  cinfo->input_iMCU_row = 0;
  115|  1.24k|  start_iMCU_row(cinfo);
  116|  1.24k|}
jddiffct-12.c:start_iMCU_row:
   67|  8.75k|{
   68|  8.75k|  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|  8.75k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 3, False: 8.75k]
  ------------------
   75|      3|    diff->MCU_rows_per_iMCU_row = 1;
   76|  8.75k|  } else {
   77|  8.75k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 7.83k, False: 917]
  ------------------
   78|  7.83k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|    917|    else
   80|    917|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  8.75k|  }
   82|       |
   83|  8.75k|  diff->MCU_ctr = 0;
   84|  8.75k|  diff->MCU_vert_offset = 0;
   85|  8.75k|}
jddiffct-12.c:start_output_pass:
  147|      6|{
  148|      6|  cinfo->output_iMCU_row = 0;
  149|      6|}
jddiffct-12.c:consume_data:
  266|  8.75k|{
  267|  8.75k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  8.75k|  int ci, compi;
  269|  8.75k|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |  114|  8.75k|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  270|  8.75k|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|  17.5k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 8.75k, False: 8.75k]
  ------------------
  274|  8.75k|    compptr = cinfo->cur_comp_info[ci];
  275|  8.75k|    compi = compptr->component_index;
  276|  8.75k|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|  8.75k|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|  8.75k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|  8.75k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  8.75k|#define TRUE    1
  ------------------
  280|  8.75k|  }
  281|       |
  282|  8.75k|  return decompress_data(cinfo, buffer);
  283|  8.75k|}
jddiffct-12.c:decompress_data:
  164|  8.75k|{
  165|  8.75k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  8.75k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  8.75k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  8.75k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  8.75k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  8.75k|  int ci, compi, row, prev_row;
  171|  8.75k|  unsigned int yoffset;
  172|  8.75k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  25.5k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 16.8k, False: 8.75k]
  ------------------
  176|  16.8k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  16.8k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 1.44k, False: 15.3k]
  ------------------
  180|  1.44k|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 8, False: 1.43k]
  ------------------
  181|      8|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 8]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|  1.44k|    }
  184|       |
  185|  16.8k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  16.8k|    MCU_count =
  188|  16.8k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  16.8k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  16.8k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  16.8k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 16.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|  16.8k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 1.43k, False: 15.3k]
  ------------------
  200|  1.43k|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  16.8k|    diff->MCU_ctr = 0;
  204|  16.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|  17.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 8.46k, False: 8.75k]
  ------------------
  212|  8.46k|    compptr = cinfo->cur_comp_info[ci];
  213|  8.46k|    compi = compptr->component_index;
  214|  8.46k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  24.8k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 16.3k, False: 8.46k]
  |  Branch (215:17): [True: 2.51k, False: 22.3k]
  ------------------
  216|  22.3k|                compptr->last_row_height : compptr->v_samp_factor);
  217|  16.3k|         prev_row = row, row++) {
  218|  16.3k|      (*losslessd->predict_undifference[compi])
  219|  16.3k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  16.3k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  16.3k|          compptr->width_in_blocks);
  222|  16.3k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  16.3k|                                  output_buf[compi][row],
  224|  16.3k|                                  compptr->width_in_blocks);
  225|  16.3k|    }
  226|  8.46k|  }
  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|  8.75k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 7.55k, False: 1.19k]
  ------------------
  235|  7.55k|    start_iMCU_row(cinfo);
  236|  7.55k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  7.55k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  7.55k|  }
  238|       |  /* Completed the scan */
  239|  1.19k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|  1.19k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.19k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  8.75k|}
jddiffct-12.c:process_restart:
  126|      8|{
  127|      8|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|      8|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 8]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|      8|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|      8|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|      8|  return TRUE;
  ------------------
  |  |  210|      8|#define TRUE    1
  ------------------
  138|      8|}
j16init_d_diff_controller:
  348|    451|{
  349|    451|  my_diff_ptr diff;
  350|    451|  int ci;
  351|    451|  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|    451|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    902|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (356:7): [True: 0, False: 451]
  ------------------
  357|    451|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    451|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (357:7): [True: 0, False: 451]
  ------------------
  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|    451|  diff = (my_diff_ptr)
  362|    451|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    451|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  363|    451|                                sizeof(my_diff_controller));
  364|    451|  cinfo->coef = (struct jpeg_d_coef_controller *)diff;
  365|    451|  diff->pub.start_input_pass = start_input_pass;
  366|    451|  diff->pub.start_output_pass = start_output_pass;
  367|       |
  368|       |  /* Create the [un]difference buffers. */
  369|  1.81k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (369:44): [True: 1.36k, False: 451]
  ------------------
  370|  1.36k|       ci++, compptr++) {
  371|  1.36k|    diff->diff_buf[ci] =
  372|  1.36k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.36k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.36k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.36k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  373|  1.36k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  374|  1.36k|                                         (long)compptr->h_samp_factor),
  375|  1.36k|                   (JDIMENSION)compptr->v_samp_factor);
  376|  1.36k|    diff->undiff_buf[ci] =
  377|  1.36k|      ALLOC_DARRAY(JPOOL_IMAGE,
  ------------------
  |  |   28|  1.36k|  (JDIFFARRAY)(*cinfo->mem->alloc_sarray) \
  |  |   29|  1.36k|    ((j_common_ptr)cinfo, pool_id, \
  |  |   30|  1.36k|     (diffsperrow) * sizeof(JDIFF) / sizeof(_JSAMPLE), numrows)
  ------------------
  378|  1.36k|                   (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  379|  1.36k|                                         (long)compptr->h_samp_factor),
  380|  1.36k|                   (JDIMENSION)compptr->v_samp_factor);
  381|  1.36k|  }
  382|       |
  383|    451|  if (need_full_buffer) {
  ------------------
  |  Branch (383:7): [True: 424, False: 27]
  ------------------
  384|    424|#ifdef D_MULTISCAN_FILES_SUPPORTED
  385|       |    /* Allocate a full-image virtual array for each component. */
  386|    424|    int access_rows;
  387|       |
  388|  1.69k|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (388:46): [True: 1.27k, False: 424]
  ------------------
  389|  1.27k|         ci++, compptr++) {
  390|  1.27k|      access_rows = compptr->v_samp_factor;
  391|  1.27k|      diff->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
  392|  1.27k|        ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  889|  1.27k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
                      ((j_common_ptr)cinfo, JPOOL_IMAGE, FALSE,
  ------------------
  |  |  207|  1.27k|#define FALSE   0               /* values of boolean */
  ------------------
  393|  1.27k|         (JDIMENSION)jround_up((long)compptr->width_in_blocks,
  394|  1.27k|                               (long)compptr->h_samp_factor),
  395|  1.27k|         (JDIMENSION)jround_up((long)compptr->height_in_blocks,
  396|  1.27k|                               (long)compptr->v_samp_factor),
  397|  1.27k|         (JDIMENSION)access_rows);
  398|  1.27k|    }
  399|    424|    diff->pub.consume_data = consume_data;
  400|    424|    diff->pub._decompress_data = output_data;
  ------------------
  |  |   53|    424|#define _decompress_data  decompress_data_16
  ------------------
  401|       |#else
  402|       |    ERREXIT(cinfo, JERR_NOT_COMPILED);
  403|       |#endif
  404|    424|  } else {
  405|     27|    diff->pub.consume_data = dummy_consume_data;
  406|     27|    diff->pub._decompress_data = decompress_data;
  ------------------
  |  |   53|     27|#define _decompress_data  decompress_data_16
  ------------------
  407|       |    diff->whole_image[0] = NULL; /* flag for no virtual arrays */
  408|     27|  }
  409|    451|}
jddiffct-16.c:start_input_pass:
   94|  1.84k|{
   95|  1.84k|  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|  1.84k|  (*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|  1.84k|  if (cinfo->restart_interval % cinfo->MCUs_per_row != 0)
  ------------------
  |  Branch (107:7): [True: 1, False: 1.84k]
  ------------------
  108|      1|    ERREXIT2(cinfo, JERR_BAD_RESTART,
  ------------------
  |  |  247|      1|  ((cinfo)->err->msg_code = (code), \
  |  |  248|      1|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|      1|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|      1|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  109|  1.84k|             cinfo->restart_interval, cinfo->MCUs_per_row);
  110|       |
  111|       |  /* Initialize restart counter */
  112|  1.84k|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  113|       |
  114|  1.84k|  cinfo->input_iMCU_row = 0;
  115|  1.84k|  start_iMCU_row(cinfo);
  116|  1.84k|}
jddiffct-16.c:start_iMCU_row:
   67|  26.6k|{
   68|  26.6k|  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|  26.6k|  if (cinfo->comps_in_scan > 1) {
  ------------------
  |  Branch (74:7): [True: 3, False: 26.6k]
  ------------------
   75|      3|    diff->MCU_rows_per_iMCU_row = 1;
   76|  26.6k|  } else {
   77|  26.6k|    if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
  ------------------
  |  Branch (77:9): [True: 25.1k, False: 1.50k]
  ------------------
   78|  25.1k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
   79|  1.50k|    else
   80|  1.50k|      diff->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
   81|  26.6k|  }
   82|       |
   83|  26.6k|  diff->MCU_ctr = 0;
   84|  26.6k|  diff->MCU_vert_offset = 0;
   85|  26.6k|}
jddiffct-16.c:start_output_pass:
  147|      5|{
  148|      5|  cinfo->output_iMCU_row = 0;
  149|      5|}
jddiffct-16.c:consume_data:
  266|  26.6k|{
  267|  26.6k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  268|  26.6k|  int ci, compi;
  269|  26.6k|  _JSAMPARRAY buffer[MAX_COMPS_IN_SCAN];
  ------------------
  |  |   28|  26.6k|#define _JSAMPARRAY  J16SAMPARRAY
  ------------------
  270|  26.6k|  jpeg_component_info *compptr;
  271|       |
  272|       |  /* Align the virtual buffers for the components used in this scan. */
  273|  53.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (273:16): [True: 26.6k, False: 26.6k]
  ------------------
  274|  26.6k|    compptr = cinfo->cur_comp_info[ci];
  275|  26.6k|    compi = compptr->component_index;
  276|  26.6k|    buffer[compi] = (_JSAMPARRAY)(*cinfo->mem->access_virt_sarray)
  277|  26.6k|      ((j_common_ptr)cinfo, diff->whole_image[compi],
  278|  26.6k|       cinfo->input_iMCU_row * compptr->v_samp_factor,
  279|  26.6k|       (JDIMENSION)compptr->v_samp_factor, TRUE);
  ------------------
  |  |  210|  26.6k|#define TRUE    1
  ------------------
  280|  26.6k|  }
  281|       |
  282|  26.6k|  return decompress_data(cinfo, buffer);
  283|  26.6k|}
jddiffct-16.c:decompress_data:
  164|  26.6k|{
  165|  26.6k|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  166|  26.6k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  167|  26.6k|  JDIMENSION MCU_col_num;       /* index of current MCU within row */
  168|  26.6k|  JDIMENSION MCU_count;         /* number of MCUs decoded */
  169|  26.6k|  JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
  170|  26.6k|  int ci, compi, row, prev_row;
  171|  26.6k|  unsigned int yoffset;
  172|  26.6k|  jpeg_component_info *compptr;
  173|       |
  174|       |  /* Loop to process as much as one whole iMCU row */
  175|  74.9k|  for (yoffset = diff->MCU_vert_offset; yoffset < diff->MCU_rows_per_iMCU_row;
  ------------------
  |  Branch (175:41): [True: 48.3k, False: 26.6k]
  ------------------
  176|  48.3k|       yoffset++) {
  177|       |
  178|       |    /* Process restart marker if needed; may have to suspend */
  179|  48.3k|    if (cinfo->restart_interval) {
  ------------------
  |  Branch (179:9): [True: 248, False: 48.1k]
  ------------------
  180|    248|      if (diff->restart_rows_to_go == 0)
  ------------------
  |  Branch (180:11): [True: 8, False: 240]
  ------------------
  181|      8|        if (!process_restart(cinfo))
  ------------------
  |  Branch (181:13): [True: 0, False: 8]
  ------------------
  182|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  183|    248|    }
  184|       |
  185|  48.3k|    MCU_col_num = diff->MCU_ctr;
  186|       |    /* Try to fetch an MCU row (or remaining portion of suspended MCU row). */
  187|  48.3k|    MCU_count =
  188|  48.3k|      (*cinfo->entropy->decode_mcus) (cinfo,
  189|  48.3k|                                      diff->diff_buf, yoffset, MCU_col_num,
  190|  48.3k|                                      cinfo->MCUs_per_row - MCU_col_num);
  191|  48.3k|    if (MCU_count != cinfo->MCUs_per_row - MCU_col_num) {
  ------------------
  |  Branch (191:9): [True: 0, False: 48.3k]
  ------------------
  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|  48.3k|    if (cinfo->restart_interval)
  ------------------
  |  Branch (199:9): [True: 237, False: 48.1k]
  ------------------
  200|    237|      diff->restart_rows_to_go--;
  201|       |
  202|       |    /* Completed an MCU row, but perhaps not an iMCU row */
  203|  48.3k|    diff->MCU_ctr = 0;
  204|  48.3k|  }
  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|  52.9k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (211:16): [True: 26.3k, False: 26.6k]
  ------------------
  212|  26.3k|    compptr = cinfo->cur_comp_info[ci];
  213|  26.3k|    compi = compptr->component_index;
  214|  26.3k|    for (row = 0, prev_row = compptr->v_samp_factor - 1;
  215|  74.3k|         row < (cinfo->input_iMCU_row == last_iMCU_row ?
  ------------------
  |  Branch (215:10): [True: 47.9k, False: 26.3k]
  |  Branch (215:17): [True: 3.41k, False: 70.9k]
  ------------------
  216|  70.9k|                compptr->last_row_height : compptr->v_samp_factor);
  217|  47.9k|         prev_row = row, row++) {
  218|  47.9k|      (*losslessd->predict_undifference[compi])
  219|  47.9k|        (cinfo, compi, diff->diff_buf[compi][row],
  220|  47.9k|          diff->undiff_buf[compi][prev_row], diff->undiff_buf[compi][row],
  221|  47.9k|          compptr->width_in_blocks);
  222|  47.9k|      (*losslessd->scaler_scale) (cinfo, diff->undiff_buf[compi][row],
  223|  47.9k|                                  output_buf[compi][row],
  224|  47.9k|                                  compptr->width_in_blocks);
  225|  47.9k|    }
  226|  26.3k|  }
  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|  26.6k|  if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
  ------------------
  |  Branch (234:7): [True: 24.8k, False: 1.75k]
  ------------------
  235|  24.8k|    start_iMCU_row(cinfo);
  236|  24.8k|    return JPEG_ROW_COMPLETED;
  ------------------
  |  | 1113|  24.8k|#define JPEG_ROW_COMPLETED      3 /* Completed one iMCU row */
  ------------------
  237|  24.8k|  }
  238|       |  /* Completed the scan */
  239|  1.75k|  (*cinfo->inputctl->finish_input_pass) (cinfo);
  240|  1.75k|  return JPEG_SCAN_COMPLETED;
  ------------------
  |  | 1114|  1.75k|#define JPEG_SCAN_COMPLETED     4 /* Completed last iMCU row of a scan */
  ------------------
  241|  26.6k|}
jddiffct-16.c:process_restart:
  126|      8|{
  127|      8|  my_diff_ptr diff = (my_diff_ptr)cinfo->coef;
  128|       |
  129|      8|  if (!(*cinfo->entropy->process_restart) (cinfo))
  ------------------
  |  Branch (129:7): [True: 0, False: 8]
  ------------------
  130|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  131|       |
  132|      8|  (*cinfo->idct->start_pass) (cinfo);
  133|       |
  134|       |  /* Reset restart counter */
  135|      8|  diff->restart_rows_to_go = cinfo->restart_interval / cinfo->MCUs_per_row;
  136|       |
  137|      8|  return TRUE;
  ------------------
  |  |  210|      8|#define TRUE    1
  ------------------
  138|      8|}

jpeg_make_d_derived_tbl:
  145|  14.4k|{
  146|  14.4k|  JHUFF_TBL *htbl;
  147|  14.4k|  d_derived_tbl *dtbl;
  148|  14.4k|  int p, i, l, si, numsymbols;
  149|  14.4k|  int lookbits, ctr;
  150|  14.4k|  char huffsize[257];
  151|  14.4k|  unsigned int huffcode[257];
  152|  14.4k|  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|  14.4k|  if (tblno < 0 || tblno >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  14.4k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (159:7): [True: 0, False: 14.4k]
  |  Branch (159:20): [True: 9, False: 14.4k]
  ------------------
  160|      9|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  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)))
  ------------------
  161|  14.4k|  htbl =
  162|  14.4k|    isDC ? cinfo->dc_huff_tbl_ptrs[tblno] : cinfo->ac_huff_tbl_ptrs[tblno];
  ------------------
  |  Branch (162:5): [True: 9.91k, False: 4.52k]
  ------------------
  163|  14.4k|  if (htbl == NULL)
  ------------------
  |  Branch (163:7): [True: 38, False: 14.3k]
  ------------------
  164|     38|    ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, tblno);
  ------------------
  |  |  243|     38|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     38|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     38|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  165|       |
  166|       |  /* Allocate a workspace if we haven't already done so. */
  167|  14.4k|  if (*pdtbl == NULL)
  ------------------
  |  Branch (167:7): [True: 6.47k, False: 7.95k]
  ------------------
  168|  6.47k|    *pdtbl = (d_derived_tbl *)
  169|  6.47k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  6.47k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  170|  6.47k|                                  sizeof(d_derived_tbl));
  171|  14.4k|  dtbl = *pdtbl;
  172|  14.4k|  dtbl->pub = htbl;             /* fill in back link */
  173|       |
  174|       |  /* Figure C.1: make table of Huffman code length for each symbol */
  175|       |
  176|  14.4k|  p = 0;
  177|   244k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (177:15): [True: 230k, False: 14.4k]
  ------------------
  178|   230k|    i = (int)htbl->bits[l];
  179|   230k|    if (i < 0 || p + i > 256)   /* protect against table overrun */
  ------------------
  |  Branch (179:9): [True: 0, False: 230k]
  |  Branch (179:18): [True: 0, False: 230k]
  ------------------
  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|   791k|    while (i--)
  ------------------
  |  Branch (181:12): [True: 561k, False: 230k]
  ------------------
  182|   561k|      huffsize[p++] = (char)l;
  183|   230k|  }
  184|  14.4k|  huffsize[p] = 0;
  185|  14.4k|  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|  14.4k|  code = 0;
  191|  14.4k|  si = huffsize[0];
  192|  14.4k|  p = 0;
  193|   134k|  while (huffsize[p]) {
  ------------------
  |  Branch (193:10): [True: 120k, False: 14.4k]
  ------------------
  194|   680k|    while (((int)huffsize[p]) == si) {
  ------------------
  |  Branch (194:12): [True: 560k, False: 120k]
  ------------------
  195|   560k|      huffcode[p++] = code;
  196|   560k|      code++;
  197|   560k|    }
  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|   120k|    if (((JLONG)code) >= (((JLONG)1) << si))
  ------------------
  |  Branch (201:9): [True: 34, False: 120k]
  ------------------
  202|     34|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     34|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     34|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  203|   120k|    code <<= 1;
  204|   120k|    si++;
  205|   120k|  }
  206|       |
  207|       |  /* Figure F.15: generate decoding tables for bit-sequential decoding */
  208|       |
  209|  14.4k|  p = 0;
  210|   244k|  for (l = 1; l <= 16; l++) {
  ------------------
  |  Branch (210:15): [True: 229k, False: 14.4k]
  ------------------
  211|   229k|    if (htbl->bits[l]) {
  ------------------
  |  Branch (211:9): [True: 110k, False: 119k]
  ------------------
  212|       |      /* valoffset[l] = huffval[] index of 1st symbol of code length l,
  213|       |       * minus the minimum code of length l
  214|       |       */
  215|   110k|      dtbl->valoffset[l] = (JLONG)p - (JLONG)huffcode[p];
  216|   110k|      p += htbl->bits[l];
  217|   110k|      dtbl->maxcode[l] = huffcode[p - 1]; /* maximum code of length l */
  218|   119k|    } else {
  219|   119k|      dtbl->maxcode[l] = -1;    /* -1 if no codes of this length */
  220|   119k|    }
  221|   229k|  }
  222|  14.4k|  dtbl->valoffset[17] = 0;
  223|  14.4k|  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|  3.68M|  for (i = 0; i < (1 << HUFF_LOOKAHEAD); i++)
  ------------------
  |  |   25|  3.68M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (232:15): [True: 3.67M, False: 14.4k]
  ------------------
  233|  3.67M|    dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  3.67M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
                  dtbl->lookup[i] = (HUFF_LOOKAHEAD + 1) << HUFF_LOOKAHEAD;
  ------------------
  |  |   25|  3.67M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  234|       |
  235|  14.4k|  p = 0;
  236|   129k|  for (l = 1; l <= HUFF_LOOKAHEAD; l++) {
  ------------------
  |  |   25|   129k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (236:15): [True: 114k, False: 14.4k]
  ------------------
  237|   276k|    for (i = 1; i <= (int)htbl->bits[l]; i++, p++) {
  ------------------
  |  Branch (237:17): [True: 161k, False: 114k]
  ------------------
  238|       |      /* l = current code's length, p = its index in huffcode[] & huffval[]. */
  239|       |      /* Generate left-justified code followed by all possible bit sequences */
  240|   161k|      lookbits = huffcode[p] << (HUFF_LOOKAHEAD - l);
  ------------------
  |  |   25|   161k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  241|  3.69M|      for (ctr = 1 << (HUFF_LOOKAHEAD - l); ctr > 0; ctr--) {
  ------------------
  |  |   25|   161k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  |  Branch (241:45): [True: 3.53M, False: 161k]
  ------------------
  242|  3.53M|        dtbl->lookup[lookbits] = (l << HUFF_LOOKAHEAD) | htbl->huffval[p];
  ------------------
  |  |   25|  3.53M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  ------------------
  243|  3.53M|        lookbits++;
  244|  3.53M|      }
  245|   161k|    }
  246|   114k|  }
  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|  14.4k|  if (isDC) {
  ------------------
  |  Branch (254:7): [True: 9.86k, False: 4.56k]
  ------------------
  255|   100k|    for (i = 0; i < numsymbols; i++) {
  ------------------
  |  Branch (255:17): [True: 91.0k, False: 9.86k]
  ------------------
  256|  91.0k|      int sym = htbl->huffval[i];
  257|  91.0k|      if (sym < 0 || sym > (cinfo->master->lossless ? 16 : 15))
  ------------------
  |  Branch (257:11): [True: 0, False: 91.0k]
  |  Branch (257:22): [True: 55, False: 90.9k]
  |  Branch (257:29): [True: 44.6k, False: 46.3k]
  ------------------
  258|     55|        ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     55|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     55|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  259|  91.0k|    }
  260|  9.86k|  }
  261|  14.4k|}
jpeg_fill_bit_buffer:
  291|   377k|{
  292|       |  /* Copy heavily used state fields into locals (hopefully registers) */
  293|   377k|  register const JOCTET *next_input_byte = state->next_input_byte;
  294|   377k|  register size_t bytes_in_buffer = state->bytes_in_buffer;
  295|   377k|  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|   377k|  if (cinfo->unread_marker == 0) {      /* cannot advance past a marker */
  ------------------
  |  Branch (301:7): [True: 373k, False: 3.95k]
  ------------------
  302|  3.00M|    while (bits_left < MIN_GET_BITS) {
  ------------------
  |  |  282|  3.00M|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  3.00M|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  |  Branch (302:12): [True: 2.64M, False: 366k]
  ------------------
  303|  2.64M|      register int c;
  304|       |
  305|       |      /* Attempt to read a byte */
  306|  2.64M|      if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (306:11): [True: 961, False: 2.64M]
  ------------------
  307|    961|        if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (307:13): [True: 0, False: 961]
  ------------------
  308|      0|          return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  309|    961|        next_input_byte = cinfo->src->next_input_byte;
  310|    961|        bytes_in_buffer = cinfo->src->bytes_in_buffer;
  311|    961|      }
  312|  2.64M|      bytes_in_buffer--;
  313|  2.64M|      c = *next_input_byte++;
  314|       |
  315|       |      /* If it's 0xFF, check and discard stuffed zero byte */
  316|  2.64M|      if (c == 0xFF) {
  ------------------
  |  Branch (316:11): [True: 30.1k, False: 2.61M]
  ------------------
  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|  52.0k|        do {
  323|  52.0k|          if (bytes_in_buffer == 0) {
  ------------------
  |  Branch (323:15): [True: 25, False: 51.9k]
  ------------------
  324|     25|            if (!(*cinfo->src->fill_input_buffer) (cinfo))
  ------------------
  |  Branch (324:17): [True: 0, False: 25]
  ------------------
  325|      0|              return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  326|     25|            next_input_byte = cinfo->src->next_input_byte;
  327|     25|            bytes_in_buffer = cinfo->src->bytes_in_buffer;
  328|     25|          }
  329|  52.0k|          bytes_in_buffer--;
  330|  52.0k|          c = *next_input_byte++;
  331|  52.0k|        } while (c == 0xFF);
  ------------------
  |  Branch (331:18): [True: 21.8k, False: 30.1k]
  ------------------
  332|       |
  333|  30.1k|        if (c == 0) {
  ------------------
  |  Branch (333:13): [True: 23.8k, False: 6.28k]
  ------------------
  334|       |          /* Found FF/00, which represents an FF data byte */
  335|  23.8k|          c = 0xFF;
  336|  23.8k|        } 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|  6.28k|          cinfo->unread_marker = c;
  346|       |          /* See if we need to insert some fake zero bits. */
  347|  6.28k|          goto no_more_bytes;
  348|  6.28k|        }
  349|  30.1k|      }
  350|       |
  351|       |      /* OK, load c into get_buffer */
  352|  2.63M|      get_buffer = (get_buffer << 8) | c;
  353|  2.63M|      bits_left += 8;
  354|  2.63M|    } /* end while */
  355|   373k|  } else {
  356|  10.2k|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|  10.2k|    if (nbits > bits_left) {
  ------------------
  |  Branch (361:9): [True: 1.07k, False: 9.14k]
  ------------------
  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|  1.07k|      if (!cinfo->entropy->insufficient_data) {
  ------------------
  |  Branch (367:11): [True: 1.07k, False: 0]
  ------------------
  368|  1.07k|        WARNMS(cinfo, JWRN_HIT_MARKER);
  ------------------
  |  |  283|  1.07k|  ((cinfo)->err->msg_code = (code), \
  |  |  284|  1.07k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  369|  1.07k|        cinfo->entropy->insufficient_data = TRUE;
  ------------------
  |  |  210|  1.07k|#define TRUE    1
  ------------------
  370|  1.07k|      }
  371|       |      /* Fill the buffer with zero bits */
  372|  1.07k|      get_buffer <<= MIN_GET_BITS - bits_left;
  ------------------
  |  |  282|  1.07k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.07k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  373|  1.07k|      bits_left = MIN_GET_BITS;
  ------------------
  |  |  282|  1.07k|#define MIN_GET_BITS  (BIT_BUF_SIZE - 7)
  |  |  ------------------
  |  |  |  |   83|  1.07k|#define BIT_BUF_SIZE  64                /* size of buffer in bits */
  |  |  ------------------
  ------------------
  374|  1.07k|    }
  375|  10.2k|  }
  376|       |
  377|       |  /* Unload the local registers */
  378|   377k|  state->next_input_byte = next_input_byte;
  379|   377k|  state->bytes_in_buffer = bytes_in_buffer;
  380|   377k|  state->get_buffer = get_buffer;
  381|   377k|  state->bits_left = bits_left;
  382|       |
  383|   377k|  return TRUE;
  ------------------
  |  |  210|   377k|#define TRUE    1
  ------------------
  384|   377k|}
jpeg_huff_decode:
  439|  74.3k|{
  440|  74.3k|  register int l = min_bits;
  441|  74.3k|  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|  74.3k|  CHECK_BIT_BUFFER(*state, l, return -1);
  ------------------
  |  |  160|  74.3k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  74.3k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.92k, False: 72.4k]
  |  |  ------------------
  |  |  162|  1.92k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.92k]
  |  |  ------------------
  |  |  163|  1.92k|      { action; } \
  |  |  164|  1.92k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.92k|  } \
  |  |  166|  74.3k|}
  ------------------
  447|  74.3k|  code = GET_BITS(l);
  ------------------
  |  |  169|  74.3k|  (((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|   217k|  while (code > htbl->maxcode[l]) {
  ------------------
  |  Branch (452:10): [True: 143k, False: 74.3k]
  ------------------
  453|   143k|    code <<= 1;
  454|   143k|    CHECK_BIT_BUFFER(*state, 1, return -1);
  ------------------
  |  |  160|   143k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   143k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 2.59k, False: 141k]
  |  |  ------------------
  |  |  162|  2.59k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 2.59k]
  |  |  ------------------
  |  |  163|  2.59k|      { action; } \
  |  |  164|  2.59k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  2.59k|  } \
  |  |  166|   143k|}
  ------------------
  455|   143k|    code |= GET_BITS(1);
  ------------------
  |  |  169|   143k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  456|   143k|    l++;
  457|   143k|  }
  458|       |
  459|       |  /* Unload the local registers */
  460|  74.3k|  state->get_buffer = get_buffer;
  461|  74.3k|  state->bits_left = bits_left;
  462|       |
  463|       |  /* With garbage input we may reach the sentinel value l = 17. */
  464|       |
  465|  74.3k|  if (l > 16) {
  ------------------
  |  Branch (465:7): [True: 458, False: 73.8k]
  ------------------
  466|    458|    WARNMS(state->cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|    458|  ((cinfo)->err->msg_code = (code), \
  |  |  284|    458|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  467|    458|    return 0;                   /* fake a zero as the safest result */
  468|    458|  }
  469|       |
  470|  73.8k|  return htbl->pub->huffval[(int)(code + htbl->valoffset[l])];
  471|  74.3k|}
jinit_huff_decoder:
  815|  1.38k|{
  816|  1.38k|  huff_entropy_ptr entropy;
  817|  1.38k|  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|  1.38k|  std_huff_tables((j_common_ptr)cinfo);
  824|       |
  825|  1.38k|  entropy = (huff_entropy_ptr)
  826|  1.38k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.38k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  827|  1.38k|                                sizeof(huff_entropy_decoder));
  828|  1.38k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  829|  1.38k|  entropy->pub.start_pass = start_pass_huff_decoder;
  830|  1.38k|  entropy->pub.decode_mcu = decode_mcu;
  831|       |
  832|       |  /* Mark tables unallocated */
  833|  6.93k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  6.93k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (833:15): [True: 5.54k, False: 1.38k]
  ------------------
  834|       |    entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
  835|  5.54k|  }
  836|  1.38k|}
jdhuff.c:start_pass_huff_decoder:
   80|  1.36k|{
   81|  1.36k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
   82|  1.36k|  int ci, blkn, dctbl, actbl;
   83|  1.36k|  d_derived_tbl **pdtbl;
   84|  1.36k|  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|  1.36k|  if (cinfo->Ss != 0 || cinfo->Se != DCTSIZE2 - 1 ||
  ------------------
  |  |   67|  1.35k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (90:7): [True: 13, False: 1.35k]
  |  Branch (90:25): [True: 12, False: 1.34k]
  ------------------
   91|  1.34k|      cinfo->Ah != 0 || cinfo->Al != 0)
  ------------------
  |  Branch (91:7): [True: 11, False: 1.33k]
  |  Branch (91:25): [True: 7, False: 1.32k]
  ------------------
   92|     43|    WARNMS(cinfo, JWRN_NOT_SEQUENTIAL);
  ------------------
  |  |  283|     43|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     43|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
   93|       |
   94|  4.19k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (94:16): [True: 2.82k, False: 1.36k]
  ------------------
   95|  2.82k|    compptr = cinfo->cur_comp_info[ci];
   96|  2.82k|    dctbl = compptr->dc_tbl_no;
   97|  2.82k|    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|  2.82k|    pdtbl = (d_derived_tbl **)(entropy->dc_derived_tbls) + dctbl;
  101|  2.82k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl, pdtbl);
  ------------------
  |  |  210|  2.82k|#define TRUE    1
  ------------------
  102|  2.82k|    pdtbl = (d_derived_tbl **)(entropy->ac_derived_tbls) + actbl;
  103|  2.82k|    jpeg_make_d_derived_tbl(cinfo, FALSE, actbl, pdtbl);
  ------------------
  |  |  207|  2.82k|#define FALSE   0               /* values of boolean */
  ------------------
  104|       |    /* Initialize DC predictions to 0 */
  105|  2.82k|    entropy->saved.last_dc_val[ci] = 0;
  106|  2.82k|  }
  107|       |
  108|       |  /* Precalculate decoding info for each block in an MCU of this scan */
  109|  5.61k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (109:18): [True: 4.24k, False: 1.36k]
  ------------------
  110|  4.24k|    ci = cinfo->MCU_membership[blkn];
  111|  4.24k|    compptr = cinfo->cur_comp_info[ci];
  112|       |    /* Precalculate which table to use for each block */
  113|  4.24k|    entropy->dc_cur_tbls[blkn] = entropy->dc_derived_tbls[compptr->dc_tbl_no];
  114|  4.24k|    entropy->ac_cur_tbls[blkn] = entropy->ac_derived_tbls[compptr->ac_tbl_no];
  115|       |    /* Decide whether we really care about the coefficient values */
  116|  4.24k|    if (compptr->component_needed) {
  ------------------
  |  Branch (116:9): [True: 4.24k, False: 0]
  ------------------
  117|  4.24k|      entropy->dc_needed[blkn] = TRUE;
  ------------------
  |  |  210|  4.24k|#define TRUE    1
  ------------------
  118|       |      /* we don't need the ACs if producing a 1/8th-size image */
  119|  4.24k|      entropy->ac_needed[blkn] = (compptr->_DCT_scaled_size > 1);
  ------------------
  |  |   24|  4.24k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  120|  4.24k|    } else {
  121|      0|      entropy->dc_needed[blkn] = entropy->ac_needed[blkn] = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  122|      0|    }
  123|  4.24k|  }
  124|       |
  125|       |  /* Initialize bitread state variables */
  126|  1.36k|  entropy->bitstate.bits_left = 0;
  127|  1.36k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  128|  1.36k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  1.36k|#define FALSE   0               /* values of boolean */
  ------------------
  129|       |
  130|       |  /* Initialize restart counter */
  131|  1.36k|  entropy->restarts_to_go = cinfo->restart_interval;
  132|  1.36k|}
jdhuff.c:decode_mcu:
  771|   125k|{
  772|   125k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  773|   125k|  int usefast = 1;
  774|       |
  775|       |  /* Process restart marker if needed; may have to suspend */
  776|   125k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (776:7): [True: 15.2k, False: 109k]
  ------------------
  777|  15.2k|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (777:9): [True: 265, False: 14.9k]
  ------------------
  778|    265|      if (!process_restart(cinfo))
  ------------------
  |  Branch (778:11): [True: 0, False: 265]
  ------------------
  779|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  780|  15.2k|    usefast = 0;
  781|  15.2k|  }
  782|       |
  783|   125k|  if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU ||
  ------------------
  |  |  767|   125k|#define BUFSIZE  (DCTSIZE2 * 8)
  |  |  ------------------
  |  |  |  |   67|   125k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  |  |  ------------------
  ------------------
  |  Branch (783:7): [True: 40.3k, False: 84.8k]
  ------------------
  784|  84.8k|      cinfo->unread_marker != 0)
  ------------------
  |  Branch (784:7): [True: 833, False: 84.0k]
  ------------------
  785|  41.1k|    usefast = 0;
  786|       |
  787|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  788|       |   * This way, we return uniform gray for the remainder of the segment.
  789|       |   */
  790|   125k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (790:7): [True: 125k, False: 13]
  ------------------
  791|       |
  792|   125k|    if (usefast) {
  ------------------
  |  Branch (792:9): [True: 76.4k, False: 48.7k]
  ------------------
  793|  76.4k|      if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow;
  ------------------
  |  Branch (793:11): [True: 2.61k, False: 73.8k]
  ------------------
  794|  76.4k|    } else {
  795|  51.3k|use_slow:
  796|  51.3k|      if (!decode_mcu_slow(cinfo, MCU_data)) return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (796:11): [True: 0, False: 51.3k]
  ------------------
  797|  51.3k|    }
  798|       |
  799|   125k|  }
  800|       |
  801|       |  /* Account for restart interval (no-op if not using restarts) */
  802|   125k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (802:7): [True: 15.1k, False: 110k]
  ------------------
  803|  15.1k|    entropy->restarts_to_go--;
  804|       |
  805|   125k|  return TRUE;
  ------------------
  |  |  210|   125k|#define TRUE    1
  ------------------
  806|   125k|}
jdhuff.c:process_restart:
  513|    265|{
  514|    265|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  515|    265|  int ci;
  516|       |
  517|       |  /* Throw away any unused bits remaining in bit buffer; */
  518|       |  /* include any full bytes in next_marker's count of discarded bytes */
  519|    265|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  520|    265|  entropy->bitstate.bits_left = 0;
  521|       |
  522|       |  /* Advance past the RSTn marker */
  523|    265|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (523:7): [True: 0, False: 265]
  ------------------
  524|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  525|       |
  526|       |  /* Re-initialize DC predictions to 0 */
  527|    619|  for (ci = 0; ci < cinfo->comps_in_scan; ci++)
  ------------------
  |  Branch (527:16): [True: 354, False: 265]
  ------------------
  528|    354|    entropy->saved.last_dc_val[ci] = 0;
  529|       |
  530|       |  /* Reset restart counter */
  531|    265|  entropy->restarts_to_go = cinfo->restart_interval;
  532|       |
  533|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  534|       |   * against a marker.  In that case we will end up treating the next data
  535|       |   * segment as empty, and we can avoid producing bogus output pixels by
  536|       |   * leaving the flag set.
  537|       |   */
  538|    265|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (538:7): [True: 252, False: 13]
  ------------------
  539|    252|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|    252|#define FALSE   0               /* values of boolean */
  ------------------
  540|       |
  541|    265|  return TRUE;
  ------------------
  |  |  210|    265|#define TRUE    1
  ------------------
  542|    265|}
jdhuff.c:decode_mcu_fast:
  664|  76.4k|{
  665|  76.4k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  666|  76.4k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  76.4k|  register bit_buf_type get_buffer; \
  |  |  126|  76.4k|  register int bits_left; \
  |  |  127|  76.4k|  bitread_working_state br_state
  ------------------
  667|  76.4k|  JOCTET *buffer;
  668|  76.4k|  int blkn;
  669|  76.4k|  savable_state state;
  670|       |  /* Outer loop handles each block in the MCU */
  671|       |
  672|       |  /* Load up working state */
  673|  76.4k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  76.4k|  br_state.cinfo = cinfop; \
  |  |  131|  76.4k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  76.4k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  76.4k|  get_buffer = permstate.get_buffer; \
  |  |  134|  76.4k|  bits_left = permstate.bits_left;
  ------------------
  674|  76.4k|  buffer = (JOCTET *)br_state.next_input_byte;
  675|  76.4k|  state = entropy->saved;
  676|       |
  677|   190k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (677:18): [True: 113k, False: 76.4k]
  ------------------
  678|   113k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (678:23): [True: 113k, False: 0]
  ------------------
  679|   113k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  680|   113k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  681|   113k|    register int s, k, r, l;
  682|       |
  683|   113k|    HUFF_DECODE_FAST(s, l, dctbl);
  ------------------
  |  |  224|   113k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   113k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 11.2k, False: 102k]
  |  |  |  |  ------------------
  |  |  |  |  416|  11.2k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.73k, False: 9.52k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.73k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.73k|    buffer++; \
  |  |  |  |  |  |  401|  1.73k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 187, False: 1.55k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    187|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    187|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    187|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    187|      buffer -= 2; \
  |  |  |  |  |  |  406|    187|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    187|    } \
  |  |  |  |  |  |  408|  1.73k|  } \
  |  |  |  |  |  |  409|  11.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.01k, False: 9.24k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.01k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.01k|    buffer++; \
  |  |  |  |  |  |  401|  2.01k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 624, False: 1.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    624|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    624|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    624|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    624|      buffer -= 2; \
  |  |  |  |  |  |  406|    624|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    624|    } \
  |  |  |  |  |  |  408|  2.01k|  } \
  |  |  |  |  |  |  409|  11.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 1.55k, False: 9.71k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  1.55k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  1.55k|    buffer++; \
  |  |  |  |  |  |  401|  1.55k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 959, False: 591]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    959|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    959|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    959|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    959|      buffer -= 2; \
  |  |  |  |  |  |  406|    959|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    959|    } \
  |  |  |  |  |  |  408|  1.55k|  } \
  |  |  |  |  |  |  409|  11.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.14k, False: 9.11k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.14k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.14k|    buffer++; \
  |  |  |  |  |  |  401|  2.14k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.11k, False: 1.03k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.11k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.11k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.11k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.11k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.11k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.11k|    } \
  |  |  |  |  |  |  408|  2.14k|  } \
  |  |  |  |  |  |  409|  11.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.31k, False: 8.94k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.31k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.31k|    buffer++; \
  |  |  |  |  |  |  401|  2.31k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.15k, False: 1.16k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.15k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.15k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.15k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.15k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.15k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.15k|    } \
  |  |  |  |  |  |  408|  2.31k|  } \
  |  |  |  |  |  |  409|  11.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  11.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  11.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  11.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  11.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  11.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  11.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  11.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  11.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.07k, False: 9.18k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.07k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.07k|    buffer++; \
  |  |  |  |  |  |  401|  2.07k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 1.20k, False: 873]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|  1.20k|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|  1.20k|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|  1.20k|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|  1.20k|      buffer -= 2; \
  |  |  |  |  |  |  406|  1.20k|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|  1.20k|    } \
  |  |  |  |  |  |  408|  2.07k|  } \
  |  |  |  |  |  |  409|  11.2k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  11.2k|  }
  |  |  ------------------
  |  |  225|   113k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   113k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   113k|  s = htbl->lookup[s]; \
  |  |  227|   113k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   113k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   113k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   113k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   113k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   113k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   113k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   113k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   227k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 5.69k, False: 108k]
  |  |  ------------------
  |  |  232|  5.69k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  5.69k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  5.69k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|  39.3k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 33.6k, False: 5.69k]
  |  |  ------------------
  |  |  236|  33.6k|      s <<= 1; \
  |  |  237|  33.6k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|  33.6k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|  33.6k|      nb++; \
  |  |  239|  33.6k|    } \
  |  |  240|  5.69k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 4.18k, False: 1.51k]
  |  |  ------------------
  |  |  241|  5.69k|      s = 0; \
  |  |  242|  5.69k|    else \
  |  |  243|  5.69k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  5.69k|  }
  ------------------
  684|   113k|    if (s) {
  ------------------
  |  Branch (684:9): [True: 51.4k, False: 62.3k]
  ------------------
  685|  51.4k|      FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|  51.4k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 4.82k, False: 46.6k]
  |  |  ------------------
  |  |  416|  4.82k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.82k|#define GET_BYTE { \
  |  |  |  |  392|  4.82k|  register int c0, c1; \
  |  |  |  |  393|  4.82k|  c0 = *buffer++; \
  |  |  |  |  394|  4.82k|  c1 = *buffer; \
  |  |  |  |  395|  4.82k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.82k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.82k|  bits_left += 8; \
  |  |  |  |  398|  4.82k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 768, False: 4.06k]
  |  |  |  |  ------------------
  |  |  |  |  399|    768|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    768|    buffer++; \
  |  |  |  |  401|    768|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 303, False: 465]
  |  |  |  |  ------------------
  |  |  |  |  402|    303|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    303|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    303|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    303|      buffer -= 2; \
  |  |  |  |  406|    303|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    303|    } \
  |  |  |  |  408|    768|  } \
  |  |  |  |  409|  4.82k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.82k|#define GET_BYTE { \
  |  |  |  |  392|  4.82k|  register int c0, c1; \
  |  |  |  |  393|  4.82k|  c0 = *buffer++; \
  |  |  |  |  394|  4.82k|  c1 = *buffer; \
  |  |  |  |  395|  4.82k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.82k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.82k|  bits_left += 8; \
  |  |  |  |  398|  4.82k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 503, False: 4.32k]
  |  |  |  |  ------------------
  |  |  |  |  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: 323, False: 180]
  |  |  |  |  ------------------
  |  |  |  |  402|    323|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    323|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    323|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    323|      buffer -= 2; \
  |  |  |  |  406|    323|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    323|    } \
  |  |  |  |  408|    503|  } \
  |  |  |  |  409|  4.82k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.82k|#define GET_BYTE { \
  |  |  |  |  392|  4.82k|  register int c0, c1; \
  |  |  |  |  393|  4.82k|  c0 = *buffer++; \
  |  |  |  |  394|  4.82k|  c1 = *buffer; \
  |  |  |  |  395|  4.82k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.82k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.82k|  bits_left += 8; \
  |  |  |  |  398|  4.82k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 765, False: 4.06k]
  |  |  |  |  ------------------
  |  |  |  |  399|    765|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    765|    buffer++; \
  |  |  |  |  401|    765|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 332, False: 433]
  |  |  |  |  ------------------
  |  |  |  |  402|    332|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    332|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    332|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    332|      buffer -= 2; \
  |  |  |  |  406|    332|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    332|    } \
  |  |  |  |  408|    765|  } \
  |  |  |  |  409|  4.82k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.82k|#define GET_BYTE { \
  |  |  |  |  392|  4.82k|  register int c0, c1; \
  |  |  |  |  393|  4.82k|  c0 = *buffer++; \
  |  |  |  |  394|  4.82k|  c1 = *buffer; \
  |  |  |  |  395|  4.82k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.82k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.82k|  bits_left += 8; \
  |  |  |  |  398|  4.82k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 547, False: 4.28k]
  |  |  |  |  ------------------
  |  |  |  |  399|    547|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    547|    buffer++; \
  |  |  |  |  401|    547|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 340, False: 207]
  |  |  |  |  ------------------
  |  |  |  |  402|    340|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    340|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    340|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    340|      buffer -= 2; \
  |  |  |  |  406|    340|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    340|    } \
  |  |  |  |  408|    547|  } \
  |  |  |  |  409|  4.82k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.82k|#define GET_BYTE { \
  |  |  |  |  392|  4.82k|  register int c0, c1; \
  |  |  |  |  393|  4.82k|  c0 = *buffer++; \
  |  |  |  |  394|  4.82k|  c1 = *buffer; \
  |  |  |  |  395|  4.82k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.82k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.82k|  bits_left += 8; \
  |  |  |  |  398|  4.82k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 520, False: 4.30k]
  |  |  |  |  ------------------
  |  |  |  |  399|    520|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|    520|    buffer++; \
  |  |  |  |  401|    520|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 343, False: 177]
  |  |  |  |  ------------------
  |  |  |  |  402|    343|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    343|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    343|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    343|      buffer -= 2; \
  |  |  |  |  406|    343|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    343|    } \
  |  |  |  |  408|    520|  } \
  |  |  |  |  409|  4.82k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  4.82k|#define GET_BYTE { \
  |  |  |  |  392|  4.82k|  register int c0, c1; \
  |  |  |  |  393|  4.82k|  c0 = *buffer++; \
  |  |  |  |  394|  4.82k|  c1 = *buffer; \
  |  |  |  |  395|  4.82k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  4.82k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  4.82k|  bits_left += 8; \
  |  |  |  |  398|  4.82k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 1.01k, False: 3.81k]
  |  |  |  |  ------------------
  |  |  |  |  399|  1.01k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  1.01k|    buffer++; \
  |  |  |  |  401|  1.01k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 349, False: 666]
  |  |  |  |  ------------------
  |  |  |  |  402|    349|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    349|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    349|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    349|      buffer -= 2; \
  |  |  |  |  406|    349|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    349|    } \
  |  |  |  |  408|  1.01k|  } \
  |  |  |  |  409|  4.82k|}
  |  |  ------------------
  |  |  417|  4.82k|  }
  ------------------
  686|  51.4k|      r = GET_BITS(s);
  ------------------
  |  |  169|  51.4k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  687|  51.4k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  51.4k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  51.4k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  688|  51.4k|    }
  689|       |
  690|   113k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (690:9): [True: 113k, False: 0]
  ------------------
  691|   113k|      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|   113k|      s += state.last_dc_val[ci];
  696|   113k|      state.last_dc_val[ci] = s;
  697|   113k|      if (block)
  ------------------
  |  Branch (697:11): [True: 113k, False: 0]
  ------------------
  698|   113k|        (*block)[0] = (JCOEF)s;
  699|   113k|    }
  700|       |
  701|   113k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (701:9): [True: 113k, False: 0]
  |  Branch (701:37): [True: 113k, False: 0]
  ------------------
  702|       |
  703|   916k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   916k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (703:19): [True: 912k, False: 4.50k]
  ------------------
  704|   912k|        HUFF_DECODE_FAST(s, l, actbl);
  ------------------
  |  |  224|   912k|  FILL_BIT_BUFFER_FAST; \
  |  |  ------------------
  |  |  |  |  415|   912k|  if (bits_left <= 16) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (415:7): [True: 51.2k, False: 861k]
  |  |  |  |  ------------------
  |  |  |  |  416|  51.2k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  51.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  51.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  51.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  51.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  51.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  51.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  51.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  51.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.59k, False: 48.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.59k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.59k|    buffer++; \
  |  |  |  |  |  |  401|  2.59k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 560, False: 2.03k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    560|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    560|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    560|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    560|      buffer -= 2; \
  |  |  |  |  |  |  406|    560|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    560|    } \
  |  |  |  |  |  |  408|  2.59k|  } \
  |  |  |  |  |  |  409|  51.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  51.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  51.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  51.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  51.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  51.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  51.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  51.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  51.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.55k, False: 48.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  2.55k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  2.55k|    buffer++; \
  |  |  |  |  |  |  401|  2.55k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 615, False: 1.93k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    615|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    615|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    615|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    615|      buffer -= 2; \
  |  |  |  |  |  |  406|    615|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    615|    } \
  |  |  |  |  |  |  408|  2.55k|  } \
  |  |  |  |  |  |  409|  51.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  51.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  51.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  51.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  51.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  51.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  51.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  51.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  51.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.02k, False: 48.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.02k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.02k|    buffer++; \
  |  |  |  |  |  |  401|  3.02k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 640, False: 2.38k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    640|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    640|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    640|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    640|      buffer -= 2; \
  |  |  |  |  |  |  406|    640|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    640|    } \
  |  |  |  |  |  |  408|  3.02k|  } \
  |  |  |  |  |  |  409|  51.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  51.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  51.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  51.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  51.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  51.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  51.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  51.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  51.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.88k, False: 48.3k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 662, False: 2.21k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    662|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    662|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    662|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    662|      buffer -= 2; \
  |  |  |  |  |  |  406|    662|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    662|    } \
  |  |  |  |  |  |  408|  2.88k|  } \
  |  |  |  |  |  |  409|  51.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  51.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  51.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  51.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  51.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  51.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  51.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  51.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  51.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 3.09k, False: 48.1k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  399|  3.09k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  |  |  400|  3.09k|    buffer++; \
  |  |  |  |  |  |  401|  3.09k|    if (c1 != 0) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (401:9): [True: 683, False: 2.41k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    683|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    683|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    683|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    683|      buffer -= 2; \
  |  |  |  |  |  |  406|    683|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    683|    } \
  |  |  |  |  |  |  408|  3.09k|  } \
  |  |  |  |  |  |  409|  51.2k|}
  |  |  |  |  ------------------
  |  |  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  |  |  ------------------
  |  |  |  |  |  |  391|  51.2k|#define GET_BYTE { \
  |  |  |  |  |  |  392|  51.2k|  register int c0, c1; \
  |  |  |  |  |  |  393|  51.2k|  c0 = *buffer++; \
  |  |  |  |  |  |  394|  51.2k|  c1 = *buffer; \
  |  |  |  |  |  |  395|  51.2k|  /* Pre-execute most common case */ \
  |  |  |  |  |  |  396|  51.2k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  |  |  397|  51.2k|  bits_left += 8; \
  |  |  |  |  |  |  398|  51.2k|  if (c0 == 0xFF) { \
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (398:7): [True: 2.61k, False: 48.6k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  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: 696, False: 1.92k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  402|    696|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  |  |  403|    696|      cinfo->unread_marker = c1; \
  |  |  |  |  |  |  404|    696|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  |  |  405|    696|      buffer -= 2; \
  |  |  |  |  |  |  406|    696|      get_buffer &= ~0xFF; \
  |  |  |  |  |  |  407|    696|    } \
  |  |  |  |  |  |  408|  2.61k|  } \
  |  |  |  |  |  |  409|  51.2k|}
  |  |  |  |  ------------------
  |  |  |  |  417|  51.2k|  }
  |  |  ------------------
  |  |  225|   912k|  s = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   912k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  226|   912k|  s = htbl->lookup[s]; \
  |  |  227|   912k|  nb = s >> HUFF_LOOKAHEAD; \
  |  |  ------------------
  |  |  |  |   25|   912k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  228|   912k|  /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
  |  |  229|   912k|  DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   912k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  230|   912k|  s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   912k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  231|   912k|  if (nb > HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.82M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (231:7): [True: 79.7k, False: 832k]
  |  |  ------------------
  |  |  232|  79.7k|    /* Equivalent of jpeg_huff_decode() */ \
  |  |  233|  79.7k|    /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
  |  |  234|  79.7k|    s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
  |  |  235|   352k|    while (s > htbl->maxcode[nb]) { \
  |  |  ------------------
  |  |  |  Branch (235:12): [True: 272k, False: 79.7k]
  |  |  ------------------
  |  |  236|   272k|      s <<= 1; \
  |  |  237|   272k|      s |= GET_BITS(1); \
  |  |  ------------------
  |  |  |  |  169|   272k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  238|   272k|      nb++; \
  |  |  239|   272k|    } \
  |  |  240|  79.7k|    if (nb > 16) \
  |  |  ------------------
  |  |  |  Branch (240:9): [True: 7.33k, False: 72.4k]
  |  |  ------------------
  |  |  241|  79.7k|      s = 0; \
  |  |  242|  79.7k|    else \
  |  |  243|  79.7k|      s = htbl->pub->huffval[(int)(s + htbl->valoffset[nb]) & 0xFF]; \
  |  |  244|  79.7k|  }
  ------------------
  705|   912k|        r = s >> 4;
  706|   912k|        s &= 15;
  707|       |
  708|   912k|        if (s) {
  ------------------
  |  Branch (708:13): [True: 802k, False: 109k]
  ------------------
  709|   802k|          k += r;
  710|   802k|          FILL_BIT_BUFFER_FAST
  ------------------
  |  |  415|   802k|  if (bits_left <= 16) { \
  |  |  ------------------
  |  |  |  Branch (415:7): [True: 69.7k, False: 732k]
  |  |  ------------------
  |  |  416|  69.7k|    GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  69.7k|#define GET_BYTE { \
  |  |  |  |  392|  69.7k|  register int c0, c1; \
  |  |  |  |  393|  69.7k|  c0 = *buffer++; \
  |  |  |  |  394|  69.7k|  c1 = *buffer; \
  |  |  |  |  395|  69.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  69.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  69.7k|  bits_left += 8; \
  |  |  |  |  398|  69.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.59k, False: 66.1k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.59k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.59k|    buffer++; \
  |  |  |  |  401|  3.59k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 443, False: 3.15k]
  |  |  |  |  ------------------
  |  |  |  |  402|    443|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    443|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    443|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    443|      buffer -= 2; \
  |  |  |  |  406|    443|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    443|    } \
  |  |  |  |  408|  3.59k|  } \
  |  |  |  |  409|  69.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  69.7k|#define GET_BYTE { \
  |  |  |  |  392|  69.7k|  register int c0, c1; \
  |  |  |  |  393|  69.7k|  c0 = *buffer++; \
  |  |  |  |  394|  69.7k|  c1 = *buffer; \
  |  |  |  |  395|  69.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  69.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  69.7k|  bits_left += 8; \
  |  |  |  |  398|  69.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.59k, False: 66.1k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.59k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.59k|    buffer++; \
  |  |  |  |  401|  3.59k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 642, False: 2.95k]
  |  |  |  |  ------------------
  |  |  |  |  402|    642|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    642|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    642|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    642|      buffer -= 2; \
  |  |  |  |  406|    642|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    642|    } \
  |  |  |  |  408|  3.59k|  } \
  |  |  |  |  409|  69.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  69.7k|#define GET_BYTE { \
  |  |  |  |  392|  69.7k|  register int c0, c1; \
  |  |  |  |  393|  69.7k|  c0 = *buffer++; \
  |  |  |  |  394|  69.7k|  c1 = *buffer; \
  |  |  |  |  395|  69.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  69.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  69.7k|  bits_left += 8; \
  |  |  |  |  398|  69.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.69k, False: 66.0k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.69k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.69k|    buffer++; \
  |  |  |  |  401|  3.69k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 677, False: 3.01k]
  |  |  |  |  ------------------
  |  |  |  |  402|    677|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    677|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    677|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    677|      buffer -= 2; \
  |  |  |  |  406|    677|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    677|    } \
  |  |  |  |  408|  3.69k|  } \
  |  |  |  |  409|  69.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  69.7k|#define GET_BYTE { \
  |  |  |  |  392|  69.7k|  register int c0, c1; \
  |  |  |  |  393|  69.7k|  c0 = *buffer++; \
  |  |  |  |  394|  69.7k|  c1 = *buffer; \
  |  |  |  |  395|  69.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  69.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  69.7k|  bits_left += 8; \
  |  |  |  |  398|  69.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.75k, False: 65.9k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.75k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.75k|    buffer++; \
  |  |  |  |  401|  3.75k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 714, False: 3.04k]
  |  |  |  |  ------------------
  |  |  |  |  402|    714|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    714|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    714|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    714|      buffer -= 2; \
  |  |  |  |  406|    714|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    714|    } \
  |  |  |  |  408|  3.75k|  } \
  |  |  |  |  409|  69.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  69.7k|#define GET_BYTE { \
  |  |  |  |  392|  69.7k|  register int c0, c1; \
  |  |  |  |  393|  69.7k|  c0 = *buffer++; \
  |  |  |  |  394|  69.7k|  c1 = *buffer; \
  |  |  |  |  395|  69.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  69.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  69.7k|  bits_left += 8; \
  |  |  |  |  398|  69.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.31k, False: 66.3k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.31k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.31k|    buffer++; \
  |  |  |  |  401|  3.31k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 731, False: 2.58k]
  |  |  |  |  ------------------
  |  |  |  |  402|    731|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    731|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    731|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    731|      buffer -= 2; \
  |  |  |  |  406|    731|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    731|    } \
  |  |  |  |  408|  3.31k|  } \
  |  |  |  |  409|  69.7k|}
  |  |  ------------------
  |  |                   GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
  |  |  ------------------
  |  |  |  |  391|  69.7k|#define GET_BYTE { \
  |  |  |  |  392|  69.7k|  register int c0, c1; \
  |  |  |  |  393|  69.7k|  c0 = *buffer++; \
  |  |  |  |  394|  69.7k|  c1 = *buffer; \
  |  |  |  |  395|  69.7k|  /* Pre-execute most common case */ \
  |  |  |  |  396|  69.7k|  get_buffer = (get_buffer << 8) | c0; \
  |  |  |  |  397|  69.7k|  bits_left += 8; \
  |  |  |  |  398|  69.7k|  if (c0 == 0xFF) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (398:7): [True: 3.84k, False: 65.8k]
  |  |  |  |  ------------------
  |  |  |  |  399|  3.84k|    /* Pre-execute case of FF/00, which represents an FF data byte */ \
  |  |  |  |  400|  3.84k|    buffer++; \
  |  |  |  |  401|  3.84k|    if (c1 != 0) { \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (401:9): [True: 741, False: 3.10k]
  |  |  |  |  ------------------
  |  |  |  |  402|    741|      /* Oops, it's actually a marker indicating end of compressed data. */ \
  |  |  |  |  403|    741|      cinfo->unread_marker = c1; \
  |  |  |  |  404|    741|      /* Back out pre-execution and fill the buffer with zero bits */ \
  |  |  |  |  405|    741|      buffer -= 2; \
  |  |  |  |  406|    741|      get_buffer &= ~0xFF; \
  |  |  |  |  407|    741|    } \
  |  |  |  |  408|  3.84k|  } \
  |  |  |  |  409|  69.7k|}
  |  |  ------------------
  |  |  417|  69.7k|  }
  ------------------
  711|   802k|          r = GET_BITS(s);
  ------------------
  |  |  169|   802k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  712|   802k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   802k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   802k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  713|   802k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  714|   802k|        } else {
  715|   109k|          if (r != 15) break;
  ------------------
  |  Branch (715:15): [True: 109k, False: 565]
  ------------------
  716|    565|          k += 15;
  717|    565|        }
  718|   912k|      }
  719|       |
  720|   113k|    } 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|   113k|  }
  738|       |
  739|  76.4k|  if (cinfo->unread_marker != 0) {
  ------------------
  |  Branch (739:7): [True: 2.61k, False: 73.8k]
  ------------------
  740|  2.61k|    cinfo->unread_marker = 0;
  741|  2.61k|    return FALSE;
  ------------------
  |  |  207|  2.61k|#define FALSE   0               /* values of boolean */
  ------------------
  742|  2.61k|  }
  743|       |
  744|  73.8k|  br_state.bytes_in_buffer -= (buffer - br_state.next_input_byte);
  745|  73.8k|  br_state.next_input_byte = buffer;
  746|  73.8k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  73.8k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  73.8k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  73.8k|  permstate.get_buffer = get_buffer; \
  |  |  140|  73.8k|  permstate.bits_left = bits_left
  ------------------
  747|  73.8k|  entropy->saved = state;
  748|  73.8k|  return TRUE;
  ------------------
  |  |  210|  73.8k|#define TRUE    1
  ------------------
  749|  76.4k|}
jdhuff.c:decode_mcu_slow:
  553|  51.3k|{
  554|  51.3k|  huff_entropy_ptr entropy = (huff_entropy_ptr)cinfo->entropy;
  555|  51.3k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  51.3k|  register bit_buf_type get_buffer; \
  |  |  126|  51.3k|  register int bits_left; \
  |  |  127|  51.3k|  bitread_working_state br_state
  ------------------
  556|  51.3k|  int blkn;
  557|  51.3k|  savable_state state;
  558|       |  /* Outer loop handles each block in the MCU */
  559|       |
  560|       |  /* Load up working state */
  561|  51.3k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  51.3k|  br_state.cinfo = cinfop; \
  |  |  131|  51.3k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  51.3k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  51.3k|  get_buffer = permstate.get_buffer; \
  |  |  134|  51.3k|  bits_left = permstate.bits_left;
  ------------------
  562|  51.3k|  state = entropy->saved;
  563|       |
  564|   146k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (564:18): [True: 95.2k, False: 51.1k]
  ------------------
  565|  95.2k|    JBLOCKROW block = MCU_data ? MCU_data[blkn] : NULL;
  ------------------
  |  Branch (565:23): [True: 95.2k, False: 0]
  ------------------
  566|  95.2k|    d_derived_tbl *dctbl = entropy->dc_cur_tbls[blkn];
  567|  95.2k|    d_derived_tbl *actbl = entropy->ac_cur_tbls[blkn];
  568|  95.2k|    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|  95.2k|    HUFF_DECODE(s, br_state, dctbl, return FALSE, label1);
  ------------------
  |  |  200|  95.2k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  95.2k|  register int nb, look; \
  |  |  202|  95.2k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  95.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 5.94k, False: 89.3k]
  |  |  ------------------
  |  |  203|  5.94k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 5.94k]
  |  |  ------------------
  |  |  204|  5.94k|      { failaction; } \
  |  |  205|  5.94k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  5.94k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  5.94k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 471, False: 5.47k]
  |  |  ------------------
  |  |  207|    471|      nb = 1;  goto slowlabel; \
  |  |  208|    471|    } \
  |  |  209|  5.94k|  } \
  |  |  210|  95.2k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  94.7k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  94.7k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  94.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  94.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 92.7k, False: 2.04k]
  |  |  ------------------
  |  |  212|  92.7k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  92.7k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  92.7k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  92.7k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  92.7k|  } else { \
  |  |  215|  2.49k|slowlabel: \
  |  |  216|  2.49k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 2.49k]
  |  |  ------------------
  |  |  217|  2.49k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  2.49k|      { failaction; } \
  |  |  219|  2.49k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  2.49k|  } \
  |  |  221|  94.7k|}
  ------------------
  574|  95.2k|    if (s) {
  ------------------
  |  Branch (574:9): [True: 43.6k, False: 51.5k]
  ------------------
  575|  43.6k|      CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  43.6k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  43.6k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.47k, False: 42.2k]
  |  |  ------------------
  |  |  162|  1.47k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.47k]
  |  |  ------------------
  |  |  163|  1.47k|      { action; } \
  |  |  164|  1.47k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.47k|  } \
  |  |  166|  43.6k|}
  ------------------
  576|  43.6k|      r = GET_BITS(s);
  ------------------
  |  |  169|  43.6k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  577|  43.6k|      s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|  43.6k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|  43.6k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  578|  43.6k|    }
  579|       |
  580|  95.2k|    if (entropy->dc_needed[blkn]) {
  ------------------
  |  Branch (580:9): [True: 94.9k, False: 279]
  ------------------
  581|       |      /* Convert DC difference to actual value, update last_dc_val */
  582|  94.9k|      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|  94.9k|      s += state.last_dc_val[ci];
  592|  94.9k|      state.last_dc_val[ci] = s;
  593|  94.9k|      if (block) {
  ------------------
  |  Branch (593:11): [True: 94.9k, False: 0]
  ------------------
  594|       |        /* Output the DC coefficient (assumes jpeg_natural_order[0] = 0) */
  595|  94.9k|        (*block)[0] = (JCOEF)s;
  596|  94.9k|      }
  597|  94.9k|    }
  598|       |
  599|  95.2k|    if (entropy->ac_needed[blkn] && block) {
  ------------------
  |  Branch (599:9): [True: 94.9k, False: 279]
  |  Branch (599:37): [True: 94.9k, 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|   680k|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|   680k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (603:19): [True: 676k, False: 3.60k]
  ------------------
  604|   676k|        HUFF_DECODE(s, br_state, actbl, return FALSE, label2);
  ------------------
  |  |  200|   676k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   676k|  register int nb, look; \
  |  |  202|   676k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   676k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 64.5k, False: 611k]
  |  |  ------------------
  |  |  203|  64.5k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 64.5k]
  |  |  ------------------
  |  |  204|  64.5k|      { failaction; } \
  |  |  205|  64.5k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  64.5k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  64.5k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 1.03k, False: 63.4k]
  |  |  ------------------
  |  |  207|  1.03k|      nb = 1;  goto slowlabel; \
  |  |  208|  1.03k|    } \
  |  |  209|  64.5k|  } \
  |  |  210|   676k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   675k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   675k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   675k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   675k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 633k, False: 41.6k]
  |  |  ------------------
  |  |  212|   633k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   633k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   633k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   633k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   633k|  } else { \
  |  |  215|  42.4k|slowlabel: \
  |  |  216|  42.4k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 42.4k]
  |  |  ------------------
  |  |  217|  42.4k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  42.4k|      { failaction; } \
  |  |  219|  42.4k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  42.4k|  } \
  |  |  221|   675k|}
  ------------------
  605|       |
  606|   676k|        r = s >> 4;
  607|   676k|        s &= 15;
  608|       |
  609|   676k|        if (s) {
  ------------------
  |  Branch (609:13): [True: 582k, False: 93.8k]
  ------------------
  610|   582k|          k += r;
  611|   582k|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   582k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   582k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 8.27k, False: 574k]
  |  |  ------------------
  |  |  162|  8.27k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 8.27k]
  |  |  ------------------
  |  |  163|  8.27k|      { action; } \
  |  |  164|  8.27k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  8.27k|  } \
  |  |  166|   582k|}
  ------------------
  612|   582k|          r = GET_BITS(s);
  ------------------
  |  |  169|   582k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  613|   582k|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  484|   582k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  482|   582k|#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|   582k|          (*block)[jpeg_natural_order[k]] = (JCOEF)s;
  619|   582k|        } else {
  620|  93.8k|          if (r != 15)
  ------------------
  |  Branch (620:15): [True: 91.0k, False: 2.79k]
  ------------------
  621|  91.0k|            break;
  622|  2.79k|          k += 15;
  623|  2.79k|        }
  624|   676k|      }
  625|       |
  626|  94.9k|    } else {
  627|       |
  628|       |      /* Section F.2.2.2: decode the AC coefficients */
  629|       |      /* In this path we just discard the values */
  630|    279|      for (k = 1; k < DCTSIZE2; k++) {
  ------------------
  |  |   67|    279|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (630:19): [True: 0, False: 279]
  ------------------
  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|    279|    }
  647|  95.2k|  }
  648|       |
  649|       |  /* Completed MCU, so update state */
  650|  51.1k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  51.1k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  51.1k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  51.1k|  permstate.get_buffer = get_buffer; \
  |  |  140|  51.1k|  permstate.bits_left = bits_left
  ------------------
  651|  51.1k|  entropy->saved = state;
  652|  51.1k|  return TRUE;
  ------------------
  |  |  210|  51.1k|#define TRUE    1
  ------------------
  653|  51.3k|}

jinit_input_controller:
  405|  6.47k|{
  406|  6.47k|  my_inputctl_ptr inputctl;
  407|       |
  408|       |  /* Create subobject in permanent pool */
  409|  6.47k|  inputctl = (my_inputctl_ptr)
  410|  6.47k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  6.47k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  411|  6.47k|                                sizeof(my_input_controller));
  412|  6.47k|  cinfo->inputctl = (struct jpeg_input_controller *)inputctl;
  413|       |  /* Initialize method pointers */
  414|  6.47k|  inputctl->pub.consume_input = consume_markers;
  415|  6.47k|  inputctl->pub.reset_input_controller = reset_input_controller;
  416|  6.47k|  inputctl->pub.start_input_pass = start_input_pass;
  417|  6.47k|  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|  6.47k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  6.47k|#define FALSE   0               /* values of boolean */
  ------------------
  422|  6.47k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  6.47k|#define FALSE   0               /* values of boolean */
  ------------------
  423|  6.47k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  6.47k|#define TRUE    1
  ------------------
  424|  6.47k|}
jdinput.c:consume_markers:
  332|  14.1k|{
  333|  14.1k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  334|  14.1k|  int val;
  335|       |
  336|  14.1k|  if (inputctl->pub.eoi_reached) /* After hitting EOI, read no further */
  ------------------
  |  Branch (336:7): [True: 0, False: 14.1k]
  ------------------
  337|      0|    return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|      0|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  338|       |
  339|  14.1k|  val = (*cinfo->marker->read_markers) (cinfo);
  340|       |
  341|  14.1k|  switch (val) {
  ------------------
  |  Branch (341:11): [True: 12.0k, False: 2.10k]
  ------------------
  342|  11.4k|  case JPEG_REACHED_SOS:        /* Found SOS */
  ------------------
  |  | 1111|  11.4k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
  |  Branch (342:3): [True: 11.4k, False: 2.75k]
  ------------------
  343|  11.4k|    if (inputctl->inheaders) {  /* 1st SOS */
  ------------------
  |  Branch (343:9): [True: 5.06k, False: 6.37k]
  ------------------
  344|  5.06k|      initial_setup(cinfo);
  345|  5.06k|      inputctl->inheaders = FALSE;
  ------------------
  |  |  207|  5.06k|#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|  6.37k|    } else {                    /* 2nd or later SOS marker */
  351|  6.37k|      if (!inputctl->pub.has_multiple_scans)
  ------------------
  |  Branch (351:11): [True: 6, False: 6.36k]
  ------------------
  352|      6|        ERREXIT(cinfo, JERR_EOI_EXPECTED); /* Oops, I wasn't expecting this! */
  ------------------
  |  |  240|      6|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      6|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  353|  6.37k|      start_input_pass(cinfo);
  354|  6.37k|    }
  355|  11.4k|    break;
  356|    657|  case JPEG_REACHED_EOI:        /* Found EOI */
  ------------------
  |  | 1112|    657|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
  |  Branch (356:3): [True: 657, False: 13.5k]
  ------------------
  357|    657|    inputctl->pub.eoi_reached = TRUE;
  ------------------
  |  |  210|    657|#define TRUE    1
  ------------------
  358|    657|    if (inputctl->inheaders) {  /* Tables-only datastream, apparently */
  ------------------
  |  Branch (358:9): [True: 6, False: 651]
  ------------------
  359|      6|      if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (359:11): [True: 3, False: 3]
  ------------------
  360|      3|        ERREXIT(cinfo, JERR_SOF_NO_SOS);
  ------------------
  |  |  240|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      3|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  361|    651|    } 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|    651|      if (cinfo->output_scan_number > cinfo->input_scan_number)
  ------------------
  |  Branch (365:11): [True: 0, False: 651]
  ------------------
  366|      0|        cinfo->output_scan_number = cinfo->input_scan_number;
  367|    651|    }
  368|    657|    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: 14.1k]
  ------------------
  370|      0|    break;
  371|  14.1k|  }
  372|       |
  373|  11.9k|  return val;
  374|  14.1k|}
jdinput.c:initial_setup:
   49|  5.06k|{
   50|  5.06k|  int ci;
   51|  5.06k|  jpeg_component_info *compptr;
   52|  5.06k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  3.57k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (52:19): [True: 1.48k, False: 3.57k]
  ------------------
   53|       |
   54|       |  /* Make sure image isn't bigger than I can handle */
   55|  5.06k|  if ((long)cinfo->image_height > (long)JPEG_MAX_DIMENSION ||
  ------------------
  |  |  158|  10.1k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (55:7): [True: 3, False: 5.05k]
  ------------------
   56|  5.05k|      (long)cinfo->image_width > (long)JPEG_MAX_DIMENSION)
  ------------------
  |  |  158|  5.05k|#define JPEG_MAX_DIMENSION  65500L  /* a tad under 64K to prevent overflows */
  ------------------
  |  Branch (56:7): [True: 10, False: 5.04k]
  ------------------
   57|     13|    ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int)JPEG_MAX_DIMENSION);
  ------------------
  |  |  243|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     13|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     13|   (*(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|  5.06k|#ifdef D_LOSSLESS_SUPPORTED
   63|  5.06k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (63:7): [True: 1.47k, False: 3.58k]
  ------------------
   64|  1.47k|    if (cinfo->data_precision < 2 || cinfo->data_precision > 16)
  ------------------
  |  Branch (64:9): [True: 1, False: 1.47k]
  |  Branch (64:38): [True: 5, False: 1.46k]
  ------------------
   65|      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)))
  ------------------
   66|  1.47k|  } else
   67|  3.58k|#endif
   68|  3.58k|  {
   69|  3.58k|    if (cinfo->data_precision != 8 && cinfo->data_precision != 12)
  ------------------
  |  Branch (69:9): [True: 479, False: 3.10k]
  |  Branch (69:39): [True: 16, False: 463]
  ------------------
   70|     16|      ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
  ------------------
  |  |  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)))
  ------------------
   71|  3.58k|  }
   72|       |
   73|       |  /* Check that number of components won't exceed internal array sizes */
   74|  5.06k|  if (cinfo->num_components > MAX_COMPONENTS)
  ------------------
  |  |   30|  5.06k|#define MAX_COMPONENTS  10      /* maximum number of image components */
  ------------------
  |  Branch (74:7): [True: 0, False: 5.06k]
  ------------------
   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|  5.06k|             MAX_COMPONENTS);
   77|       |
   78|       |  /* Compute maximum sampling factors; check factor validity */
   79|  5.06k|  cinfo->max_h_samp_factor = 1;
   80|  5.06k|  cinfo->max_v_samp_factor = 1;
   81|  18.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (81:44): [True: 13.2k, False: 5.06k]
  ------------------
   82|  13.2k|       ci++, compptr++) {
   83|  13.2k|    if (compptr->h_samp_factor <= 0 ||
  ------------------
  |  Branch (83:9): [True: 1, False: 13.2k]
  ------------------
   84|  13.2k|        compptr->h_samp_factor > MAX_SAMP_FACTOR ||
  ------------------
  |  |   72|  26.4k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (84:9): [True: 11, False: 13.2k]
  ------------------
   85|  13.2k|        compptr->v_samp_factor <= 0 ||
  ------------------
  |  Branch (85:9): [True: 10, False: 13.2k]
  ------------------
   86|  13.2k|        compptr->v_samp_factor > MAX_SAMP_FACTOR)
  ------------------
  |  |   72|  13.2k|#define MAX_SAMP_FACTOR     4   /* JPEG limit on sampling factors */
  ------------------
  |  Branch (86:9): [True: 3, False: 13.2k]
  ------------------
   87|     25|      ERREXIT(cinfo, JERR_BAD_SAMPLING);
  ------------------
  |  |  240|     25|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     25|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
   88|  13.2k|    cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
  ------------------
  |  |  513|  13.2k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 4.28k, False: 8.94k]
  |  |  ------------------
  ------------------
   89|  13.2k|                                   compptr->h_samp_factor);
   90|  13.2k|    cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
  ------------------
  |  |  513|  13.2k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 5.17k, False: 8.05k]
  |  |  ------------------
  ------------------
   91|  13.2k|                                   compptr->v_samp_factor);
   92|  13.2k|  }
   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|  5.06k|  cinfo->min_DCT_scaled_size = data_unit;
  108|  5.06k|#endif
  109|       |
  110|       |  /* Compute dimensions of components */
  111|  18.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (111:44): [True: 13.1k, False: 5.06k]
  ------------------
  112|  13.1k|       ci++, compptr++) {
  113|       |#if JPEG_LIB_VERSION >= 70
  114|       |    compptr->DCT_h_scaled_size = compptr->DCT_v_scaled_size = data_unit;
  115|       |#else
  116|  13.1k|    compptr->DCT_scaled_size = data_unit;
  117|  13.1k|#endif
  118|       |    /* Size in data units */
  119|  13.1k|    compptr->width_in_blocks = (JDIMENSION)
  120|  13.1k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  121|  13.1k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  122|  13.1k|    compptr->height_in_blocks = (JDIMENSION)
  123|  13.1k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  124|  13.1k|                    (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|  13.1k|    cinfo->master->first_MCU_col[ci] = 0;
  129|  13.1k|    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|  13.1k|    compptr->downsampled_width = (JDIMENSION)
  136|  13.1k|      jdiv_round_up((long)cinfo->image_width * (long)compptr->h_samp_factor,
  137|  13.1k|                    (long)cinfo->max_h_samp_factor);
  138|  13.1k|    compptr->downsampled_height = (JDIMENSION)
  139|  13.1k|      jdiv_round_up((long)cinfo->image_height * (long)compptr->v_samp_factor,
  140|  13.1k|                    (long)cinfo->max_v_samp_factor);
  141|       |    /* Mark component needed, until color conversion says otherwise */
  142|  13.1k|    compptr->component_needed = TRUE;
  ------------------
  |  |  210|  13.1k|#define TRUE    1
  ------------------
  143|       |    /* Mark no quantization table yet saved for component */
  144|  13.1k|    compptr->quant_table = NULL;
  145|  13.1k|  }
  146|       |
  147|       |  /* Compute number of fully interleaved MCU rows. */
  148|  5.06k|  cinfo->total_iMCU_rows = (JDIMENSION)
  149|  5.06k|    jdiv_round_up((long)cinfo->image_height,
  150|  5.06k|                  (long)(cinfo->max_v_samp_factor * data_unit));
  151|       |
  152|       |  /* Decide whether file contains multiple scans */
  153|  5.06k|  if (cinfo->comps_in_scan < cinfo->num_components || cinfo->progressive_mode)
  ------------------
  |  Branch (153:7): [True: 1.35k, False: 3.71k]
  |  Branch (153:55): [True: 1.73k, False: 1.97k]
  ------------------
  154|  3.02k|    cinfo->inputctl->has_multiple_scans = TRUE;
  ------------------
  |  |  210|  3.02k|#define TRUE    1
  ------------------
  155|  2.03k|  else
  156|  2.03k|    cinfo->inputctl->has_multiple_scans = FALSE;
  ------------------
  |  |  207|  2.03k|#define FALSE   0               /* values of boolean */
  ------------------
  157|  5.06k|}
jdinput.c:reset_input_controller:
  383|  6.47k|{
  384|  6.47k|  my_inputctl_ptr inputctl = (my_inputctl_ptr)cinfo->inputctl;
  385|       |
  386|  6.47k|  inputctl->pub.consume_input = consume_markers;
  387|  6.47k|  inputctl->pub.has_multiple_scans = FALSE; /* "unknown" would be better */
  ------------------
  |  |  207|  6.47k|#define FALSE   0               /* values of boolean */
  ------------------
  388|  6.47k|  inputctl->pub.eoi_reached = FALSE;
  ------------------
  |  |  207|  6.47k|#define FALSE   0               /* values of boolean */
  ------------------
  389|  6.47k|  inputctl->inheaders = TRUE;
  ------------------
  |  |  210|  6.47k|#define TRUE    1
  ------------------
  390|       |  /* Reset other modules */
  391|  6.47k|  (*cinfo->err->reset_error_mgr) ((j_common_ptr)cinfo);
  392|  6.47k|  (*cinfo->marker->reset_marker_reader) (cinfo);
  393|       |  /* Reset progression state -- would be cleaner if entropy decoder did this */
  394|       |  cinfo->coef_bits = NULL;
  395|  6.47k|}
jdinput.c:start_input_pass:
  297|  11.2k|{
  298|  11.2k|  per_scan_setup(cinfo);
  299|  11.2k|  if (!cinfo->master->lossless)
  ------------------
  |  Branch (299:7): [True: 6.55k, False: 4.66k]
  ------------------
  300|  6.55k|    latch_quant_tables(cinfo);
  301|  11.2k|  (*cinfo->entropy->start_pass) (cinfo);
  302|  11.2k|  (*cinfo->coef->start_input_pass) (cinfo);
  303|  11.2k|  cinfo->inputctl->consume_input = cinfo->coef->consume_data;
  304|  11.2k|}
jdinput.c:per_scan_setup:
  164|  11.2k|{
  165|  11.2k|  int ci, mcublks, tmp;
  166|  11.2k|  jpeg_component_info *compptr;
  167|  11.2k|  int data_unit = cinfo->master->lossless ? 1 : DCTSIZE;
  ------------------
  |  |   66|  6.56k|#define DCTSIZE             8   /* The basic DCT block is 8x8 samples */
  ------------------
  |  Branch (167:19): [True: 4.65k, False: 6.56k]
  ------------------
  168|       |
  169|  11.2k|  if (cinfo->comps_in_scan == 1) {
  ------------------
  |  Branch (169:7): [True: 8.08k, False: 3.13k]
  ------------------
  170|       |
  171|       |    /* Noninterleaved (single-component) scan */
  172|  8.08k|    compptr = cinfo->cur_comp_info[0];
  173|       |
  174|       |    /* Overall image size in MCUs */
  175|  8.08k|    cinfo->MCUs_per_row = compptr->width_in_blocks;
  176|  8.08k|    cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
  177|       |
  178|       |    /* For noninterleaved scan, always one data unit per MCU */
  179|  8.08k|    compptr->MCU_width = 1;
  180|  8.08k|    compptr->MCU_height = 1;
  181|  8.08k|    compptr->MCU_blocks = 1;
  182|  8.08k|    compptr->MCU_sample_width = compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  8.08k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  183|  8.08k|    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|  8.08k|    tmp = (int)(compptr->height_in_blocks % compptr->v_samp_factor);
  188|  8.08k|    if (tmp == 0) tmp = compptr->v_samp_factor;
  ------------------
  |  Branch (188:9): [True: 5.77k, False: 2.31k]
  ------------------
  189|  8.08k|    compptr->last_row_height = tmp;
  190|       |
  191|       |    /* Prepare array describing MCU composition */
  192|  8.08k|    cinfo->blocks_in_MCU = 1;
  193|  8.08k|    cinfo->MCU_membership[0] = 0;
  194|       |
  195|  8.08k|  } else {
  196|       |
  197|       |    /* Interleaved (multi-component) scan */
  198|  3.13k|    if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  3.13k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (198:9): [True: 0, False: 3.13k]
  |  Branch (198:38): [True: 0, False: 3.13k]
  ------------------
  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|  3.13k|               MAX_COMPS_IN_SCAN);
  201|       |
  202|       |    /* Overall image size in MCUs */
  203|  3.13k|    cinfo->MCUs_per_row = (JDIMENSION)
  204|  3.13k|      jdiv_round_up((long)cinfo->image_width,
  205|  3.13k|                    (long)(cinfo->max_h_samp_factor * data_unit));
  206|  3.13k|    cinfo->MCU_rows_in_scan = (JDIMENSION)
  207|  3.13k|      jdiv_round_up((long)cinfo->image_height,
  208|  3.13k|                    (long)(cinfo->max_v_samp_factor * data_unit));
  209|       |
  210|  3.13k|    cinfo->blocks_in_MCU = 0;
  211|       |
  212|  12.9k|    for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (212:18): [True: 9.84k, False: 3.13k]
  ------------------
  213|  9.84k|      compptr = cinfo->cur_comp_info[ci];
  214|       |      /* Sampling factors give # of data units of component in each MCU */
  215|  9.84k|      compptr->MCU_width = compptr->h_samp_factor;
  216|  9.84k|      compptr->MCU_height = compptr->v_samp_factor;
  217|  9.84k|      compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
  218|  9.84k|      compptr->MCU_sample_width = compptr->MCU_width *
  219|  9.84k|                                  compptr->_DCT_scaled_size;
  ------------------
  |  |   24|  9.84k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  220|       |      /* Figure number of non-dummy data units in last MCU column & row */
  221|  9.84k|      tmp = (int)(compptr->width_in_blocks % compptr->MCU_width);
  222|  9.84k|      if (tmp == 0) tmp = compptr->MCU_width;
  ------------------
  |  Branch (222:11): [True: 8.73k, False: 1.11k]
  ------------------
  223|  9.84k|      compptr->last_col_width = tmp;
  224|  9.84k|      tmp = (int)(compptr->height_in_blocks % compptr->MCU_height);
  225|  9.84k|      if (tmp == 0) tmp = compptr->MCU_height;
  ------------------
  |  Branch (225:11): [True: 7.45k, False: 2.38k]
  ------------------
  226|  9.84k|      compptr->last_row_height = tmp;
  227|       |      /* Prepare array describing MCU composition */
  228|  9.84k|      mcublks = compptr->MCU_blocks;
  229|  9.84k|      if (cinfo->blocks_in_MCU + mcublks > D_MAX_BLOCKS_IN_MCU)
  ------------------
  |  |   82|  9.84k|#define D_MAX_BLOCKS_IN_MCU   10 /* decompressor's limit on data units/MCU */
  ------------------
  |  Branch (229:11): [True: 14, False: 9.83k]
  ------------------
  230|     14|        ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
  ------------------
  |  |  240|     14|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     14|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  231|  29.4k|      while (mcublks-- > 0) {
  ------------------
  |  Branch (231:14): [True: 19.5k, False: 9.84k]
  ------------------
  232|  19.5k|        cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
  233|  19.5k|      }
  234|  9.84k|    }
  235|       |
  236|  3.13k|  }
  237|  11.2k|}
jdinput.c:latch_quant_tables:
  263|  6.55k|{
  264|  6.55k|  int ci, qtblno;
  265|  6.55k|  jpeg_component_info *compptr;
  266|  6.55k|  JQUANT_TBL *qtbl;
  267|       |
  268|  19.2k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (268:16): [True: 12.7k, False: 6.55k]
  ------------------
  269|  12.7k|    compptr = cinfo->cur_comp_info[ci];
  270|       |    /* No work if we already saved Q-table for this component */
  271|  12.7k|    if (compptr->quant_table != NULL)
  ------------------
  |  Branch (271:9): [True: 4.45k, False: 8.28k]
  ------------------
  272|  4.45k|      continue;
  273|       |    /* Make sure specified quantization table is present */
  274|  8.28k|    qtblno = compptr->quant_tbl_no;
  275|  8.28k|    if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
  ------------------
  |  |   68|  16.5k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (275:9): [True: 0, False: 8.28k]
  |  Branch (275:23): [True: 22, False: 8.26k]
  ------------------
  276|  8.26k|        cinfo->quant_tbl_ptrs[qtblno] == NULL)
  ------------------
  |  Branch (276:9): [True: 32, False: 8.23k]
  ------------------
  277|     54|      ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
  ------------------
  |  |  243|     54|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     54|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     54|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |    /* OK, save away the quantization table */
  279|  8.28k|    qtbl = (JQUANT_TBL *)
  280|  8.28k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.28k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  281|  8.28k|                                  sizeof(JQUANT_TBL));
  282|  8.28k|    memcpy(qtbl, cinfo->quant_tbl_ptrs[qtblno], sizeof(JQUANT_TBL));
  283|  8.28k|    compptr->quant_table = qtbl;
  284|  8.28k|  }
  285|  6.55k|}
jdinput.c:finish_input_pass:
  315|  7.71k|{
  316|  7.71k|  cinfo->inputctl->consume_input = consume_markers;
  317|  7.71k|}

jinit_lhuff_decoder:
  284|  1.40k|{
  285|  1.40k|  lhuff_entropy_ptr entropy;
  286|  1.40k|  int i;
  287|       |
  288|  1.40k|  entropy = (lhuff_entropy_ptr)
  289|  1.40k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.40k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  290|  1.40k|                                sizeof(lhuff_entropy_decoder));
  291|  1.40k|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  292|  1.40k|  entropy->pub.start_pass = start_pass_lhuff_decoder;
  293|  1.40k|  entropy->pub.decode_mcus = decode_mcus;
  294|  1.40k|  entropy->pub.process_restart = process_restart;
  295|       |
  296|       |  /* Mark tables unallocated */
  297|  7.00k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  7.00k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (297:15): [True: 5.60k, False: 1.40k]
  ------------------
  298|       |    entropy->derived_tbls[i] = NULL;
  299|  5.60k|  }
  300|  1.40k|}
jdlhuff.c:start_pass_lhuff_decoder:
   84|  4.65k|{
   85|  4.65k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
   86|  4.65k|  int ci, dctbl, sampn, ptrn, yoffset, xoffset;
   87|  4.65k|  jpeg_component_info *compptr;
   88|       |
   89|  9.74k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (89:16): [True: 5.09k, False: 4.65k]
  ------------------
   90|  5.09k|    compptr = cinfo->cur_comp_info[ci];
   91|  5.09k|    dctbl = compptr->dc_tbl_no;
   92|       |    /* Make sure requested tables are present */
   93|  5.09k|    if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
  ------------------
  |  |   69|  10.1k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (93:9): [True: 0, False: 5.09k]
  |  Branch (93:22): [True: 13, False: 5.08k]
  ------------------
   94|  5.08k|        cinfo->dc_huff_tbl_ptrs[dctbl] == NULL)
  ------------------
  |  Branch (94:9): [True: 15, False: 5.06k]
  ------------------
   95|     28|      ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
  ------------------
  |  |  243|     28|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     28|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     28|   (*(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|  5.09k|    jpeg_make_d_derived_tbl(cinfo, TRUE, dctbl,
  ------------------
  |  |  210|  5.09k|#define TRUE    1
  ------------------
   99|  5.09k|                            &entropy->derived_tbls[dctbl]);
  100|  5.09k|  }
  101|       |
  102|       |  /* Precalculate decoding info for each sample in an MCU of this scan */
  103|  9.66k|  for (sampn = 0, ptrn = 0; sampn < cinfo->blocks_in_MCU;) {
  ------------------
  |  Branch (103:29): [True: 5.01k, False: 4.65k]
  ------------------
  104|  5.01k|    compptr = cinfo->cur_comp_info[cinfo->MCU_membership[sampn]];
  105|  5.01k|    ci = compptr->component_index;
  106|  10.2k|    for (yoffset = 0; yoffset < compptr->MCU_height; yoffset++, ptrn++) {
  ------------------
  |  Branch (106:23): [True: 5.20k, False: 5.01k]
  ------------------
  107|       |      /* Precalculate the setup info for each output pointer */
  108|  5.20k|      entropy->output_ptr_info[ptrn].ci = ci;
  109|  5.20k|      entropy->output_ptr_info[ptrn].yoffset = yoffset;
  110|  5.20k|      entropy->output_ptr_info[ptrn].MCU_width = compptr->MCU_width;
  111|  10.7k|      for (xoffset = 0; xoffset < compptr->MCU_width; xoffset++, sampn++) {
  ------------------
  |  Branch (111:25): [True: 5.50k, False: 5.20k]
  ------------------
  112|       |        /* Precalculate the output pointer index for each sample */
  113|  5.50k|        entropy->output_ptr_index[sampn] = ptrn;
  114|       |        /* Precalculate which table to use for each sample */
  115|  5.50k|        entropy->cur_tbls[sampn] = entropy->derived_tbls[compptr->dc_tbl_no];
  116|  5.50k|      }
  117|  5.20k|    }
  118|  5.01k|  }
  119|  4.65k|  entropy->num_output_ptrs = ptrn;
  120|       |
  121|       |  /* Initialize bitread state variables */
  122|  4.65k|  entropy->bitstate.bits_left = 0;
  123|  4.65k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  124|  4.65k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  4.65k|#define FALSE   0               /* values of boolean */
  ------------------
  125|  4.65k|}
jdlhuff.c:decode_mcus:
  209|  92.6k|{
  210|  92.6k|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  211|  92.6k|  int sampn, ci, yoffset, MCU_width, ptrn;
  212|  92.6k|  JDIMENSION mcu_num;
  213|  92.6k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  92.6k|  register bit_buf_type get_buffer; \
  |  |  126|  92.6k|  register int bits_left; \
  |  |  127|  92.6k|  bitread_working_state br_state
  ------------------
  214|       |
  215|       |  /* Set output pointer locations based on MCU_col_num */
  216|   192k|  for (ptrn = 0; ptrn < entropy->num_output_ptrs; ptrn++) {
  ------------------
  |  Branch (216:18): [True: 99.5k, False: 92.6k]
  ------------------
  217|  99.5k|    ci = entropy->output_ptr_info[ptrn].ci;
  218|  99.5k|    yoffset = entropy->output_ptr_info[ptrn].yoffset;
  219|  99.5k|    MCU_width = entropy->output_ptr_info[ptrn].MCU_width;
  220|  99.5k|    entropy->output_ptr[ptrn] =
  221|  99.5k|      diff_buf[ci][MCU_row_num + yoffset] + (MCU_col_num * MCU_width);
  222|  99.5k|  }
  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|  92.6k|  if (entropy->pub.insufficient_data) {
  ------------------
  |  Branch (231:7): [True: 0, False: 92.6k]
  ------------------
  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|  92.6k|  } else {
  240|       |
  241|       |    /* Load up working state */
  242|  92.6k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  92.6k|  br_state.cinfo = cinfop; \
  |  |  131|  92.6k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  92.6k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  92.6k|  get_buffer = permstate.get_buffer; \
  |  |  134|  92.6k|  bits_left = permstate.bits_left;
  ------------------
  243|       |
  244|       |    /* Outer loop handles the number of MCUs requested */
  245|       |
  246|   613k|    for (mcu_num = 0; mcu_num < nMCU; mcu_num++) {
  ------------------
  |  Branch (246:23): [True: 521k, False: 92.1k]
  ------------------
  247|       |
  248|       |      /* Inner loop handles the samples in the MCU */
  249|  1.21M|      for (sampn = 0; sampn < cinfo->blocks_in_MCU; sampn++) {
  ------------------
  |  Branch (249:23): [True: 690k, False: 521k]
  ------------------
  250|   690k|        d_derived_tbl *dctbl = entropy->cur_tbls[sampn];
  251|   690k|        register int s, r;
  252|       |
  253|       |        /* Section H.2.2: decode the sample difference */
  254|   690k|        HUFF_DECODE(s, br_state, dctbl, return mcu_num, label1);
  ------------------
  |  |  200|   690k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   690k|  register int nb, look; \
  |  |  202|   690k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   690k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 56.2k, False: 634k]
  |  |  ------------------
  |  |  203|  56.2k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 56.2k]
  |  |  ------------------
  |  |  204|  56.2k|      { failaction; } \
  |  |  205|  56.2k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  56.2k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  56.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 785, False: 55.4k]
  |  |  ------------------
  |  |  207|    785|      nb = 1;  goto slowlabel; \
  |  |  208|    785|    } \
  |  |  209|  56.2k|  } \
  |  |  210|   690k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   689k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   689k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   689k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   689k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 688k, False: 933]
  |  |  ------------------
  |  |  212|   688k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   688k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   688k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   688k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   688k|  } else { \
  |  |  215|  1.21k|slowlabel: \
  |  |  216|  1.21k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 1.21k]
  |  |  ------------------
  |  |  217|  1.21k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  1.21k|      { failaction; } \
  |  |  219|  1.21k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  1.21k|  } \
  |  |  221|   689k|}
  ------------------
  255|   689k|        if (s) {
  ------------------
  |  Branch (255:13): [True: 274k, False: 415k]
  ------------------
  256|   274k|          if (s == 16)  /* special case: always output 32768 */
  ------------------
  |  Branch (256:15): [True: 13.4k, False: 261k]
  ------------------
  257|  13.4k|            s = 32768;
  258|   261k|          else {        /* normal case: fetch subsequent bits */
  259|   261k|            CHECK_BIT_BUFFER(br_state, s, return mcu_num);
  ------------------
  |  |  160|   261k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   261k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 900, False: 260k]
  |  |  ------------------
  |  |  162|    900|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 900]
  |  |  ------------------
  |  |  163|    900|      { action; } \
  |  |  164|    900|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    900|  } \
  |  |  166|   261k|}
  ------------------
  260|   261k|            r = GET_BITS(s);
  ------------------
  |  |  169|   261k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  261|   261k|            s = HUFF_EXTEND(r, s);
  ------------------
  |  |  138|   261k|  ((x) + ((((x) - (1 << ((s) - 1))) >> 31) & (((NEG_1) << (s)) + 1)))
  |  |  ------------------
  |  |  |  |  136|   261k|#define NEG_1  ((unsigned int)-1)
  |  |  ------------------
  ------------------
  262|   261k|          }
  263|   274k|        }
  264|       |
  265|       |        /* Output the sample difference */
  266|   689k|        *entropy->output_ptr[entropy->output_ptr_index[sampn]]++ = (JDIFF)s;
  267|   689k|      }
  268|       |
  269|       |      /* Completed MCU, so update state */
  270|   521k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   521k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   521k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   521k|  permstate.get_buffer = get_buffer; \
  |  |  140|   521k|  permstate.bits_left = bits_left
  ------------------
  271|   521k|    }
  272|  92.6k|  }
  273|       |
  274|  92.1k| return nMCU;
  275|  92.6k|}
jdlhuff.c:process_restart:
  167|     22|{
  168|     22|  lhuff_entropy_ptr entropy = (lhuff_entropy_ptr)cinfo->entropy;
  169|       |
  170|       |  /* Throw away any unused bits remaining in bit buffer; */
  171|       |  /* include any full bytes in next_marker's count of discarded bytes */
  172|     22|  cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
  173|     22|  entropy->bitstate.bits_left = 0;
  174|       |
  175|       |  /* Advance past the RSTn marker */
  176|     22|  if (!(*cinfo->marker->read_restart_marker) (cinfo))
  ------------------
  |  Branch (176:7): [True: 0, False: 22]
  ------------------
  177|      0|    return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  178|       |
  179|       |  /* Reset out-of-data flag, unless read_restart_marker left us smack up
  180|       |   * against a marker.  In that case we will end up treating the next data
  181|       |   * segment as empty, and we can avoid producing bogus output pixels by
  182|       |   * leaving the flag set.
  183|       |   */
  184|     22|  if (cinfo->unread_marker == 0)
  ------------------
  |  Branch (184:7): [True: 18, False: 4]
  ------------------
  185|     18|    entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|     18|#define FALSE   0               /* values of boolean */
  ------------------
  186|       |
  187|     22|  return TRUE;
  ------------------
  |  |  210|     22|#define TRUE    1
  ------------------
  188|     22|}

jinit_lossless_decompressor:
  281|    526|{
  282|    526|  lossless_decomp_ptr losslessd;
  283|       |
  284|    526|#if BITS_IN_JSAMPLE == 8
  285|    526|  if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.05k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (285:7): [True: 0, False: 526]
  |  Branch (285:50): [True: 0, False: 526]
  ------------------
  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|    526|  losslessd = (lossless_decomp_ptr)
  294|    526|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    526|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    526|                                sizeof(jpeg_lossless_decompressor));
  296|    526|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    526|  losslessd->pub.start_pass = start_pass_lossless;
  298|    526|}
jdlossls-8.c:start_pass_lossless:
  243|  1.65k|{
  244|  1.65k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  1.65k|  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|  1.65k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 6, False: 1.64k]
  |  Branch (257:24): [True: 13, False: 1.63k]
  ------------------
  258|  1.63k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 4, False: 1.63k]
  |  Branch (258:25): [True: 9, False: 1.62k]
  ------------------
  259|  1.62k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 1.62k]
  |  Branch (259:24): [True: 1, False: 1.62k]
  ------------------
  260|     33|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     33|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     33|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     33|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     33|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     33|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     33|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|  1.65k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  6.59k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 4.93k, False: 1.65k]
  ------------------
  265|  4.93k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  1.65k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 701, False: 953]
  ------------------
  269|    701|    losslessd->scaler_scale = simple_upscale;
  270|    953|  else
  271|    953|    losslessd->scaler_scale = noscale;
  272|  1.65k|}
jdlossls-8.c:jpeg_undifference_first_row:
  177|  1.68k|{
  178|  1.68k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  1.68k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  1.68k|  int Ra; \
  |  |   60|  1.68k|  \
  |  |   61|  1.68k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.68k|  *undiff_buf++ = Ra; \
  |  |   63|  1.68k|  \
  |  |   64|  15.6k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 13.9k, False: 1.68k]
  |  |  ------------------
  |  |   65|  13.9k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  13.9k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  13.9k|    *undiff_buf++ = Ra; \
  |  |   67|  13.9k|  }
  ------------------
  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|  1.68k|  switch (cinfo->Ss) {
  188|    266|  case 1:
  ------------------
  |  Branch (188:3): [True: 266, False: 1.41k]
  ------------------
  189|    266|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|    266|    break;
  191|    234|  case 2:
  ------------------
  |  Branch (191:3): [True: 234, False: 1.45k]
  ------------------
  192|    234|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|    234|    break;
  194|    294|  case 3:
  ------------------
  |  Branch (194:3): [True: 294, False: 1.39k]
  ------------------
  195|    294|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|    294|    break;
  197|    140|  case 4:
  ------------------
  |  Branch (197:3): [True: 140, False: 1.54k]
  ------------------
  198|    140|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|    140|    break;
  200|    403|  case 5:
  ------------------
  |  Branch (200:3): [True: 403, False: 1.28k]
  ------------------
  201|    403|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|    403|    break;
  203|    266|  case 6:
  ------------------
  |  Branch (203:3): [True: 266, False: 1.41k]
  ------------------
  204|    266|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|    266|    break;
  206|     81|  case 7:
  ------------------
  |  Branch (206:3): [True: 81, False: 1.60k]
  ------------------
  207|     81|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|     81|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 1.68k]
  ------------------
  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|  1.68k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  1.68k|  }
  213|  1.68k|}
jdlossls-8.c:jpeg_undifference1:
  111|  3.90k|{
  112|  3.90k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  3.90k|  int Ra; \
  |  |   60|  3.90k|  \
  |  |   61|  3.90k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  3.90k|  *undiff_buf++ = Ra; \
  |  |   63|  3.90k|  \
  |  |   64|   163k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 159k, False: 3.90k]
  |  |  ------------------
  |  |   65|   159k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|   159k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|   159k|    *undiff_buf++ = Ra; \
  |  |   67|   159k|  }
  ------------------
  113|  3.90k|}
jdlossls-8.c:jpeg_undifference2:
  119|  3.07k|{
  120|  3.07k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  3.07k|  int Ra, Rb, Rc; \
  |  |   87|  3.07k|  \
  |  |   88|  3.07k|  Rb = *prev_row++; \
  |  |   89|  3.07k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  3.07k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  3.07k|  *undiff_buf++ = Ra; \
  |  |   91|  3.07k|  \
  |  |   92|  26.8k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 23.7k, False: 3.07k]
  |  |  ------------------
  |  |   93|  23.7k|    Rc = Rb; \
  |  |   94|  23.7k|    Rb = *prev_row++; \
  |  |   95|  23.7k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  23.7k|    *undiff_buf++ = Ra; \
  |  |   97|  23.7k|  }
  ------------------
  121|  3.07k|  (void)(Rc);
  122|  3.07k|}
jdlossls-8.c:jpeg_undifference3:
  128|  4.19k|{
  129|  4.19k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  4.19k|  int Ra, Rb, Rc; \
  |  |   87|  4.19k|  \
  |  |   88|  4.19k|  Rb = *prev_row++; \
  |  |   89|  4.19k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  4.19k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  4.19k|  *undiff_buf++ = Ra; \
  |  |   91|  4.19k|  \
  |  |   92|  35.1k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 30.9k, False: 4.19k]
  |  |  ------------------
  |  |   93|  30.9k|    Rc = Rb; \
  |  |   94|  30.9k|    Rb = *prev_row++; \
  |  |   95|  30.9k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  30.9k|    *undiff_buf++ = Ra; \
  |  |   97|  30.9k|  }
  ------------------
  130|  4.19k|}
jdlossls-8.c:jpeg_undifference4:
  136|  1.99k|{
  137|  1.99k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  1.99k|  int Ra, Rb, Rc; \
  |  |   87|  1.99k|  \
  |  |   88|  1.99k|  Rb = *prev_row++; \
  |  |   89|  1.99k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.99k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.99k|  *undiff_buf++ = Ra; \
  |  |   91|  1.99k|  \
  |  |   92|  4.21k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.22k, False: 1.99k]
  |  |  ------------------
  |  |   93|  2.22k|    Rc = Rb; \
  |  |   94|  2.22k|    Rb = *prev_row++; \
  |  |   95|  2.22k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.22k|    *undiff_buf++ = Ra; \
  |  |   97|  2.22k|  }
  ------------------
  138|  1.99k|}
jdlossls-8.c:jpeg_undifference5:
  144|  16.4k|{
  145|  16.4k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  16.4k|  int Ra, Rb, Rc; \
  |  |   87|  16.4k|  \
  |  |   88|  16.4k|  Rb = *prev_row++; \
  |  |   89|  16.4k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  16.4k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  16.4k|  *undiff_buf++ = Ra; \
  |  |   91|  16.4k|  \
  |  |   92|   215k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 199k, False: 16.4k]
  |  |  ------------------
  |  |   93|   199k|    Rc = Rb; \
  |  |   94|   199k|    Rb = *prev_row++; \
  |  |   95|   199k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|   199k|    *undiff_buf++ = Ra; \
  |  |   97|   199k|  }
  ------------------
  146|  16.4k|}
jdlossls-8.c:jpeg_undifference6:
  152|  1.21k|{
  153|  1.21k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  1.21k|  int Ra, Rb, Rc; \
  |  |   87|  1.21k|  \
  |  |   88|  1.21k|  Rb = *prev_row++; \
  |  |   89|  1.21k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.21k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.21k|  *undiff_buf++ = Ra; \
  |  |   91|  1.21k|  \
  |  |   92|  3.80k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.59k, False: 1.21k]
  |  |  ------------------
  |  |   93|  2.59k|    Rc = Rb; \
  |  |   94|  2.59k|    Rb = *prev_row++; \
  |  |   95|  2.59k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.59k|    *undiff_buf++ = Ra; \
  |  |   97|  2.59k|  }
  ------------------
  154|  1.21k|}
jdlossls-8.c:jpeg_undifference7:
  160|    863|{
  161|    863|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    863|  int Ra, Rb, Rc; \
  |  |   87|    863|  \
  |  |   88|    863|  Rb = *prev_row++; \
  |  |   89|    863|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    863|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    863|  *undiff_buf++ = Ra; \
  |  |   91|    863|  \
  |  |   92|  10.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 9.93k, False: 863]
  |  |  ------------------
  |  |   93|  9.93k|    Rc = Rb; \
  |  |   94|  9.93k|    Rb = *prev_row++; \
  |  |   95|  9.93k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  9.93k|    *undiff_buf++ = Ra; \
  |  |   97|  9.93k|  }
  ------------------
  162|    863|  (void)(Rc);
  163|    863|}
jdlossls-8.c:simple_upscale:
  221|  22.8k|{
  222|   406k|  do {
  223|   406k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   406k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 383k, False: 22.8k]
  ------------------
  225|  22.8k|}
jdlossls-8.c:noscale:
  230|  10.5k|{
  231|  68.8k|  do {
  232|  68.8k|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  68.8k|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 58.2k, False: 10.5k]
  ------------------
  234|  10.5k|}
j12init_lossless_decompressor:
  281|    441|{
  282|    441|  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|    441|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    882|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (287:7): [True: 0, False: 441]
  ------------------
  288|    441|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    441|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (288:7): [True: 0, False: 441]
  ------------------
  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|    441|  losslessd = (lossless_decomp_ptr)
  294|    441|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    441|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    441|                                sizeof(jpeg_lossless_decompressor));
  296|    441|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    441|  losslessd->pub.start_pass = start_pass_lossless;
  298|    441|}
jdlossls-12.c:start_pass_lossless:
  243|  1.26k|{
  244|  1.26k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  1.26k|  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|  1.26k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 17, False: 1.24k]
  |  Branch (257:24): [True: 7, False: 1.23k]
  ------------------
  258|  1.23k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 17, False: 1.21k]
  |  Branch (258:25): [True: 7, False: 1.21k]
  ------------------
  259|  1.21k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 1.21k]
  |  Branch (259:24): [True: 1, False: 1.21k]
  ------------------
  260|     49|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     49|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     49|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     49|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     49|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     49|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     49|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|  1.26k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  4.89k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 3.63k, False: 1.26k]
  ------------------
  265|  3.63k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  1.26k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 640, False: 620]
  ------------------
  269|    640|    losslessd->scaler_scale = simple_upscale;
  270|    620|  else
  271|    620|    losslessd->scaler_scale = noscale;
  272|  1.26k|}
jdlossls-12.c:jpeg_undifference_first_row:
  177|  1.18k|{
  178|  1.18k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  1.18k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  1.18k|  int Ra; \
  |  |   60|  1.18k|  \
  |  |   61|  1.18k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.18k|  *undiff_buf++ = Ra; \
  |  |   63|  1.18k|  \
  |  |   64|  5.85k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 4.67k, False: 1.18k]
  |  |  ------------------
  |  |   65|  4.67k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  4.67k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  4.67k|    *undiff_buf++ = Ra; \
  |  |   67|  4.67k|  }
  ------------------
  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|  1.18k|  switch (cinfo->Ss) {
  188|    208|  case 1:
  ------------------
  |  Branch (188:3): [True: 208, False: 972]
  ------------------
  189|    208|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|    208|    break;
  191|    204|  case 2:
  ------------------
  |  Branch (191:3): [True: 204, False: 976]
  ------------------
  192|    204|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|    204|    break;
  194|    156|  case 3:
  ------------------
  |  Branch (194:3): [True: 156, False: 1.02k]
  ------------------
  195|    156|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|    156|    break;
  197|    116|  case 4:
  ------------------
  |  Branch (197:3): [True: 116, False: 1.06k]
  ------------------
  198|    116|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|    116|    break;
  200|    127|  case 5:
  ------------------
  |  Branch (200:3): [True: 127, False: 1.05k]
  ------------------
  201|    127|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|    127|    break;
  203|    210|  case 6:
  ------------------
  |  Branch (203:3): [True: 210, False: 970]
  ------------------
  204|    210|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|    210|    break;
  206|    159|  case 7:
  ------------------
  |  Branch (206:3): [True: 159, False: 1.02k]
  ------------------
  207|    159|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|    159|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 1.18k]
  ------------------
  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|  1.18k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  1.18k|  }
  213|  1.18k|}
jdlossls-12.c:jpeg_undifference1:
  111|  4.54k|{
  112|  4.54k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  4.54k|  int Ra; \
  |  |   60|  4.54k|  \
  |  |   61|  4.54k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  4.54k|  *undiff_buf++ = Ra; \
  |  |   63|  4.54k|  \
  |  |   64|  8.99k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 4.44k, False: 4.54k]
  |  |  ------------------
  |  |   65|  4.44k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  4.44k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  4.44k|    *undiff_buf++ = Ra; \
  |  |   67|  4.44k|  }
  ------------------
  113|  4.54k|}
jdlossls-12.c:jpeg_undifference2:
  119|  2.34k|{
  120|  2.34k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  2.34k|  int Ra, Rb, Rc; \
  |  |   87|  2.34k|  \
  |  |   88|  2.34k|  Rb = *prev_row++; \
  |  |   89|  2.34k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.34k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.34k|  *undiff_buf++ = Ra; \
  |  |   91|  2.34k|  \
  |  |   92|  17.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 15.3k, False: 2.34k]
  |  |  ------------------
  |  |   93|  15.3k|    Rc = Rb; \
  |  |   94|  15.3k|    Rb = *prev_row++; \
  |  |   95|  15.3k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  15.3k|    *undiff_buf++ = Ra; \
  |  |   97|  15.3k|  }
  ------------------
  121|  2.34k|  (void)(Rc);
  122|  2.34k|}
jdlossls-12.c:jpeg_undifference3:
  128|  1.75k|{
  129|  1.75k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  1.75k|  int Ra, Rb, Rc; \
  |  |   87|  1.75k|  \
  |  |   88|  1.75k|  Rb = *prev_row++; \
  |  |   89|  1.75k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.75k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.75k|  *undiff_buf++ = Ra; \
  |  |   91|  1.75k|  \
  |  |   92|  18.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 17.0k, False: 1.75k]
  |  |  ------------------
  |  |   93|  17.0k|    Rc = Rb; \
  |  |   94|  17.0k|    Rb = *prev_row++; \
  |  |   95|  17.0k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  17.0k|    *undiff_buf++ = Ra; \
  |  |   97|  17.0k|  }
  ------------------
  130|  1.75k|}
jdlossls-12.c:jpeg_undifference4:
  136|  1.33k|{
  137|  1.33k|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|  1.33k|  int Ra, Rb, Rc; \
  |  |   87|  1.33k|  \
  |  |   88|  1.33k|  Rb = *prev_row++; \
  |  |   89|  1.33k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.33k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.33k|  *undiff_buf++ = Ra; \
  |  |   91|  1.33k|  \
  |  |   92|  3.28k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.94k, False: 1.33k]
  |  |  ------------------
  |  |   93|  1.94k|    Rc = Rb; \
  |  |   94|  1.94k|    Rb = *prev_row++; \
  |  |   95|  1.94k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.94k|    *undiff_buf++ = Ra; \
  |  |   97|  1.94k|  }
  ------------------
  138|  1.33k|}
jdlossls-12.c:jpeg_undifference5:
  144|  1.59k|{
  145|  1.59k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.59k|  int Ra, Rb, Rc; \
  |  |   87|  1.59k|  \
  |  |   88|  1.59k|  Rb = *prev_row++; \
  |  |   89|  1.59k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.59k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.59k|  *undiff_buf++ = Ra; \
  |  |   91|  1.59k|  \
  |  |   92|  6.29k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 4.70k, False: 1.59k]
  |  |  ------------------
  |  |   93|  4.70k|    Rc = Rb; \
  |  |   94|  4.70k|    Rb = *prev_row++; \
  |  |   95|  4.70k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  4.70k|    *undiff_buf++ = Ra; \
  |  |   97|  4.70k|  }
  ------------------
  146|  1.59k|}
jdlossls-12.c:jpeg_undifference6:
  152|  1.36k|{
  153|  1.36k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  1.36k|  int Ra, Rb, Rc; \
  |  |   87|  1.36k|  \
  |  |   88|  1.36k|  Rb = *prev_row++; \
  |  |   89|  1.36k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.36k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.36k|  *undiff_buf++ = Ra; \
  |  |   91|  1.36k|  \
  |  |   92|  3.91k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.54k, False: 1.36k]
  |  |  ------------------
  |  |   93|  2.54k|    Rc = Rb; \
  |  |   94|  2.54k|    Rb = *prev_row++; \
  |  |   95|  2.54k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.54k|    *undiff_buf++ = Ra; \
  |  |   97|  2.54k|  }
  ------------------
  154|  1.36k|}
jdlossls-12.c:jpeg_undifference7:
  160|  2.25k|{
  161|  2.25k|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|  2.25k|  int Ra, Rb, Rc; \
  |  |   87|  2.25k|  \
  |  |   88|  2.25k|  Rb = *prev_row++; \
  |  |   89|  2.25k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  2.25k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  2.25k|  *undiff_buf++ = Ra; \
  |  |   91|  2.25k|  \
  |  |   92|  6.04k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 3.78k, False: 2.25k]
  |  |  ------------------
  |  |   93|  3.78k|    Rc = Rb; \
  |  |   94|  3.78k|    Rb = *prev_row++; \
  |  |   95|  3.78k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  3.78k|    *undiff_buf++ = Ra; \
  |  |   97|  3.78k|  }
  ------------------
  162|  2.25k|  (void)(Rc);
  163|  2.25k|}
jdlossls-12.c:simple_upscale:
  221|  8.77k|{
  222|  31.2k|  do {
  223|  31.2k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|  31.2k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 22.4k, False: 8.77k]
  ------------------
  225|  8.77k|}
jdlossls-12.c:noscale:
  230|  7.60k|{
  231|  39.6k|  do {
  232|  39.6k|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  39.6k|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 32.0k, False: 7.60k]
  ------------------
  234|  7.60k|}
j16init_lossless_decompressor:
  281|    454|{
  282|    454|  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|    454|  if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    908|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (287:7): [True: 0, False: 454]
  ------------------
  288|    454|      cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    454|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (288:7): [True: 0, False: 454]
  ------------------
  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|    454|  losslessd = (lossless_decomp_ptr)
  294|    454|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|    454|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  295|    454|                                sizeof(jpeg_lossless_decompressor));
  296|    454|  cinfo->idct = (struct jpeg_inverse_dct *)losslessd;
  297|    454|  losslessd->pub.start_pass = start_pass_lossless;
  298|    454|}
jdlossls-16.c:start_pass_lossless:
  243|  1.85k|{
  244|  1.85k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  245|  1.85k|  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|  1.85k|  if (cinfo->Ss < 1 || cinfo->Ss > 7 ||
  ------------------
  |  Branch (257:7): [True: 22, False: 1.83k]
  |  Branch (257:24): [True: 6, False: 1.82k]
  ------------------
  258|  1.82k|      cinfo->Se != 0 || cinfo->Ah != 0 ||
  ------------------
  |  Branch (258:7): [True: 8, False: 1.81k]
  |  Branch (258:25): [True: 12, False: 1.80k]
  ------------------
  259|  1.80k|      cinfo->Al < 0 || cinfo->Al >= cinfo->data_precision)
  ------------------
  |  Branch (259:7): [True: 0, False: 1.80k]
  |  Branch (259:24): [True: 16, False: 1.78k]
  ------------------
  260|     64|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     64|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     64|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     64|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     64|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     64|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     64|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  261|  1.85k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  262|       |
  263|       |  /* Set undifference functions to first row function */
  264|  7.22k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (264:16): [True: 5.37k, False: 1.85k]
  ------------------
  265|  5.37k|    losslessd->predict_undifference[ci] = jpeg_undifference_first_row;
  266|       |
  267|       |  /* Set scaler function based on Pt */
  268|  1.85k|  if (cinfo->Al)
  ------------------
  |  Branch (268:7): [True: 1.22k, False: 629]
  ------------------
  269|  1.22k|    losslessd->scaler_scale = simple_upscale;
  270|    629|  else
  271|    629|    losslessd->scaler_scale = noscale;
  272|  1.85k|}
jdlossls-16.c:jpeg_undifference_first_row:
  177|  1.74k|{
  178|  1.74k|  lossless_decomp_ptr losslessd = (lossless_decomp_ptr)cinfo->idct;
  179|       |
  180|  1.74k|  UNDIFFERENCE_1D(INITIAL_PREDICTORx);
  ------------------
  |  |   59|  1.74k|  int Ra; \
  |  |   60|  1.74k|  \
  |  |   61|  1.74k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.74k|  *undiff_buf++ = Ra; \
  |  |   63|  1.74k|  \
  |  |   64|  8.74k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 6.99k, False: 1.74k]
  |  |  ------------------
  |  |   65|  6.99k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  6.99k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  6.99k|    *undiff_buf++ = Ra; \
  |  |   67|  6.99k|  }
  ------------------
  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|  1.74k|  switch (cinfo->Ss) {
  188|    257|  case 1:
  ------------------
  |  Branch (188:3): [True: 257, False: 1.48k]
  ------------------
  189|    257|    losslessd->predict_undifference[comp_index] = jpeg_undifference1;
  190|    257|    break;
  191|    190|  case 2:
  ------------------
  |  Branch (191:3): [True: 190, False: 1.55k]
  ------------------
  192|    190|    losslessd->predict_undifference[comp_index] = jpeg_undifference2;
  193|    190|    break;
  194|    765|  case 3:
  ------------------
  |  Branch (194:3): [True: 765, False: 980]
  ------------------
  195|    765|    losslessd->predict_undifference[comp_index] = jpeg_undifference3;
  196|    765|    break;
  197|    120|  case 4:
  ------------------
  |  Branch (197:3): [True: 120, False: 1.62k]
  ------------------
  198|    120|    losslessd->predict_undifference[comp_index] = jpeg_undifference4;
  199|    120|    break;
  200|    143|  case 5:
  ------------------
  |  Branch (200:3): [True: 143, False: 1.60k]
  ------------------
  201|    143|    losslessd->predict_undifference[comp_index] = jpeg_undifference5;
  202|    143|    break;
  203|    124|  case 6:
  ------------------
  |  Branch (203:3): [True: 124, False: 1.62k]
  ------------------
  204|    124|    losslessd->predict_undifference[comp_index] = jpeg_undifference6;
  205|    124|    break;
  206|    146|  case 7:
  ------------------
  |  Branch (206:3): [True: 146, False: 1.59k]
  ------------------
  207|    146|    losslessd->predict_undifference[comp_index] = jpeg_undifference7;
  208|    146|    break;
  209|      0|  default:
  ------------------
  |  Branch (209:3): [True: 0, False: 1.74k]
  ------------------
  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|  1.74k|             cinfo->Ss, cinfo->Se, cinfo->Ah, cinfo->Al);
  212|  1.74k|  }
  213|  1.74k|}
jdlossls-16.c:jpeg_undifference1:
  111|  1.63k|{
  112|  1.63k|  UNDIFFERENCE_1D(INITIAL_PREDICTOR2);
  ------------------
  |  |   59|  1.63k|  int Ra; \
  |  |   60|  1.63k|  \
  |  |   61|  1.63k|  Ra = (*diff_buf++ + INITIAL_PREDICTOR) & 0xFFFF; \
  |  |   62|  1.63k|  *undiff_buf++ = Ra; \
  |  |   63|  1.63k|  \
  |  |   64|  6.36k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (64:10): [True: 4.72k, False: 1.63k]
  |  |  ------------------
  |  |   65|  4.72k|    Ra = (*diff_buf++ + PREDICTOR1) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   37|  4.72k|#define PREDICTOR1  Ra
  |  |  ------------------
  |  |   66|  4.72k|    *undiff_buf++ = Ra; \
  |  |   67|  4.72k|  }
  ------------------
  113|  1.63k|}
jdlossls-16.c:jpeg_undifference2:
  119|  1.67k|{
  120|  1.67k|  UNDIFFERENCE_2D(PREDICTOR2);
  ------------------
  |  |   86|  1.67k|  int Ra, Rb, Rc; \
  |  |   87|  1.67k|  \
  |  |   88|  1.67k|  Rb = *prev_row++; \
  |  |   89|  1.67k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.67k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.67k|  *undiff_buf++ = Ra; \
  |  |   91|  1.67k|  \
  |  |   92|  14.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 13.0k, False: 1.67k]
  |  |  ------------------
  |  |   93|  13.0k|    Rc = Rb; \
  |  |   94|  13.0k|    Rb = *prev_row++; \
  |  |   95|  13.0k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  13.0k|    *undiff_buf++ = Ra; \
  |  |   97|  13.0k|  }
  ------------------
  121|  1.67k|  (void)(Rc);
  122|  1.67k|}
jdlossls-16.c:jpeg_undifference3:
  128|  3.29k|{
  129|  3.29k|  UNDIFFERENCE_2D(PREDICTOR3);
  ------------------
  |  |   86|  3.29k|  int Ra, Rb, Rc; \
  |  |   87|  3.29k|  \
  |  |   88|  3.29k|  Rb = *prev_row++; \
  |  |   89|  3.29k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  3.29k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  3.29k|  *undiff_buf++ = Ra; \
  |  |   91|  3.29k|  \
  |  |   92|  17.7k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 14.4k, False: 3.29k]
  |  |  ------------------
  |  |   93|  14.4k|    Rc = Rb; \
  |  |   94|  14.4k|    Rb = *prev_row++; \
  |  |   95|  14.4k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  14.4k|    *undiff_buf++ = Ra; \
  |  |   97|  14.4k|  }
  ------------------
  130|  3.29k|}
jdlossls-16.c:jpeg_undifference4:
  136|    839|{
  137|    839|  UNDIFFERENCE_2D(PREDICTOR4);
  ------------------
  |  |   86|    839|  int Ra, Rb, Rc; \
  |  |   87|    839|  \
  |  |   88|    839|  Rb = *prev_row++; \
  |  |   89|    839|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    839|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    839|  *undiff_buf++ = Ra; \
  |  |   91|    839|  \
  |  |   92|  2.80k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 1.97k, False: 839]
  |  |  ------------------
  |  |   93|  1.97k|    Rc = Rb; \
  |  |   94|  1.97k|    Rb = *prev_row++; \
  |  |   95|  1.97k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  1.97k|    *undiff_buf++ = Ra; \
  |  |   97|  1.97k|  }
  ------------------
  138|    839|}
jdlossls-16.c:jpeg_undifference5:
  144|  1.14k|{
  145|  1.14k|  UNDIFFERENCE_2D(PREDICTOR5);
  ------------------
  |  |   86|  1.14k|  int Ra, Rb, Rc; \
  |  |   87|  1.14k|  \
  |  |   88|  1.14k|  Rb = *prev_row++; \
  |  |   89|  1.14k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  1.14k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  1.14k|  *undiff_buf++ = Ra; \
  |  |   91|  1.14k|  \
  |  |   92|  3.98k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.83k, False: 1.14k]
  |  |  ------------------
  |  |   93|  2.83k|    Rc = Rb; \
  |  |   94|  2.83k|    Rb = *prev_row++; \
  |  |   95|  2.83k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.83k|    *undiff_buf++ = Ra; \
  |  |   97|  2.83k|  }
  ------------------
  146|  1.14k|}
jdlossls-16.c:jpeg_undifference6:
  152|  36.6k|{
  153|  36.6k|  UNDIFFERENCE_2D(PREDICTOR6);
  ------------------
  |  |   86|  36.6k|  int Ra, Rb, Rc; \
  |  |   87|  36.6k|  \
  |  |   88|  36.6k|  Rb = *prev_row++; \
  |  |   89|  36.6k|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|  36.6k|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|  36.6k|  *undiff_buf++ = Ra; \
  |  |   91|  36.6k|  \
  |  |   92|  74.8k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 38.2k, False: 36.6k]
  |  |  ------------------
  |  |   93|  38.2k|    Rc = Rb; \
  |  |   94|  38.2k|    Rb = *prev_row++; \
  |  |   95|  38.2k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  38.2k|    *undiff_buf++ = Ra; \
  |  |   97|  38.2k|  }
  ------------------
  154|  36.6k|}
jdlossls-16.c:jpeg_undifference7:
  160|    999|{
  161|    999|  UNDIFFERENCE_2D(PREDICTOR7);
  ------------------
  |  |   86|    999|  int Ra, Rb, Rc; \
  |  |   87|    999|  \
  |  |   88|    999|  Rb = *prev_row++; \
  |  |   89|    999|  Ra = (*diff_buf++ + PREDICTOR2) & 0xFFFF; \
  |  |  ------------------
  |  |  |  |   38|    999|#define PREDICTOR2  Rb
  |  |  ------------------
  |  |   90|    999|  *undiff_buf++ = Ra; \
  |  |   91|    999|  \
  |  |   92|  3.61k|  while (--width) { \
  |  |  ------------------
  |  |  |  Branch (92:10): [True: 2.61k, False: 999]
  |  |  ------------------
  |  |   93|  2.61k|    Rc = Rb; \
  |  |   94|  2.61k|    Rb = *prev_row++; \
  |  |   95|  2.61k|    Ra = (*diff_buf++ + PREDICTOR) & 0xFFFF; \
  |  |   96|  2.61k|    *undiff_buf++ = Ra; \
  |  |   97|  2.61k|  }
  ------------------
  162|    999|  (void)(Rc);
  163|    999|}
jdlossls-16.c:simple_upscale:
  221|  42.6k|{
  222|   104k|  do {
  223|   104k|    *output_buf++ = (_JSAMPLE)(*diff_buf++ << cinfo->Al);
  224|   104k|  } while (--width);
  ------------------
  |  Branch (224:12): [True: 61.9k, False: 42.6k]
  ------------------
  225|  42.6k|}
jdlossls-16.c:noscale:
  230|  5.32k|{
  231|  28.1k|  do {
  232|  28.1k|    *output_buf++ = (_JSAMPLE)(*diff_buf++);
  233|  28.1k|  } while (--width);
  ------------------
  |  Branch (233:12): [True: 22.8k, False: 5.32k]
  ------------------
  234|  5.32k|}

jinit_d_main_controller:
  429|  3.51k|{
  430|  3.51k|  my_main_ptr main_ptr;
  431|  3.51k|  int ci, rgroup, ngroups;
  432|  3.51k|  jpeg_component_info *compptr;
  433|       |
  434|  3.51k|#ifdef D_LOSSLESS_SUPPORTED
  435|  3.51k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 523, False: 2.99k]
  ------------------
  436|    523|#if BITS_IN_JSAMPLE == 8
  437|    523|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.04k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (437:9): [True: 0, False: 523]
  |  Branch (437:52): [True: 0, False: 523]
  ------------------
  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|    523|  } else
  444|  2.99k|#endif
  445|  2.99k|  {
  446|  2.99k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  2.99k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (446:9): [True: 0, False: 2.99k]
  ------------------
  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|  2.99k|  }
  449|       |
  450|  3.51k|  main_ptr = (my_main_ptr)
  451|  3.51k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.51k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|  3.51k|                                sizeof(my_main_controller));
  453|  3.51k|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|  3.51k|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|  3.51k|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|  3.51k|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 3.51k]
  ------------------
  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|  3.51k|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 1.45k, False: 2.06k]
  ------------------
  464|  1.45k|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|  1.45k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 1.45k]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|  1.45k|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|  1.45k|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|  1.45k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|  2.06k|  } else {
  469|  2.06k|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  2.06k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|  2.06k|  }
  471|       |
  472|  12.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 8.71k, False: 3.51k]
  ------------------
  473|  8.71k|       ci++, compptr++) {
  474|  8.71k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  8.71k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  8.71k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  8.71k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  8.71k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  8.71k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  8.71k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  8.71k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  8.71k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  8.71k|                         (JDIMENSION)(rgroup * ngroups));
  480|  8.71k|  }
  481|  3.51k|}
jdmainct-8.c:start_pass_main:
  259|  2.15k|{
  260|  2.15k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|  2.15k|  switch (pass_mode) {
  263|  2.15k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 2.15k, False: 0]
  ------------------
  264|  2.15k|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 760, False: 1.39k]
  ------------------
  265|    760|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  256|    760|#define _process_data  process_data
  ------------------
  266|    760|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|    760|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|    760|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|    760|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|    760|      main_ptr->iMCU_row_ctr = 0;
  270|  1.39k|    } else {
  271|       |      /* Simple case with no context needed */
  272|  1.39k|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  256|  1.39k|#define _process_data  process_data
  ------------------
  273|  1.39k|    }
  274|  2.15k|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|  2.15k|#define FALSE   0               /* values of boolean */
  ------------------
  275|  2.15k|    main_ptr->rowgroup_ctr = 0;
  276|  2.15k|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 2.15k]
  ------------------
  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: 2.15k]
  ------------------
  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|  2.15k|  }
  287|  2.15k|}
jdmainct-8.c:process_data_context_main:
  337|   279k|{
  338|   279k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  339|       |
  340|       |  /* Read input data if we haven't filled the main buffer yet */
  341|   279k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (341:7): [True: 11.3k, False: 268k]
  ------------------
  342|  11.3k|    if (!(*cinfo->coef->_decompress_data) (cinfo,
  ------------------
  |  |  258|  11.3k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (342:9): [True: 0, False: 11.3k]
  ------------------
  343|  11.3k|                                           main_ptr->xbuffer[main_ptr->whichptr]))
  344|      0|      return;                   /* suspension forced, can do nothing more */
  345|  11.3k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  11.3k|#define TRUE    1
  ------------------
  346|  11.3k|    main_ptr->iMCU_row_ctr++;   /* count rows received */
  347|  11.3k|  }
  348|       |
  349|       |  /* Postprocessor typically will not swallow all the input data it is handed
  350|       |   * in one call (due to filling the output buffer first).  Must be prepared
  351|       |   * to exit and restart.  This switch lets us keep track of how far we got.
  352|       |   * Note that each case falls through to the next on successful completion.
  353|       |   */
  354|   279k|  switch (main_ptr->context_state) {
  ------------------
  |  Branch (354:11): [True: 279k, False: 462]
  ------------------
  355|  34.2k|  case CTX_POSTPONED_ROW:
  ------------------
  |  |   48|  34.2k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  |  Branch (355:3): [True: 34.2k, False: 245k]
  ------------------
  356|       |    /* Call postprocessor using previously set pointers for postponed row */
  357|  34.2k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  260|  34.2k|#define _post_process_data  post_process_data
  ------------------
  358|  34.2k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  359|  34.2k|                                        &main_ptr->rowgroup_ctr,
  360|  34.2k|                                        main_ptr->rowgroups_avail, output_buf,
  361|  34.2k|                                        out_row_ctr, out_rows_avail);
  362|  34.2k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (362:9): [True: 23.8k, False: 10.3k]
  ------------------
  363|  23.8k|      return;                   /* Need to suspend */
  364|  10.3k|    main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|  10.3k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  365|  10.3k|    if (*out_row_ctr >= out_rows_avail)
  ------------------
  |  Branch (365:9): [True: 10.3k, False: 0]
  ------------------
  366|  10.3k|      return;                   /* Postprocessor exactly filled output buf */
  367|      0|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|      0|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  368|  10.8k|  case CTX_PREPARE_FOR_IMCU:
  ------------------
  |  |   46|  10.8k|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  |  Branch (368:3): [True: 10.8k, False: 269k]
  ------------------
  369|       |    /* Prepare to process first M-1 row groups of this iMCU row */
  370|  10.8k|    main_ptr->rowgroup_ctr = 0;
  371|  10.8k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size - 1);
  ------------------
  |  |   27|  10.8k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  372|       |    /* Check for bottom of image: if so, tweak pointers to "duplicate"
  373|       |     * the last sample row, and adjust rowgroups_avail to ignore padding rows.
  374|       |     */
  375|  10.8k|    if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
  ------------------
  |  Branch (375:9): [True: 298, False: 10.5k]
  ------------------
  376|    298|      set_bottom_pointers(cinfo);
  377|  10.8k|    main_ptr->context_state = CTX_PROCESS_IMCU;
  ------------------
  |  |   47|  10.8k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  378|  10.8k|    FALLTHROUGH                 /*FALLTHROUGH*/
  ------------------
  |  |   41|  10.8k|#define FALLTHROUGH  __attribute__((fallthrough));
  ------------------
  379|   245k|  case CTX_PROCESS_IMCU:
  ------------------
  |  |   47|   245k|#define CTX_PROCESS_IMCU        1       /* feeding iMCU to postprocessor */
  ------------------
  |  Branch (379:3): [True: 234k, False: 45.5k]
  ------------------
  380|       |    /* Call postprocessor using previously set pointers */
  381|   245k|    (*cinfo->post->_post_process_data) (cinfo,
  ------------------
  |  |  260|   245k|#define _post_process_data  post_process_data
  ------------------
  382|   245k|                                        main_ptr->xbuffer[main_ptr->whichptr],
  383|   245k|                                        &main_ptr->rowgroup_ctr,
  384|   245k|                                        main_ptr->rowgroups_avail, output_buf,
  385|   245k|                                        out_row_ctr, out_rows_avail);
  386|   245k|    if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
  ------------------
  |  Branch (386:9): [True: 234k, False: 10.6k]
  ------------------
  387|   234k|      return;                   /* Need to suspend */
  388|       |    /* After the first iMCU, change wraparound pointers to normal state */
  389|  10.6k|    if (main_ptr->iMCU_row_ctr == 1)
  ------------------
  |  Branch (389:9): [True: 452, False: 10.2k]
  ------------------
  390|    452|      set_wraparound_pointers(cinfo);
  391|       |    /* Prepare to load new iMCU row using other xbuffer list */
  392|  10.6k|    main_ptr->whichptr ^= 1;    /* 0=>1 or 1=>0 */
  393|  10.6k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  10.6k|#define FALSE   0               /* values of boolean */
  ------------------
  394|       |    /* Still need to process last row group of this iMCU row, */
  395|       |    /* which is saved at index M+1 of the other xbuffer */
  396|  10.6k|    main_ptr->rowgroup_ctr = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 1);
  ------------------
  |  |   27|  10.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  397|  10.6k|    main_ptr->rowgroups_avail = (JDIMENSION)(cinfo->_min_DCT_scaled_size + 2);
  ------------------
  |  |   27|  10.6k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  398|  10.6k|    main_ptr->context_state = CTX_POSTPONED_ROW;
  ------------------
  |  |   48|  10.6k|#define CTX_POSTPONED_ROW       2       /* feeding postponed row group */
  ------------------
  399|   279k|  }
  400|   279k|}
jdmainct-8.c:set_bottom_pointers:
  222|    298|{
  223|    298|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  224|    298|  int ci, i, rgroup, iMCUheight, rows_left;
  225|    298|  jpeg_component_info *compptr;
  226|    298|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|    298|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  227|       |
  228|  1.20k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (228:44): [True: 902, False: 298]
  ------------------
  229|    902|       ci++, compptr++) {
  230|       |    /* Count sample rows in one iMCU row and in one row group */
  231|    902|    iMCUheight = compptr->v_samp_factor * compptr->_DCT_scaled_size;
  ------------------
  |  |   24|    902|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  232|    902|    rgroup = iMCUheight / cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    902|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  233|       |    /* Count nondummy sample rows remaining for this component */
  234|    902|    rows_left = (int)(compptr->downsampled_height % (JDIMENSION)iMCUheight);
  235|    902|    if (rows_left == 0) rows_left = iMCUheight;
  ------------------
  |  Branch (235:9): [True: 109, False: 793]
  ------------------
  236|       |    /* Count nondummy row groups.  Should get same answer for each component,
  237|       |     * so we need only do it once.
  238|       |     */
  239|    902|    if (ci == 0) {
  ------------------
  |  Branch (239:9): [True: 298, False: 604]
  ------------------
  240|    298|      main_ptr->rowgroups_avail = (JDIMENSION)((rows_left - 1) / rgroup + 1);
  241|    298|    }
  242|       |    /* Duplicate the last real sample row rgroup*2 times; this pads out the
  243|       |     * last partial rowgroup and ensures at least one full rowgroup of context.
  244|       |     */
  245|    902|    xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
  246|  4.55k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (246:17): [True: 3.65k, False: 902]
  ------------------
  247|  3.65k|      xbuf[rows_left + i] = xbuf[rows_left - 1];
  248|  3.65k|    }
  249|    902|  }
  250|    298|}
jdmainct-8.c:make_funny_pointers:
  181|    760|{
  182|    760|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|    760|  int ci, i, rgroup;
  184|    760|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    760|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|    760|  jpeg_component_info *compptr;
  186|    760|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  230|    760|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  187|       |
  188|  3.08k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 2.32k, False: 760]
  ------------------
  189|  2.32k|       ci++, compptr++) {
  190|  2.32k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  2.32k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|  2.32k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  2.32k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|  2.32k|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|  2.32k|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|  2.32k|    buf = main_ptr->buffer[ci];
  196|  42.3k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 40.0k, False: 2.32k]
  ------------------
  197|  40.0k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|  40.0k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|  10.3k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 8.00k, False: 2.32k]
  ------------------
  201|  8.00k|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|  8.00k|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|  8.00k|    }
  204|       |    /* The wraparound pointers at top and bottom will be filled later
  205|       |     * (see set_wraparound_pointers, below).  Initially we want the "above"
  206|       |     * pointers to duplicate the first actual data line.  This only needs
  207|       |     * to happen in xbuffer[0].
  208|       |     */
  209|  6.32k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 4.00k, False: 2.32k]
  ------------------
  210|  4.00k|      xbuf0[i - rgroup] = xbuf0[0];
  211|  4.00k|    }
  212|  2.32k|  }
  213|    760|}
jdmainct-8.c:process_data_simple_main:
  298|   387k|{
  299|   387k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  300|   387k|  JDIMENSION rowgroups_avail;
  301|       |
  302|       |  /* Read input data if we haven't filled the main buffer yet */
  303|   387k|  if (!main_ptr->buffer_full) {
  ------------------
  |  Branch (303:7): [True: 35.7k, False: 351k]
  ------------------
  304|  35.7k|    if (!(*cinfo->coef->_decompress_data) (cinfo, main_ptr->buffer))
  ------------------
  |  |  258|  35.7k|#define _decompress_data  decompress_data
  ------------------
  |  Branch (304:9): [True: 0, False: 35.7k]
  ------------------
  305|      0|      return;                   /* suspension forced, can do nothing more */
  306|  35.7k|    main_ptr->buffer_full = TRUE;       /* OK, we have an iMCU row to work with */
  ------------------
  |  |  210|  35.7k|#define TRUE    1
  ------------------
  307|  35.7k|  }
  308|       |
  309|       |  /* There are always min_DCT_scaled_size row groups in an iMCU row. */
  310|   387k|  rowgroups_avail = (JDIMENSION)cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|   387k|#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|   387k|  (*cinfo->post->_post_process_data) (cinfo, main_ptr->buffer,
  ------------------
  |  |  260|   387k|#define _post_process_data  post_process_data
  ------------------
  318|   387k|                                      &main_ptr->rowgroup_ctr, rowgroups_avail,
  319|   387k|                                      output_buf, out_row_ctr, out_rows_avail);
  320|       |
  321|       |  /* Has postprocessor consumed all the data yet? If so, mark buffer empty */
  322|   387k|  if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
  ------------------
  |  Branch (322:7): [True: 34.5k, False: 352k]
  ------------------
  323|  34.5k|    main_ptr->buffer_full = FALSE;
  ------------------
  |  |  207|  34.5k|#define FALSE   0               /* values of boolean */
  ------------------
  324|  34.5k|    main_ptr->rowgroup_ctr = 0;
  325|  34.5k|  }
  326|   387k|}
jdmainct-8.c:alloc_funny_pointers:
  139|  1.45k|{
  140|  1.45k|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|  1.45k|  int ci, rgroup;
  142|  1.45k|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.45k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|  1.45k|  jpeg_component_info *compptr;
  144|  1.45k|  _JSAMPARRAY xbuf;
  ------------------
  |  |  230|  1.45k|#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|  1.45k|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|  1.45k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.45k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|  1.45k|                                cinfo->num_components * 2 *
  152|  1.45k|                                sizeof(_JSAMPARRAY));
  153|  1.45k|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|  5.88k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 4.43k, False: 1.45k]
  ------------------
  156|  4.43k|       ci++, compptr++) {
  157|  4.43k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  4.43k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|  4.43k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  4.43k|#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|  4.43k|    xbuf = (_JSAMPARRAY)
  163|  4.43k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  4.43k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|  4.43k|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|  4.43k|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|  4.43k|    main_ptr->xbuffer[0][ci] = xbuf;
  167|  4.43k|    xbuf += rgroup * (M + 4);
  168|  4.43k|    main_ptr->xbuffer[1][ci] = xbuf;
  169|  4.43k|  }
  170|  1.45k|}
j12init_d_main_controller:
  429|    887|{
  430|    887|  my_main_ptr main_ptr;
  431|    887|  int ci, rgroup, ngroups;
  432|    887|  jpeg_component_info *compptr;
  433|       |
  434|    887|#ifdef D_LOSSLESS_SUPPORTED
  435|    887|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 426, False: 461]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|    426|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    852|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (439:9): [True: 0, False: 426]
  ------------------
  440|    426|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    426|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (440:9): [True: 0, False: 426]
  ------------------
  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|    426|  } else
  444|    461|#endif
  445|    461|  {
  446|    461|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    461|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (446:9): [True: 0, False: 461]
  ------------------
  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|    461|  }
  449|       |
  450|    887|  main_ptr = (my_main_ptr)
  451|    887|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    887|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|    887|                                sizeof(my_main_controller));
  453|    887|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|    887|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|    887|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|    887|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 887]
  ------------------
  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|    887|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 305, False: 582]
  ------------------
  464|    305|    if (cinfo->_min_DCT_scaled_size < 2) /* unsupported, see comments above */
  ------------------
  |  |   27|    305|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (464:9): [True: 0, False: 305]
  ------------------
  465|      0|      ERREXIT(cinfo, JERR_NOTIMPL);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  466|    305|    alloc_funny_pointers(cinfo); /* Alloc space for xbuffer[] lists */
  467|    305|    ngroups = cinfo->_min_DCT_scaled_size + 2;
  ------------------
  |  |   27|    305|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  468|    582|  } else {
  469|    582|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    582|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|    582|  }
  471|       |
  472|  3.55k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 2.66k, False: 887]
  ------------------
  473|  2.66k|       ci++, compptr++) {
  474|  2.66k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  2.66k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  2.66k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  2.66k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  2.66k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  2.66k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  2.66k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  2.66k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  2.66k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  2.66k|                         (JDIMENSION)(rgroup * ngroups));
  480|  2.66k|  }
  481|    887|}
jdmainct-12.c:start_pass_main:
  259|    112|{
  260|    112|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|    112|  switch (pass_mode) {
  263|    112|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 112, False: 0]
  ------------------
  264|    112|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 68, False: 44]
  ------------------
  265|     68|      main_ptr->pub._process_data = process_data_context_main;
  ------------------
  |  |  140|     68|#define _process_data  process_data_12
  ------------------
  266|     68|      make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
  267|     68|      main_ptr->whichptr = 0;   /* Read first iMCU row into xbuffer[0] */
  268|     68|      main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
  ------------------
  |  |   46|     68|#define CTX_PREPARE_FOR_IMCU    0       /* need to prepare for MCU row */
  ------------------
  269|     68|      main_ptr->iMCU_row_ctr = 0;
  270|     68|    } else {
  271|       |      /* Simple case with no context needed */
  272|     44|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |  140|     44|#define _process_data  process_data_12
  ------------------
  273|     44|    }
  274|    112|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|    112|#define FALSE   0               /* values of boolean */
  ------------------
  275|    112|    main_ptr->rowgroup_ctr = 0;
  276|    112|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 112]
  ------------------
  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: 112]
  ------------------
  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|    112|  }
  287|    112|}
jdmainct-12.c:make_funny_pointers:
  181|     68|{
  182|     68|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  183|     68|  int ci, i, rgroup;
  184|     68|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|     68|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  185|     68|  jpeg_component_info *compptr;
  186|     68|  _JSAMPARRAY buf, xbuf0, xbuf1;
  ------------------
  |  |  114|     68|#define _JSAMPARRAY  J12SAMPARRAY
  ------------------
  187|       |
  188|    291|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (188:44): [True: 223, False: 68]
  ------------------
  189|    223|       ci++, compptr++) {
  190|    223|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    223|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  191|    223|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    223|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  192|    223|    xbuf0 = main_ptr->xbuffer[0][ci];
  193|    223|    xbuf1 = main_ptr->xbuffer[1][ci];
  194|       |    /* First copy the workspace pointers as-is */
  195|    223|    buf = main_ptr->buffer[ci];
  196|  4.70k|    for (i = 0; i < rgroup * (M + 2); i++) {
  ------------------
  |  Branch (196:17): [True: 4.48k, False: 223]
  ------------------
  197|  4.48k|      xbuf0[i] = xbuf1[i] = buf[i];
  198|  4.48k|    }
  199|       |    /* In the second list, put the last four row groups in swapped order */
  200|  1.11k|    for (i = 0; i < rgroup * 2; i++) {
  ------------------
  |  Branch (200:17): [True: 896, False: 223]
  ------------------
  201|    896|      xbuf1[rgroup * (M - 2) + i] = buf[rgroup * M + i];
  202|    896|      xbuf1[rgroup * M + i] = buf[rgroup * (M - 2) + i];
  203|    896|    }
  204|       |    /* The wraparound pointers at top and bottom will be filled later
  205|       |     * (see set_wraparound_pointers, below).  Initially we want the "above"
  206|       |     * pointers to duplicate the first actual data line.  This only needs
  207|       |     * to happen in xbuffer[0].
  208|       |     */
  209|    671|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (209:17): [True: 448, False: 223]
  ------------------
  210|    448|      xbuf0[i - rgroup] = xbuf0[0];
  211|    448|    }
  212|    223|  }
  213|     68|}
jdmainct-12.c:alloc_funny_pointers:
  139|    305|{
  140|    305|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  141|    305|  int ci, rgroup;
  142|    305|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    305|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  143|    305|  jpeg_component_info *compptr;
  144|    305|  _JSAMPARRAY xbuf;
  ------------------
  |  |  114|    305|#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|    305|  main_ptr->xbuffer[0] = (_JSAMPIMAGE)
  150|    305|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    305|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  151|    305|                                cinfo->num_components * 2 *
  152|    305|                                sizeof(_JSAMPARRAY));
  153|    305|  main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
  154|       |
  155|  1.24k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (155:44): [True: 938, False: 305]
  ------------------
  156|    938|       ci++, compptr++) {
  157|    938|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|    938|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  158|    938|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|    938|#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|    938|    xbuf = (_JSAMPARRAY)
  163|    938|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    938|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  164|    938|                                  2 * (rgroup * (M + 4)) * sizeof(_JSAMPROW));
  165|    938|    xbuf += rgroup;             /* want one row group at negative offsets */
  166|    938|    main_ptr->xbuffer[0][ci] = xbuf;
  167|    938|    xbuf += rgroup * (M + 4);
  168|    938|    main_ptr->xbuffer[1][ci] = xbuf;
  169|    938|  }
  170|    305|}
j16init_d_main_controller:
  429|    451|{
  430|    451|  my_main_ptr main_ptr;
  431|    451|  int ci, rgroup, ngroups;
  432|    451|  jpeg_component_info *compptr;
  433|       |
  434|    451|#ifdef D_LOSSLESS_SUPPORTED
  435|    451|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (435:7): [True: 451, False: 0]
  ------------------
  436|       |#if BITS_IN_JSAMPLE == 8
  437|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  438|       |#else
  439|    451|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    902|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (439:9): [True: 0, False: 451]
  ------------------
  440|    451|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    451|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (440:9): [True: 0, False: 451]
  ------------------
  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|    451|  } 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|    451|  main_ptr = (my_main_ptr)
  451|    451|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    451|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  452|    451|                                sizeof(my_main_controller));
  453|    451|  memset(main_ptr, 0, sizeof(my_main_controller));
  454|    451|  cinfo->main = (struct jpeg_d_main_controller *)main_ptr;
  455|    451|  main_ptr->pub.start_pass = start_pass_main;
  456|       |
  457|    451|  if (need_full_buffer)         /* shouldn't happen */
  ------------------
  |  Branch (457:7): [True: 0, False: 451]
  ------------------
  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|    451|  if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (463:7): [True: 0, False: 451]
  ------------------
  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|    451|  } else {
  469|    451|    ngroups = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    451|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  470|    451|  }
  471|       |
  472|  1.81k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (472:44): [True: 1.36k, False: 451]
  ------------------
  473|  1.36k|       ci++, compptr++) {
  474|  1.36k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.36k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  475|  1.36k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  1.36k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  476|  1.36k|    main_ptr->buffer[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  477|  1.36k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.36k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  478|  1.36k|                         compptr->width_in_blocks * compptr->_DCT_scaled_size,
  ------------------
  |  |   24|  1.36k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  479|  1.36k|                         (JDIMENSION)(rgroup * ngroups));
  480|  1.36k|  }
  481|    451|}
jdmainct-16.c:start_pass_main:
  259|      5|{
  260|      5|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
  261|       |
  262|      5|  switch (pass_mode) {
  263|      5|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (263:3): [True: 5, False: 0]
  ------------------
  264|      5|    if (cinfo->upsample->need_context_rows) {
  ------------------
  |  Branch (264:9): [True: 0, False: 5]
  ------------------
  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|      5|    } else {
  271|       |      /* Simple case with no context needed */
  272|      5|      main_ptr->pub._process_data = process_data_simple_main;
  ------------------
  |  |   51|      5|#define _process_data  process_data_16
  ------------------
  273|      5|    }
  274|      5|    main_ptr->buffer_full = FALSE;      /* Mark buffer empty */
  ------------------
  |  |  207|      5|#define FALSE   0               /* values of boolean */
  ------------------
  275|      5|    main_ptr->rowgroup_ctr = 0;
  276|      5|    break;
  277|      0|#ifdef QUANT_2PASS_SUPPORTED
  278|      0|  case JBUF_CRANK_DEST:
  ------------------
  |  Branch (278:3): [True: 0, False: 5]
  ------------------
  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: 5]
  ------------------
  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|      5|  }
  287|      5|}

jdmainct-8.c:set_wraparound_pointers:
   56|    452|{
   57|    452|  my_main_ptr main_ptr = (my_main_ptr)cinfo->main;
   58|    452|  int ci, i, rgroup;
   59|    452|  int M = cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|    452|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
   60|    452|  jpeg_component_info *compptr;
   61|    452|  _JSAMPARRAY xbuf0, xbuf1;
  ------------------
  |  |  230|    452|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
   62|       |
   63|  1.82k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (63:44): [True: 1.36k, False: 452]
  ------------------
   64|  1.36k|       ci++, compptr++) {
   65|  1.36k|    rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.36k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
   66|  1.36k|      cinfo->_min_DCT_scaled_size; /* height of a row group of component */
  ------------------
  |  |   27|  1.36k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
   67|  1.36k|    xbuf0 = main_ptr->xbuffer[0][ci];
   68|  1.36k|    xbuf1 = main_ptr->xbuffer[1][ci];
   69|  3.88k|    for (i = 0; i < rgroup; i++) {
  ------------------
  |  Branch (69:17): [True: 2.51k, False: 1.36k]
  ------------------
   70|  2.51k|      xbuf0[i - rgroup] = xbuf0[rgroup * (M + 1) + i];
   71|  2.51k|      xbuf1[i - rgroup] = xbuf1[rgroup * (M + 1) + i];
   72|  2.51k|      xbuf0[rgroup * (M + 2) + i] = xbuf0[i];
   73|  2.51k|      xbuf1[rgroup * (M + 2) + i] = xbuf1[i];
   74|  2.51k|    }
   75|  1.36k|  }
   76|    452|}

jpeg_resync_to_restart:
 1218|      9|{
 1219|      9|  int marker = cinfo->unread_marker;
 1220|      9|  int action = 1;
 1221|       |
 1222|       |  /* Always put up a warning. */
 1223|      9|  WARNMS2(cinfo, JWRN_MUST_RESYNC, marker, desired);
  ------------------
  |  |  290|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      9|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      9|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      9|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
 1224|       |
 1225|       |  /* Outer loop handles repeated decision after scanning forward. */
 1226|      9|  for (;;) {
 1227|      0|    if (marker < (int)M_SOF0)
  ------------------
  |  Branch (1227:9): [True: 0, False: 0]
  ------------------
 1228|      0|      action = 2;               /* invalid marker */
 1229|      0|    else if (marker < (int)M_RST0 || marker > (int)M_RST7)
  ------------------
  |  Branch (1229:14): [True: 0, False: 0]
  |  Branch (1229:38): [True: 0, False: 0]
  ------------------
 1230|      0|      action = 3;               /* valid non-restart marker */
 1231|      0|    else {
 1232|      0|      if (marker == ((int)M_RST0 + ((desired + 1) & 7)) ||
  ------------------
  |  Branch (1232:11): [True: 0, False: 0]
  ------------------
 1233|      0|          marker == ((int)M_RST0 + ((desired + 2) & 7)))
  ------------------
  |  Branch (1233:11): [True: 0, False: 0]
  ------------------
 1234|      0|        action = 3;             /* one of the next two expected restarts */
 1235|      0|      else if (marker == ((int)M_RST0 + ((desired - 1) & 7)) ||
  ------------------
  |  Branch (1235:16): [True: 0, False: 0]
  ------------------
 1236|      0|               marker == ((int)M_RST0 + ((desired - 2) & 7)))
  ------------------
  |  Branch (1236:16): [True: 0, False: 0]
  ------------------
 1237|      0|        action = 2;             /* a prior restart, so advance */
 1238|      0|      else
 1239|      0|        action = 1;             /* desired restart or too far away */
 1240|      0|    }
 1241|      0|    TRACEMS2(cinfo, 4, JTRC_RECOVERY_ACTION, marker, action);
  ------------------
  |  |  304|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  305|      0|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|      0|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|      0|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1242|      0|    switch (action) {
  ------------------
  |  Branch (1242:13): [True: 0, False: 0]
  ------------------
 1243|      0|    case 1:
  ------------------
  |  Branch (1243:5): [True: 0, False: 0]
  ------------------
 1244|       |      /* Discard marker and let entropy decoder resume processing. */
 1245|      0|      cinfo->unread_marker = 0;
 1246|      0|      return TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
 1247|      0|    case 2:
  ------------------
  |  Branch (1247:5): [True: 0, False: 0]
  ------------------
 1248|       |      /* Scan to the next marker, and repeat the decision loop. */
 1249|      0|      if (!next_marker(cinfo))
  ------------------
  |  Branch (1249:11): [True: 0, False: 0]
  ------------------
 1250|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1251|      0|      marker = cinfo->unread_marker;
 1252|      0|      break;
 1253|      0|    case 3:
  ------------------
  |  Branch (1253:5): [True: 0, False: 0]
  ------------------
 1254|       |      /* Return without advancing past this marker. */
 1255|       |      /* Entropy decoder will be forced to process an empty segment. */
 1256|      0|      return TRUE;
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
 1257|      0|    }
 1258|      0|  } /* end loop */
 1259|      9|}
jinit_marker_reader:
 1288|  6.47k|{
 1289|  6.47k|  my_marker_ptr marker;
 1290|  6.47k|  int i;
 1291|       |
 1292|       |  /* Create subobject in permanent pool */
 1293|  6.47k|  marker = (my_marker_ptr)
 1294|  6.47k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_PERMANENT,
  ------------------
  |  |  888|  6.47k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
 1295|  6.47k|                                sizeof(my_marker_reader));
 1296|  6.47k|  cinfo->marker = (struct jpeg_marker_reader *)marker;
 1297|       |  /* Initialize public method pointers */
 1298|  6.47k|  marker->pub.reset_marker_reader = reset_marker_reader;
 1299|  6.47k|  marker->pub.read_markers = read_markers;
 1300|  6.47k|  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|  6.47k|  marker->process_COM = skip_variable;
 1306|  6.47k|  marker->length_limit_COM = 0;
 1307|   110k|  for (i = 0; i < 16; i++) {
  ------------------
  |  Branch (1307:15): [True: 103k, False: 6.47k]
  ------------------
 1308|   103k|    marker->process_APPn[i] = skip_variable;
 1309|   103k|    marker->length_limit_APPn[i] = 0;
 1310|   103k|  }
 1311|  6.47k|  marker->process_APPn[0] = get_interesting_appn;
 1312|  6.47k|  marker->process_APPn[14] = get_interesting_appn;
 1313|       |  /* Reset marker processing state */
 1314|  6.47k|  reset_marker_reader(cinfo);
 1315|  6.47k|}
jdmarker.c:next_marker:
  892|  89.2k|{
  893|  89.2k|  int c;
  894|  89.2k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  89.2k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  89.2k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  89.2k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  895|       |
  896|  91.4k|  for (;;) {
  897|  91.4k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  91.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  91.9k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 148]
  |  |  |  |  |  Branch (279:38): [True: 148, False: 91.3k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 91.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  91.4k|            bytes_in_buffer--; \
  |  |  156|  91.4k|            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|   910k|    while (c != 0xFF) {
  ------------------
  |  Branch (903:12): [True: 819k, False: 91.4k]
  ------------------
  904|   819k|      cinfo->marker->discarded_bytes++;
  905|   819k|      INPUT_SYNC(cinfo);
  ------------------
  |  |  131|   819k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|   819k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  906|   819k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   819k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   819k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 306]
  |  |  |  |  |  Branch (279:38): [True: 306, False: 818k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 819k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   819k|            bytes_in_buffer--; \
  |  |  156|   819k|            V = *next_input_byte++; )
  ------------------
  907|   819k|    }
  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|   221k|    do {
  914|   221k|      INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|   221k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   221k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 17]
  |  |  |  |  |  Branch (279:38): [True: 17, False: 221k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 221k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   221k|            bytes_in_buffer--; \
  |  |  156|   221k|            V = *next_input_byte++; )
  ------------------
  915|   221k|    } while (c == 0xFF);
  ------------------
  |  Branch (915:14): [True: 129k, False: 91.4k]
  ------------------
  916|  91.4k|    if (c != 0)
  ------------------
  |  Branch (916:9): [True: 88.8k, False: 2.64k]
  ------------------
  917|  88.8k|      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|  2.64k|    cinfo->marker->discarded_bytes += 2;
  922|  2.64k|    INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  2.64k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  2.64k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  923|  2.64k|  }
  924|       |
  925|  89.2k|  if (cinfo->marker->discarded_bytes != 0) {
  ------------------
  |  Branch (925:7): [True: 341, False: 88.9k]
  ------------------
  926|    341|    WARNMS2(cinfo, JWRN_EXTRANEOUS_DATA, cinfo->marker->discarded_bytes, c);
  ------------------
  |  |  290|    341|  ((cinfo)->err->msg_code = (code), \
  |  |  291|    341|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|    341|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|    341|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  927|    341|    cinfo->marker->discarded_bytes = 0;
  928|    341|  }
  929|       |
  930|  89.2k|  cinfo->unread_marker = c;
  931|       |
  932|  89.2k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  89.2k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  89.2k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  933|  89.2k|  return TRUE;
  ------------------
  |  |  210|  89.2k|#define TRUE    1
  ------------------
  934|  89.2k|}
jdmarker.c:reset_marker_reader:
 1268|  12.9k|{
 1269|  12.9k|  my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
 1270|       |
 1271|  12.9k|  cinfo->comp_info = NULL;              /* until allocated by get_sof */
 1272|  12.9k|  cinfo->input_scan_number = 0;         /* no SOS seen yet */
 1273|  12.9k|  cinfo->unread_marker = 0;             /* no pending marker */
 1274|  12.9k|  marker->pub.saw_SOI = FALSE;          /* set internal state too */
  ------------------
  |  |  207|  12.9k|#define FALSE   0               /* values of boolean */
  ------------------
 1275|  12.9k|  marker->pub.saw_SOF = FALSE;
  ------------------
  |  |  207|  12.9k|#define FALSE   0               /* values of boolean */
  ------------------
 1276|  12.9k|  marker->pub.discarded_bytes = 0;
 1277|       |  marker->cur_marker = NULL;
 1278|  12.9k|}
jdmarker.c:read_markers:
  970|  14.1k|{
  971|       |  /* Outer loop repeats once for each marker. */
  972|   102k|  for (;;) {
  973|       |    /* Collect the marker proper, unless we already did. */
  974|       |    /* NB: first_marker() enforces the requirement that SOI appear first. */
  975|   102k|    if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (975:9): [True: 95.7k, False: 6.98k]
  ------------------
  976|  95.7k|      if (!cinfo->marker->saw_SOI) {
  ------------------
  |  Branch (976:11): [True: 6.47k, False: 89.2k]
  ------------------
  977|  6.47k|        if (!first_marker(cinfo))
  ------------------
  |  Branch (977:13): [True: 0, False: 6.47k]
  ------------------
  978|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  979|  89.2k|      } else {
  980|  89.2k|        if (!next_marker(cinfo))
  ------------------
  |  Branch (980:13): [True: 0, False: 89.2k]
  ------------------
  981|      0|          return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  982|  89.2k|      }
  983|  95.7k|    }
  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|   102k|    switch (cinfo->unread_marker) {
  989|  6.33k|    case M_SOI:
  ------------------
  |  Branch (989:5): [True: 6.33k, False: 96.3k]
  ------------------
  990|  6.33k|      if (!get_soi(cinfo))
  ------------------
  |  Branch (990:11): [True: 0, False: 6.33k]
  ------------------
  991|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  992|  6.33k|      break;
  993|       |
  994|  6.33k|    case M_SOF0:                /* Baseline */
  ------------------
  |  Branch (994:5): [True: 1.49k, False: 101k]
  ------------------
  995|  1.52k|    case M_SOF1:                /* Extended sequential, Huffman */
  ------------------
  |  Branch (995:5): [True: 29, False: 102k]
  ------------------
  996|  1.52k|      if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  1.52k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  1.52k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, FALSE))
  ------------------
  |  |  207|  1.52k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (996:11): [True: 0, False: 1.52k]
  ------------------
  997|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
  998|  1.52k|      break;
  999|       |
 1000|  1.52k|    case M_SOF2:                /* Progressive, Huffman */
  ------------------
  |  Branch (1000:5): [True: 852, False: 101k]
  ------------------
 1001|    852|      if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  210|    852|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|    852|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, FALSE))
  ------------------
  |  |  207|    852|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1001:11): [True: 0, False: 852]
  ------------------
 1002|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1003|    852|      break;
 1004|       |
 1005|  1.58k|    case M_SOF3:                /* Lossless, Huffman */
  ------------------
  |  Branch (1005:5): [True: 1.58k, False: 101k]
  ------------------
 1006|  1.58k|      if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  1.58k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  210|  1.58k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, FALSE))
  ------------------
  |  |  207|  1.58k|#define FALSE   0               /* values of boolean */
  ------------------
  |  Branch (1006:11): [True: 0, False: 1.58k]
  ------------------
 1007|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1008|  1.58k|      break;
 1009|       |
 1010|  1.58k|    case M_SOF9:                /* Extended sequential, arithmetic */
  ------------------
  |  Branch (1010:5): [True: 401, False: 102k]
  ------------------
 1011|    401|      if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|    401|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  207|    401|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, FALSE, TRUE))
  ------------------
  |  |  210|    401|#define TRUE    1
  ------------------
  |  Branch (1011:11): [True: 0, False: 401]
  ------------------
 1012|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1013|    401|      break;
 1014|       |
 1015|  1.09k|    case M_SOF10:               /* Progressive, arithmetic */
  ------------------
  |  Branch (1015:5): [True: 1.09k, False: 101k]
  ------------------
 1016|  1.09k|      if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  1.09k|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  207|  1.09k|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, TRUE, FALSE, TRUE))
  ------------------
  |  |  210|  1.09k|#define TRUE    1
  ------------------
  |  Branch (1016:11): [True: 0, False: 1.09k]
  ------------------
 1017|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1018|  1.09k|      break;
 1019|       |
 1020|  1.09k|    case M_SOF11:               /* Lossless, arithmetic */
  ------------------
  |  Branch (1020:5): [True: 52, False: 102k]
  ------------------
 1021|     52|      if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  207|     52|#define FALSE   0               /* values of boolean */
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|     52|#define TRUE    1
  ------------------
                    if (!get_sof(cinfo, FALSE, TRUE, TRUE))
  ------------------
  |  |  210|     52|#define TRUE    1
  ------------------
  |  Branch (1021:11): [True: 0, False: 52]
  ------------------
 1022|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1023|     52|      break;
 1024|       |
 1025|       |    /* Currently unsupported SOFn types */
 1026|     52|    case M_SOF5:                /* Differential sequential, Huffman */
  ------------------
  |  Branch (1026:5): [True: 4, False: 102k]
  ------------------
 1027|      7|    case M_SOF6:                /* Differential progressive, Huffman */
  ------------------
  |  Branch (1027:5): [True: 3, False: 102k]
  ------------------
 1028|     10|    case M_SOF7:                /* Differential lossless, Huffman */
  ------------------
  |  Branch (1028:5): [True: 3, False: 102k]
  ------------------
 1029|     24|    case M_JPG:                 /* Reserved for JPEG extensions */
  ------------------
  |  Branch (1029:5): [True: 14, False: 102k]
  ------------------
 1030|     28|    case M_SOF13:               /* Differential sequential, arithmetic */
  ------------------
  |  Branch (1030:5): [True: 4, False: 102k]
  ------------------
 1031|     34|    case M_SOF14:               /* Differential progressive, arithmetic */
  ------------------
  |  Branch (1031:5): [True: 6, False: 102k]
  ------------------
 1032|     47|    case M_SOF15:               /* Differential lossless, arithmetic */
  ------------------
  |  Branch (1032:5): [True: 13, False: 102k]
  ------------------
 1033|     47|      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
  ------------------
  |  |  243|     47|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     47|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     47|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1034|     47|      break;
 1035|       |
 1036|  11.6k|    case M_SOS:
  ------------------
  |  Branch (1036:5): [True: 11.6k, False: 91.1k]
  ------------------
 1037|  11.6k|      if (!get_sos(cinfo))
  ------------------
  |  Branch (1037:11): [True: 0, False: 11.6k]
  ------------------
 1038|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1039|  11.6k|      cinfo->unread_marker = 0; /* processed the marker */
 1040|  11.6k|      return JPEG_REACHED_SOS;
  ------------------
  |  | 1111|  11.6k|#define JPEG_REACHED_SOS        1 /* Reached start of new scan */
  ------------------
 1041|       |
 1042|    657|    case M_EOI:
  ------------------
  |  Branch (1042:5): [True: 657, False: 102k]
  ------------------
 1043|    657|      TRACEMS(cinfo, 1, JTRC_EOI);
  ------------------
  |  |  297|    657|  ((cinfo)->err->msg_code = (code), \
  |  |  298|    657|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1044|    657|      cinfo->unread_marker = 0; /* processed the marker */
 1045|    657|      return JPEG_REACHED_EOI;
  ------------------
  |  | 1112|    657|#define JPEG_REACHED_EOI        2 /* Reached end of image */
  ------------------
 1046|       |
 1047|    252|    case M_DAC:
  ------------------
  |  Branch (1047:5): [True: 252, False: 102k]
  ------------------
 1048|    252|      if (!get_dac(cinfo))
  ------------------
  |  Branch (1048:11): [True: 0, False: 252]
  ------------------
 1049|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1050|    252|      break;
 1051|       |
 1052|  8.77k|    case M_DHT:
  ------------------
  |  Branch (1052:5): [True: 8.77k, False: 93.9k]
  ------------------
 1053|  8.77k|      if (!get_dht(cinfo))
  ------------------
  |  Branch (1053:11): [True: 0, False: 8.77k]
  ------------------
 1054|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1055|  8.77k|      break;
 1056|       |
 1057|  8.77k|    case M_DQT:
  ------------------
  |  Branch (1057:5): [True: 7.10k, False: 95.6k]
  ------------------
 1058|  7.10k|      if (!get_dqt(cinfo))
  ------------------
  |  Branch (1058:11): [True: 0, False: 7.10k]
  ------------------
 1059|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1060|  7.10k|      break;
 1061|       |
 1062|  7.10k|    case M_DRI:
  ------------------
  |  Branch (1062:5): [True: 196, False: 102k]
  ------------------
 1063|    196|      if (!get_dri(cinfo))
  ------------------
  |  Branch (1063:11): [True: 0, False: 196]
  ------------------
 1064|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1065|    196|      break;
 1066|       |
 1067|  9.30k|    case M_APP0:
  ------------------
  |  Branch (1067:5): [True: 9.30k, False: 93.4k]
  ------------------
 1068|  9.65k|    case M_APP1:
  ------------------
  |  Branch (1068:5): [True: 352, False: 102k]
  ------------------
 1069|  10.0k|    case M_APP2:
  ------------------
  |  Branch (1069:5): [True: 346, False: 102k]
  ------------------
 1070|  10.2k|    case M_APP3:
  ------------------
  |  Branch (1070:5): [True: 268, False: 102k]
  ------------------
 1071|  10.5k|    case M_APP4:
  ------------------
  |  Branch (1071:5): [True: 270, False: 102k]
  ------------------
 1072|  10.8k|    case M_APP5:
  ------------------
  |  Branch (1072:5): [True: 260, False: 102k]
  ------------------
 1073|  11.0k|    case M_APP6:
  ------------------
  |  Branch (1073:5): [True: 276, False: 102k]
  ------------------
 1074|  11.1k|    case M_APP7:
  ------------------
  |  Branch (1074:5): [True: 94, False: 102k]
  ------------------
 1075|  11.3k|    case M_APP8:
  ------------------
  |  Branch (1075:5): [True: 208, False: 102k]
  ------------------
 1076|  17.3k|    case M_APP9:
  ------------------
  |  Branch (1076:5): [True: 5.96k, False: 96.7k]
  ------------------
 1077|  17.4k|    case M_APP10:
  ------------------
  |  Branch (1077:5): [True: 85, False: 102k]
  ------------------
 1078|  17.5k|    case M_APP11:
  ------------------
  |  Branch (1078:5): [True: 129, False: 102k]
  ------------------
 1079|  17.7k|    case M_APP12:
  ------------------
  |  Branch (1079:5): [True: 226, False: 102k]
  ------------------
 1080|  17.8k|    case M_APP13:
  ------------------
  |  Branch (1080:5): [True: 85, False: 102k]
  ------------------
 1081|  20.6k|    case M_APP14:
  ------------------
  |  Branch (1081:5): [True: 2.77k, False: 99.9k]
  ------------------
 1082|  21.1k|    case M_APP15:
  ------------------
  |  Branch (1082:5): [True: 543, False: 102k]
  ------------------
 1083|  21.1k|      if (!(*((my_marker_ptr)cinfo->marker)->process_APPn[
  ------------------
  |  Branch (1083:11): [True: 0, False: 21.1k]
  ------------------
 1084|  21.1k|               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|  21.1k|      break;
 1087|       |
 1088|  21.1k|    case M_COM:
  ------------------
  |  Branch (1088:5): [True: 234, False: 102k]
  ------------------
 1089|    234|      if (!(*((my_marker_ptr)cinfo->marker)->process_COM) (cinfo))
  ------------------
  |  Branch (1089:11): [True: 0, False: 234]
  ------------------
 1090|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1091|    234|      break;
 1092|       |
 1093|  6.49k|    case M_RST0:                /* these are all parameterless */
  ------------------
  |  Branch (1093:5): [True: 6.49k, False: 96.2k]
  ------------------
 1094|  6.99k|    case M_RST1:
  ------------------
  |  Branch (1094:5): [True: 506, False: 102k]
  ------------------
 1095|  25.9k|    case M_RST2:
  ------------------
  |  Branch (1095:5): [True: 18.9k, False: 83.7k]
  ------------------
 1096|  26.2k|    case M_RST3:
  ------------------
  |  Branch (1096:5): [True: 303, False: 102k]
  ------------------
 1097|  26.4k|    case M_RST4:
  ------------------
  |  Branch (1097:5): [True: 202, False: 102k]
  ------------------
 1098|  36.8k|    case M_RST5:
  ------------------
  |  Branch (1098:5): [True: 10.3k, False: 92.3k]
  ------------------
 1099|  37.0k|    case M_RST6:
  ------------------
  |  Branch (1099:5): [True: 235, False: 102k]
  ------------------
 1100|  37.3k|    case M_RST7:
  ------------------
  |  Branch (1100:5): [True: 257, False: 102k]
  ------------------
 1101|  37.7k|    case M_TEM:
  ------------------
  |  Branch (1101:5): [True: 392, False: 102k]
  ------------------
 1102|  37.7k|      TRACEMS1(cinfo, 1, JTRC_PARMLESS_MARKER, cinfo->unread_marker);
  ------------------
  |  |  300|  37.7k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  37.7k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  37.7k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1103|  37.7k|      break;
 1104|       |
 1105|  1.81k|    case M_DNL:                 /* Ignore DNL ... perhaps the wrong thing */
  ------------------
  |  Branch (1105:5): [True: 1.81k, False: 100k]
  ------------------
 1106|  1.81k|      if (!skip_variable(cinfo))
  ------------------
  |  Branch (1106:11): [True: 0, False: 1.81k]
  ------------------
 1107|      0|        return JPEG_SUSPENDED;
  ------------------
  |  | 1065|      0|#define JPEG_SUSPENDED           0 /* Suspended due to lack of input data */
  ------------------
 1108|  1.81k|      break;
 1109|       |
 1110|  1.81k|    default:                    /* must be DHP, EXP, JPGn, or RESn */
  ------------------
  |  Branch (1110:5): [True: 295, False: 102k]
  ------------------
 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|    295|      ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, cinfo->unread_marker);
  ------------------
  |  |  243|    295|  ((cinfo)->err->msg_code = (code), \
  |  |  244|    295|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|    295|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
 1117|    295|      break;
 1118|   102k|    }
 1119|       |    /* Successfully processed marker, so reset state variable */
 1120|  88.5k|    cinfo->unread_marker = 0;
 1121|  88.5k|  } /* end loop */
 1122|  14.1k|}
jdmarker.c:first_marker:
  945|  6.47k|{
  946|  6.47k|  int c, c2;
  947|  6.47k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  6.47k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  6.47k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  6.47k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  948|       |
  949|  6.47k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  6.47k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.47k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6.47k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 6.47k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.47k|            bytes_in_buffer--; \
  |  |  156|  6.47k|            V = *next_input_byte++; )
  ------------------
  950|  6.47k|  INPUT_BYTE(cinfo, c2, return FALSE);
  ------------------
  |  |  154|  6.47k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  6.50k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 8]
  |  |  |  |  |  Branch (279:38): [True: 8, False: 6.46k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 6.47k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  6.47k|            bytes_in_buffer--; \
  |  |  156|  6.47k|            V = *next_input_byte++; )
  ------------------
  951|  6.47k|  if (c != 0xFF || c2 != (int)M_SOI)
  ------------------
  |  Branch (951:7): [True: 125, False: 6.35k]
  |  Branch (951:20): [True: 48, False: 6.30k]
  ------------------
  952|    165|    ERREXIT2(cinfo, JERR_NO_SOI, c, c2);
  ------------------
  |  |  247|    165|  ((cinfo)->err->msg_code = (code), \
  |  |  248|    165|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  249|    165|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  250|    165|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  953|       |
  954|  6.47k|  cinfo->unread_marker = c2;
  955|       |
  956|  6.47k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  6.47k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  6.47k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  957|  6.47k|  return TRUE;
  ------------------
  |  |  210|  6.47k|#define TRUE    1
  ------------------
  958|  6.47k|}
jdmarker.c:get_soi:
  204|  6.33k|{
  205|  6.33k|  int i;
  206|       |
  207|  6.33k|  TRACEMS(cinfo, 1, JTRC_SOI);
  ------------------
  |  |  297|  6.33k|  ((cinfo)->err->msg_code = (code), \
  |  |  298|  6.33k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  208|       |
  209|  6.33k|  if (cinfo->marker->saw_SOI)
  ------------------
  |  Branch (209:7): [True: 32, False: 6.30k]
  ------------------
  210|     32|    ERREXIT(cinfo, JERR_SOI_DUPLICATE);
  ------------------
  |  |  240|     32|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     32|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  211|       |
  212|       |  /* Reset all parameters that are defined to be reset by SOI */
  213|       |
  214|   107k|  for (i = 0; i < NUM_ARITH_TBLS; i++) {
  ------------------
  |  |   70|   107k|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (214:15): [True: 100k, False: 6.33k]
  ------------------
  215|   100k|    cinfo->arith_dc_L[i] = 0;
  216|   100k|    cinfo->arith_dc_U[i] = 1;
  217|   100k|    cinfo->arith_ac_K[i] = 5;
  218|   100k|  }
  219|  6.33k|  cinfo->restart_interval = 0;
  220|       |
  221|       |  /* Set initial assumptions for colorspace etc */
  222|       |
  223|  6.33k|  cinfo->jpeg_color_space = JCS_UNKNOWN;
  224|  6.33k|  cinfo->CCIR601_sampling = FALSE; /* Assume non-CCIR sampling??? */
  ------------------
  |  |  207|  6.33k|#define FALSE   0               /* values of boolean */
  ------------------
  225|       |
  226|  6.33k|  cinfo->saw_JFIF_marker = FALSE;
  ------------------
  |  |  207|  6.33k|#define FALSE   0               /* values of boolean */
  ------------------
  227|  6.33k|  cinfo->JFIF_major_version = 1; /* set default JFIF APP0 values */
  228|  6.33k|  cinfo->JFIF_minor_version = 1;
  229|  6.33k|  cinfo->density_unit = 0;
  230|  6.33k|  cinfo->X_density = 1;
  231|  6.33k|  cinfo->Y_density = 1;
  232|  6.33k|  cinfo->saw_Adobe_marker = FALSE;
  ------------------
  |  |  207|  6.33k|#define FALSE   0               /* values of boolean */
  ------------------
  233|  6.33k|  cinfo->Adobe_transform = 0;
  234|       |
  235|  6.33k|  cinfo->marker->saw_SOI = TRUE;
  ------------------
  |  |  210|  6.33k|#define TRUE    1
  ------------------
  236|       |
  237|  6.33k|  return TRUE;
  ------------------
  |  |  210|  6.33k|#define TRUE    1
  ------------------
  238|  6.33k|}
jdmarker.c:get_sof:
  245|  5.50k|{
  246|  5.50k|  JLONG length;
  247|  5.50k|  int c, ci;
  248|  5.50k|  jpeg_component_info *compptr;
  249|  5.50k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  5.50k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  5.50k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  5.50k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  250|       |
  251|  5.50k|  if (cinfo->marker->saw_SOF)
  ------------------
  |  Branch (251:7): [True: 15, False: 5.48k]
  ------------------
  252|     15|    ERREXIT(cinfo, JERR_SOF_DUPLICATE);
  ------------------
  |  |  240|     15|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     15|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  253|       |
  254|  5.50k|  cinfo->progressive_mode = is_prog;
  255|  5.50k|  cinfo->master->lossless = is_lossless;
  256|  5.50k|  cinfo->arith_code = is_arith;
  257|       |
  258|  5.50k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  5.50k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 5.50k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 5.50k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.50k|            bytes_in_buffer--; \
  |  |  164|  5.50k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.50k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.50k|            bytes_in_buffer--; \
  |  |  167|  5.50k|            V += *next_input_byte++; )
  ------------------
  259|       |
  260|  5.50k|  INPUT_BYTE(cinfo, cinfo->data_precision, return FALSE);
  ------------------
  |  |  154|  5.50k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.50k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.50k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.50k|            bytes_in_buffer--; \
  |  |  156|  5.50k|            V = *next_input_byte++; )
  ------------------
  261|  5.50k|  cinfo->master->jpeg_data_precision = cinfo->data_precision;
  262|  5.50k|  INPUT_2BYTES(cinfo, cinfo->image_height, return FALSE);
  ------------------
  |  |  162|  5.50k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 5.50k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 5.50k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.50k|            bytes_in_buffer--; \
  |  |  164|  5.50k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.50k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.50k|            bytes_in_buffer--; \
  |  |  167|  5.50k|            V += *next_input_byte++; )
  ------------------
  263|  5.50k|  INPUT_2BYTES(cinfo, cinfo->image_width, return FALSE);
  ------------------
  |  |  162|  5.50k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.0k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 5.50k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 5.49k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  5.50k|            bytes_in_buffer--; \
  |  |  164|  5.50k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  5.50k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  5.50k|            bytes_in_buffer--; \
  |  |  167|  5.50k|            V += *next_input_byte++; )
  ------------------
  264|  5.50k|  INPUT_BYTE(cinfo, cinfo->num_components, return FALSE);
  ------------------
  |  |  154|  5.50k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  5.50k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 5.50k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  5.50k|            bytes_in_buffer--; \
  |  |  156|  5.50k|            V = *next_input_byte++; )
  ------------------
  265|       |
  266|  5.50k|  length -= 8;
  267|       |
  268|  5.50k|  TRACEMS4(cinfo, 1, JTRC_SOF, cinfo->unread_marker,
  ------------------
  |  |  314|  5.50k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  5.50k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 5.50k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  5.50k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  5.50k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  5.50k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  269|  5.50k|           (int)cinfo->image_width, (int)cinfo->image_height,
  270|  5.50k|           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|  5.50k|  if (cinfo->image_height <= 0 || cinfo->image_width <= 0 ||
  ------------------
  |  Branch (275:7): [True: 33, False: 5.46k]
  |  Branch (275:35): [True: 4, False: 5.46k]
  ------------------
  276|  5.46k|      cinfo->num_components <= 0)
  ------------------
  |  Branch (276:7): [True: 11, False: 5.45k]
  ------------------
  277|     26|    ERREXIT(cinfo, JERR_EMPTY_IMAGE);
  ------------------
  |  |  240|     26|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     26|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  278|       |
  279|  5.50k|  if (length != (cinfo->num_components * 3))
  ------------------
  |  Branch (279:7): [True: 55, False: 5.44k]
  ------------------
  280|     55|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     55|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     55|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  281|       |
  282|  5.50k|  if (cinfo->comp_info == NULL) /* do only once, even if suspend */
  ------------------
  |  Branch (282:7): [True: 5.39k, False: 103]
  ------------------
  283|  5.39k|    cinfo->comp_info = (jpeg_component_info *)(*cinfo->mem->alloc_small)
  284|  5.39k|                        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  5.39k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  285|  5.39k|                         cinfo->num_components * sizeof(jpeg_component_info));
  286|       |
  287|  20.0k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (287:44): [True: 14.5k, False: 5.50k]
  ------------------
  288|  14.5k|       ci++, compptr++) {
  289|  14.5k|    compptr->component_index = ci;
  290|  14.5k|    INPUT_BYTE(cinfo, compptr->component_id, return FALSE);
  ------------------
  |  |  154|  14.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  14.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 14.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 14.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  14.5k|            bytes_in_buffer--; \
  |  |  156|  14.5k|            V = *next_input_byte++; )
  ------------------
  291|  14.5k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  14.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  14.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 14.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 14.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  14.5k|            bytes_in_buffer--; \
  |  |  156|  14.5k|            V = *next_input_byte++; )
  ------------------
  292|  14.5k|    compptr->h_samp_factor = (c >> 4) & 15;
  293|  14.5k|    compptr->v_samp_factor = (c     ) & 15;
  294|  14.5k|    INPUT_BYTE(cinfo, compptr->quant_tbl_no, return FALSE);
  ------------------
  |  |  154|  14.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  14.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:38): [True: 4, False: 14.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 14.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  14.5k|            bytes_in_buffer--; \
  |  |  156|  14.5k|            V = *next_input_byte++; )
  ------------------
  295|       |
  296|  14.5k|    TRACEMS4(cinfo, 1, JTRC_SOF_COMPONENT,
  ------------------
  |  |  314|  14.5k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  14.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 14.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  14.5k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  14.5k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  14.5k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  297|  14.5k|             compptr->component_id, compptr->h_samp_factor,
  298|  14.5k|             compptr->v_samp_factor, compptr->quant_tbl_no);
  299|  14.5k|  }
  300|       |
  301|  5.50k|  cinfo->marker->saw_SOF = TRUE;
  ------------------
  |  |  210|  5.50k|#define TRUE    1
  ------------------
  302|       |
  303|  5.50k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  5.50k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  5.50k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  304|  5.50k|  return TRUE;
  ------------------
  |  |  210|  5.50k|#define TRUE    1
  ------------------
  305|  5.50k|}
jdmarker.c:get_sos:
  311|  11.6k|{
  312|  11.6k|  JLONG length;
  313|  11.6k|  int i, ci, n, c, cc, pi;
  314|  11.6k|  jpeg_component_info *compptr;
  315|  11.6k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  11.6k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  11.6k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  11.6k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  316|       |
  317|  11.6k|  if (!cinfo->marker->saw_SOF)
  ------------------
  |  Branch (317:7): [True: 7, False: 11.5k]
  ------------------
  318|      7|    ERREXIT(cinfo, JERR_SOS_NO_SOF);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  319|       |
  320|  11.6k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  11.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  23.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 6, False: 11.5k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 10]
  |  |  |  |  |  Branch (279:38): [True: 10, False: 11.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  11.6k|            bytes_in_buffer--; \
  |  |  164|  11.6k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  11.6k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  11.6k|            bytes_in_buffer--; \
  |  |  167|  11.6k|            V += *next_input_byte++; )
  ------------------
  321|       |
  322|  11.6k|  INPUT_BYTE(cinfo, n, return FALSE); /* Number of components */
  ------------------
  |  |  154|  11.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 11.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  11.6k|            bytes_in_buffer--; \
  |  |  156|  11.6k|            V = *next_input_byte++; )
  ------------------
  323|       |
  324|  11.6k|  TRACEMS1(cinfo, 1, JTRC_SOS, n);
  ------------------
  |  |  300|  11.6k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  11.6k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  11.6k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  325|       |
  326|  11.6k|  if (length != (n * 2 + 6) || n < 1 || n > MAX_COMPS_IN_SCAN)
  ------------------
  |  |   71|  11.5k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (326:7): [True: 87, False: 11.5k]
  |  Branch (326:32): [True: 1, False: 11.5k]
  |  Branch (326:41): [True: 3, False: 11.5k]
  ------------------
  327|     67|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     67|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     67|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  328|       |
  329|  11.6k|  cinfo->comps_in_scan = n;
  330|       |
  331|       |  /* Collect the component-spec parameters */
  332|       |
  333|  57.6k|  for (i = 0; i < MAX_COMPS_IN_SCAN; i++)
  ------------------
  |  |   71|  57.6k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (333:15): [True: 46.0k, False: 11.6k]
  ------------------
  334|  46.0k|    cinfo->cur_comp_info[i] = NULL;
  335|       |
  336|  30.1k|  for (i = 0; i < n; i++) {
  ------------------
  |  Branch (336:15): [True: 18.6k, False: 11.5k]
  ------------------
  337|  18.6k|    INPUT_BYTE(cinfo, cc, return FALSE);
  ------------------
  |  |  154|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  18.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 18.6k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  18.6k|            bytes_in_buffer--; \
  |  |  156|  18.6k|            V = *next_input_byte++; )
  ------------------
  338|  18.6k|    INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  18.6k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  18.6k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3]
  |  |  |  |  |  Branch (279:38): [True: 3, False: 18.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  18.6k|            bytes_in_buffer--; \
  |  |  156|  18.6k|            V = *next_input_byte++; )
  ------------------
  339|       |
  340|  18.6k|    for (ci = 0, compptr = cinfo->comp_info;
  341|  31.9k|         ci < cinfo->num_components && ci < MAX_COMPS_IN_SCAN;
  ------------------
  |  |   71|  31.9k|#define MAX_COMPS_IN_SCAN   4   /* JPEG limit on # of components in one scan */
  ------------------
  |  Branch (341:10): [True: 31.9k, False: 71]
  |  Branch (341:40): [True: 31.9k, False: 0]
  ------------------
  342|  31.9k|         ci++, compptr++) {
  343|  31.9k|      if (cc == compptr->component_id && !cinfo->cur_comp_info[ci])
  ------------------
  |  Branch (343:11): [True: 18.5k, False: 13.3k]
  |  Branch (343:42): [True: 18.5k, False: 5]
  ------------------
  344|  18.5k|        goto id_found;
  345|  31.9k|    }
  346|       |
  347|     71|    ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  243|     71|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     71|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     71|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  348|       |
  349|  18.5k|id_found:
  350|       |
  351|  18.5k|    cinfo->cur_comp_info[i] = compptr;
  352|  18.5k|    compptr->dc_tbl_no = (c >> 4) & 15;
  353|  18.5k|    compptr->ac_tbl_no = (c     ) & 15;
  354|       |
  355|  18.5k|    TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc,
  ------------------
  |  |  309|  18.5k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  18.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 18.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  310|  18.5k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3); \
  |  |  311|  18.5k|           (cinfo)->err->msg_code = (code); \
  |  |  312|  18.5k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  356|  18.5k|             compptr->dc_tbl_no, compptr->ac_tbl_no);
  357|       |
  358|       |    /* This CSi (cc) should differ from the previous CSi */
  359|  29.8k|    for (pi = 0; pi < i; pi++) {
  ------------------
  |  Branch (359:18): [True: 11.2k, False: 18.5k]
  ------------------
  360|  11.2k|      if (cinfo->cur_comp_info[pi] == compptr) {
  ------------------
  |  Branch (360:11): [True: 5, False: 11.2k]
  ------------------
  361|      5|        ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc);
  ------------------
  |  |  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)))
  ------------------
  362|      5|      }
  363|  11.2k|    }
  364|  18.5k|  }
  365|       |
  366|       |  /* Collect the additional scan parameters Ss, Se, Ah/Al. */
  367|  11.5k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  11.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 11.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  11.5k|            bytes_in_buffer--; \
  |  |  156|  11.5k|            V = *next_input_byte++; )
  ------------------
  368|  11.5k|  cinfo->Ss = c;
  369|  11.5k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  11.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 11.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  11.5k|            bytes_in_buffer--; \
  |  |  156|  11.5k|            V = *next_input_byte++; )
  ------------------
  370|  11.5k|  cinfo->Se = c;
  371|  11.5k|  INPUT_BYTE(cinfo, c, return FALSE);
  ------------------
  |  |  154|  11.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 11.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  11.5k|            bytes_in_buffer--; \
  |  |  156|  11.5k|            V = *next_input_byte++; )
  ------------------
  372|  11.5k|  cinfo->Ah = (c >> 4) & 15;
  373|  11.5k|  cinfo->Al = (c     ) & 15;
  374|       |
  375|  11.5k|  TRACEMS4(cinfo, 1, JTRC_SOS_PARAMS, cinfo->Ss, cinfo->Se,
  ------------------
  |  |  314|  11.5k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  11.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|  11.5k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|  11.5k|           (cinfo)->err->msg_code = (code); \
  |  |  317|  11.5k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  376|  11.5k|           cinfo->Ah, cinfo->Al);
  377|       |
  378|       |  /* Prepare to scan data & restart markers */
  379|  11.5k|  cinfo->marker->next_restart_num = 0;
  380|       |
  381|       |  /* Count another SOS marker */
  382|  11.5k|  cinfo->input_scan_number++;
  383|       |
  384|  11.5k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  11.5k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  11.5k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  385|  11.5k|  return TRUE;
  ------------------
  |  |  210|  11.5k|#define TRUE    1
  ------------------
  386|  11.5k|}
jdmarker.c:get_dac:
  394|    252|{
  395|    252|  JLONG length;
  396|    252|  int index, val;
  397|    252|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    252|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    252|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    252|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  398|       |
  399|    252|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    252|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    510|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 251]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 251]
  |  |  |  |  |  Branch (279:53): [Folded, False: 252]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    252|            bytes_in_buffer--; \
  |  |  164|    252|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    252|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    252|            bytes_in_buffer--; \
  |  |  167|    252|            V += *next_input_byte++; )
  ------------------
  400|    252|  length -= 2;
  401|       |
  402|    871|  while (length > 0) {
  ------------------
  |  Branch (402:10): [True: 619, False: 252]
  ------------------
  403|    619|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|    619|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    631|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 4]
  |  |  |  |  |  Branch (279:38): [True: 4, False: 615]
  |  |  |  |  |  Branch (279:53): [Folded, False: 619]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    619|            bytes_in_buffer--; \
  |  |  156|    619|            V = *next_input_byte++; )
  ------------------
  404|    619|    INPUT_BYTE(cinfo, val, return FALSE);
  ------------------
  |  |  154|    619|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    625|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 617]
  |  |  |  |  |  Branch (279:53): [Folded, False: 619]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|    619|            bytes_in_buffer--; \
  |  |  156|    619|            V = *next_input_byte++; )
  ------------------
  405|       |
  406|    619|    length -= 2;
  407|       |
  408|    619|    TRACEMS2(cinfo, 1, JTRC_DAC, index, val);
  ------------------
  |  |  304|    619|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    619|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    619|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    619|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  409|       |
  410|    619|    if (index < 0 || index >= (2 * NUM_ARITH_TBLS))
  ------------------
  |  |   70|    613|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (410:9): [True: 6, False: 613]
  |  Branch (410:22): [True: 37, False: 576]
  ------------------
  411|     37|      ERREXIT1(cinfo, JERR_DAC_INDEX, index);
  ------------------
  |  |  243|     37|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     37|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     37|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  412|       |
  413|    619|    if (index >= NUM_ARITH_TBLS) { /* define AC table */
  ------------------
  |  |   70|    619|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  |  Branch (413:9): [True: 223, False: 396]
  ------------------
  414|    223|      cinfo->arith_ac_K[index - NUM_ARITH_TBLS] = (UINT8)val;
  ------------------
  |  |   70|    223|#define NUM_ARITH_TBLS      16  /* Arith-coding tables are numbered 0..15 */
  ------------------
  415|    396|    } else {                    /* define DC table */
  416|    396|      cinfo->arith_dc_L[index] = (UINT8)(val & 0x0F);
  417|    396|      cinfo->arith_dc_U[index] = (UINT8)(val >> 4);
  418|    396|      if (cinfo->arith_dc_L[index] > cinfo->arith_dc_U[index])
  ------------------
  |  Branch (418:11): [True: 12, False: 384]
  ------------------
  419|     12|        ERREXIT1(cinfo, JERR_DAC_VALUE, val);
  ------------------
  |  |  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)))
  ------------------
  420|    396|    }
  421|    619|  }
  422|       |
  423|    252|  if (length != 0)
  ------------------
  |  Branch (423:7): [True: 7, False: 245]
  ------------------
  424|      7|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  425|       |
  426|    252|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    252|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    252|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  427|    252|  return TRUE;
  ------------------
  |  |  210|    252|#define TRUE    1
  ------------------
  428|    252|}
jdmarker.c:get_dht:
  440|  8.77k|{
  441|  8.77k|  JLONG length;
  442|  8.77k|  UINT8 bits[17];
  443|  8.77k|  UINT8 huffval[256];
  444|  8.77k|  int i, index, count;
  445|  8.77k|  JHUFF_TBL **htblptr;
  446|  8.77k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  8.77k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  8.77k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  8.77k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  447|       |
  448|  8.77k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  8.77k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  17.5k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 8.77k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 8.77k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 8.77k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  8.77k|            bytes_in_buffer--; \
  |  |  164|  8.77k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  8.77k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  8.77k|            bytes_in_buffer--; \
  |  |  167|  8.77k|            V += *next_input_byte++; )
  ------------------
  449|  8.77k|  length -= 2;
  450|       |
  451|  20.2k|  while (length > 16) {
  ------------------
  |  Branch (451:10): [True: 11.4k, False: 8.77k]
  ------------------
  452|  11.4k|    INPUT_BYTE(cinfo, index, return FALSE);
  ------------------
  |  |  154|  11.4k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  11.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 11.4k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  11.4k|            bytes_in_buffer--; \
  |  |  156|  11.4k|            V = *next_input_byte++; )
  ------------------
  453|       |
  454|  11.4k|    TRACEMS1(cinfo, 1, JTRC_DHT, index);
  ------------------
  |  |  300|  11.4k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  11.4k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  11.4k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  455|       |
  456|  11.4k|    bits[0] = 0;
  457|  11.4k|    count = 0;
  458|   194k|    for (i = 1; i <= 16; i++) {
  ------------------
  |  Branch (458:17): [True: 182k, False: 11.4k]
  ------------------
  459|   182k|      INPUT_BYTE(cinfo, bits[i], return FALSE);
  ------------------
  |  |  154|   182k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   182k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 44]
  |  |  |  |  |  Branch (279:38): [True: 44, False: 182k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 182k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   182k|            bytes_in_buffer--; \
  |  |  156|   182k|            V = *next_input_byte++; )
  ------------------
  460|   182k|      count += bits[i];
  461|   182k|    }
  462|       |
  463|  11.4k|    length -= 1 + 16;
  464|       |
  465|  11.4k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  11.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  11.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  11.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  11.4k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  11.4k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  11.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  466|  11.4k|             bits[1], bits[2], bits[3], bits[4],
  467|  11.4k|             bits[5], bits[6], bits[7], bits[8]);
  468|  11.4k|    TRACEMS8(cinfo, 2, JTRC_HUFFBITS,
  ------------------
  |  |  325|  11.4k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  11.4k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.4k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  326|  11.4k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  327|  11.4k|           _mp[4] = (p5);  _mp[5] = (p6);  _mp[6] = (p7);  _mp[7] = (p8); \
  |  |  328|  11.4k|           (cinfo)->err->msg_code = (code); \
  |  |  329|  11.4k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  469|  11.4k|             bits[9], bits[10], bits[11], bits[12],
  470|  11.4k|             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|  11.4k|    if (count > 256 || ((JLONG)count) > length)
  ------------------
  |  Branch (475:9): [True: 118, False: 11.3k]
  |  Branch (475:24): [True: 24, False: 11.2k]
  ------------------
  476|     96|      ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
  ------------------
  |  |  240|     96|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     96|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  477|       |
  478|   398k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (478:17): [True: 387k, False: 11.4k]
  ------------------
  479|   387k|      INPUT_BYTE(cinfo, huffval[i], return FALSE);
  ------------------
  |  |  154|   387k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   398k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 23]
  |  |  |  |  |  Branch (279:38): [True: 23, False: 387k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 387k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  11.4k|            bytes_in_buffer--; \
  |  |  156|  11.4k|            V = *next_input_byte++; )
  ------------------
  480|       |
  481|  11.4k|    memset(&huffval[count], 0, (256 - count) * sizeof(UINT8));
  482|       |
  483|  11.4k|    length -= count;
  484|       |
  485|  11.4k|    if (index & 0x10) {         /* AC table definition */
  ------------------
  |  Branch (485:9): [True: 3.72k, False: 7.71k]
  ------------------
  486|  3.72k|      index -= 0x10;
  487|  3.72k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  3.72k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (487:11): [True: 0, False: 3.72k]
  |  Branch (487:24): [True: 13, False: 3.71k]
  ------------------
  488|     13|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     13|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     13|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     13|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  489|  3.72k|      htblptr = &cinfo->ac_huff_tbl_ptrs[index];
  490|  7.71k|    } else {                    /* DC table definition */
  491|  7.71k|      if (index < 0 || index >= NUM_HUFF_TBLS)
  ------------------
  |  |   69|  7.54k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (491:11): [True: 165, False: 7.54k]
  |  Branch (491:24): [True: 19, False: 7.52k]
  ------------------
  492|     19|        ERREXIT1(cinfo, JERR_DHT_INDEX, index);
  ------------------
  |  |  243|     19|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     19|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     19|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  493|  7.71k|      htblptr = &cinfo->dc_huff_tbl_ptrs[index];
  494|  7.71k|    }
  495|       |
  496|  11.4k|    if (*htblptr == NULL)
  ------------------
  |  Branch (496:9): [True: 7.56k, False: 3.86k]
  ------------------
  497|  7.56k|      *htblptr = jpeg_alloc_huff_table((j_common_ptr)cinfo);
  498|       |
  499|  11.4k|    memcpy((*htblptr)->bits, bits, sizeof((*htblptr)->bits));
  500|  11.4k|    memcpy((*htblptr)->huffval, huffval, sizeof((*htblptr)->huffval));
  501|  11.4k|  }
  502|       |
  503|  8.77k|  if (length != 0)
  ------------------
  |  Branch (503:7): [True: 20, False: 8.75k]
  ------------------
  504|     20|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     20|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     20|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  505|       |
  506|  8.77k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  8.77k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  8.77k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  507|  8.77k|  return TRUE;
  ------------------
  |  |  210|  8.77k|#define TRUE    1
  ------------------
  508|  8.77k|}
jdmarker.c:get_dqt:
  514|  7.10k|{
  515|  7.10k|  JLONG length;
  516|  7.10k|  int n, i, prec;
  517|  7.10k|  unsigned int tmp;
  518|  7.10k|  JQUANT_TBL *quant_ptr;
  519|  7.10k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  7.10k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  7.10k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  7.10k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  520|       |
  521|  7.10k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  7.10k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  14.2k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 7.10k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 7.10k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 7.10k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  7.10k|            bytes_in_buffer--; \
  |  |  164|  7.10k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  7.10k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  7.10k|            bytes_in_buffer--; \
  |  |  167|  7.10k|            V += *next_input_byte++; )
  ------------------
  522|  7.10k|  length -= 2;
  523|       |
  524|  15.5k|  while (length > 0) {
  ------------------
  |  Branch (524:10): [True: 8.43k, False: 7.10k]
  ------------------
  525|  8.43k|    INPUT_BYTE(cinfo, n, return FALSE);
  ------------------
  |  |  154|  8.43k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  8.44k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 8.43k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 8.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  8.43k|            bytes_in_buffer--; \
  |  |  156|  8.43k|            V = *next_input_byte++; )
  ------------------
  526|  8.43k|    prec = n >> 4;
  527|  8.43k|    n &= 0x0F;
  528|       |
  529|  8.43k|    TRACEMS2(cinfo, 1, JTRC_DQT, n, prec);
  ------------------
  |  |  304|  8.43k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  8.43k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  8.43k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  8.43k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  530|       |
  531|  8.43k|    if (n >= NUM_QUANT_TBLS)
  ------------------
  |  |   68|  8.43k|#define NUM_QUANT_TBLS      4   /* Quantization tables are numbered 0..3 */
  ------------------
  |  Branch (531:9): [True: 25, False: 8.41k]
  ------------------
  532|     25|      ERREXIT1(cinfo, JERR_DQT_INDEX, n);
  ------------------
  |  |  243|     25|  ((cinfo)->err->msg_code = (code), \
  |  |  244|     25|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  245|     25|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  533|       |
  534|  8.43k|    if (cinfo->quant_tbl_ptrs[n] == NULL)
  ------------------
  |  Branch (534:9): [True: 6.45k, False: 1.98k]
  ------------------
  535|  6.45k|      cinfo->quant_tbl_ptrs[n] = jpeg_alloc_quant_table((j_common_ptr)cinfo);
  536|  8.43k|    quant_ptr = cinfo->quant_tbl_ptrs[n];
  537|       |
  538|   544k|    for (i = 0; i < DCTSIZE2; i++) {
  ------------------
  |  |   67|   544k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (538:17): [True: 535k, False: 8.43k]
  ------------------
  539|   535k|      if (prec)
  ------------------
  |  Branch (539:11): [True: 85.5k, False: 450k]
  ------------------
  540|   535k|        INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|  85.5k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   171k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 7]
  |  |  |  |  |  Branch (279:38): [True: 7, False: 85.5k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 12]
  |  |  |  |  |  Branch (279:38): [True: 12, False: 85.5k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 85.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|   535k|            bytes_in_buffer--; \
  |  |  164|   535k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|   535k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|   535k|            bytes_in_buffer--; \
  |  |  167|   535k|            V += *next_input_byte++; )
  ------------------
  541|   450k|      else
  542|   535k|        INPUT_BYTE(cinfo, tmp, return FALSE);
  ------------------
  |  |  154|   450k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   450k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 42]
  |  |  |  |  |  Branch (279:38): [True: 42, False: 450k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 450k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|   535k|            bytes_in_buffer--; \
  |  |  156|   535k|            V = *next_input_byte++; )
  ------------------
  543|       |      /* We convert the zigzag-order table to natural array order. */
  544|   535k|      quant_ptr->quantval[jpeg_natural_order[i]] = (UINT16)tmp;
  545|   535k|    }
  546|       |
  547|  8.43k|    if (cinfo->err->trace_level >= 2) {
  ------------------
  |  Branch (547:9): [True: 0, False: 8.43k]
  ------------------
  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|  8.43k|    length -= DCTSIZE2 + 1;
  ------------------
  |  |   67|  8.43k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  558|  8.43k|    if (prec) length -= DCTSIZE2;
  ------------------
  |  |   67|  1.33k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (558:9): [True: 1.33k, False: 7.10k]
  ------------------
  559|  8.43k|  }
  560|       |
  561|  7.10k|  if (length != 0)
  ------------------
  |  Branch (561:7): [True: 24, False: 7.08k]
  ------------------
  562|     24|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     24|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     24|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  563|       |
  564|  7.10k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  7.10k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  7.10k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  565|  7.10k|  return TRUE;
  ------------------
  |  |  210|  7.10k|#define TRUE    1
  ------------------
  566|  7.10k|}
jdmarker.c:get_dri:
  572|    196|{
  573|    196|  JLONG length;
  574|    196|  unsigned int tmp;
  575|    196|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|    196|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|    196|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|    196|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  576|       |
  577|    196|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|    196|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    401|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 195]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 194]
  |  |  |  |  |  Branch (279:53): [Folded, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    196|            bytes_in_buffer--; \
  |  |  164|    196|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    196|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    196|            bytes_in_buffer--; \
  |  |  167|    196|            V += *next_input_byte++; )
  ------------------
  578|       |
  579|    196|  if (length != 4)
  ------------------
  |  Branch (579:7): [True: 29, False: 167]
  ------------------
  580|     29|    ERREXIT(cinfo, JERR_BAD_LENGTH);
  ------------------
  |  |  240|     29|  ((cinfo)->err->msg_code = (code), \
  |  |  241|     29|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  581|       |
  582|    196|  INPUT_2BYTES(cinfo, tmp, return FALSE);
  ------------------
  |  |  162|    196|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|    392|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 196]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 0]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 196]
  |  |  |  |  |  Branch (279:53): [Folded, False: 196]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|    196|            bytes_in_buffer--; \
  |  |  164|    196|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|    196|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|    196|            bytes_in_buffer--; \
  |  |  167|    196|            V += *next_input_byte++; )
  ------------------
  583|       |
  584|    196|  TRACEMS1(cinfo, 1, JTRC_DRI, tmp);
  ------------------
  |  |  300|    196|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    196|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    196|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  585|       |
  586|    196|  cinfo->restart_interval = tmp;
  587|       |
  588|    196|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|    196|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|    196|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  589|    196|  return TRUE;
  ------------------
  |  |  210|    196|#define TRUE    1
  ------------------
  590|    196|}
jdmarker.c:read_restart_marker:
 1139|    304|{
 1140|       |  /* Obtain a marker unless we already did. */
 1141|       |  /* Note that next_marker will complain if it skips any data. */
 1142|    304|  if (cinfo->unread_marker == 0) {
  ------------------
  |  Branch (1142:7): [True: 33, False: 271]
  ------------------
 1143|     33|    if (!next_marker(cinfo))
  ------------------
  |  Branch (1143:9): [True: 0, False: 33]
  ------------------
 1144|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1145|     33|  }
 1146|       |
 1147|    304|  if (cinfo->unread_marker ==
  ------------------
  |  Branch (1147:7): [True: 282, False: 22]
  ------------------
 1148|    304|      ((int)M_RST0 + cinfo->marker->next_restart_num)) {
 1149|       |    /* Normal case --- swallow the marker and let entropy decoder continue */
 1150|    282|    TRACEMS1(cinfo, 3, JTRC_RST, cinfo->marker->next_restart_num);
  ------------------
  |  |  300|    282|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    282|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    282|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
 1151|    282|    cinfo->unread_marker = 0;
 1152|    282|  } else {
 1153|       |    /* Uh-oh, the restart markers have been messed up. */
 1154|       |    /* Let the data source manager determine how to resync. */
 1155|     22|    if (!(*cinfo->src->resync_to_restart) (cinfo,
  ------------------
  |  Branch (1155:9): [True: 0, False: 22]
  ------------------
 1156|     22|                                           cinfo->marker->next_restart_num))
 1157|      0|      return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
 1158|     22|  }
 1159|       |
 1160|       |  /* Update next-restart state */
 1161|    304|  cinfo->marker->next_restart_num = (cinfo->marker->next_restart_num + 1) & 7;
 1162|       |
 1163|    304|  return TRUE;
  ------------------
  |  |  210|    304|#define TRUE    1
  ------------------
 1164|    304|}
jdmarker.c:skip_variable:
  864|  11.1k|{
  865|  11.1k|  JLONG length;
  866|  11.1k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  11.1k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  11.1k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  11.1k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  867|       |
  868|  11.1k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  11.1k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  22.3k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 3]
  |  |  |  |  |  Branch (279:38): [True: 3, False: 11.1k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 2]
  |  |  |  |  |  Branch (279:38): [True: 2, False: 11.1k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 11.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  11.1k|            bytes_in_buffer--; \
  |  |  164|  11.1k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  11.1k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  11.1k|            bytes_in_buffer--; \
  |  |  167|  11.1k|            V += *next_input_byte++; )
  ------------------
  869|  11.1k|  length -= 2;
  870|       |
  871|  11.1k|  TRACEMS2(cinfo, 1, JTRC_MISC_MARKER, cinfo->unread_marker, (int)length);
  ------------------
  |  |  304|  11.1k|  ((cinfo)->err->msg_code = (code), \
  |  |  305|  11.1k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|  11.1k|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|  11.1k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  872|       |
  873|  11.1k|  INPUT_SYNC(cinfo);            /* do before skip_input_data */
  ------------------
  |  |  131|  11.1k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  11.1k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  874|  11.1k|  if (length > 0)
  ------------------
  |  Branch (874:7): [True: 9.65k, False: 1.50k]
  ------------------
  875|  9.65k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  876|       |
  877|  11.1k|  return TRUE;
  ------------------
  |  |  210|  11.1k|#define TRUE    1
  ------------------
  878|  11.1k|}
jdmarker.c:get_interesting_appn:
  712|  12.0k|{
  713|  12.0k|  JLONG length;
  714|  12.0k|  JOCTET b[APPN_DATA_LEN];
  715|  12.0k|  unsigned int i, numtoread;
  716|  12.0k|  INPUT_VARS(cinfo);
  ------------------
  |  |  125|  12.0k|  struct jpeg_source_mgr *datasrc = (cinfo)->src; \
  |  |  126|  12.0k|  const JOCTET *next_input_byte = datasrc->next_input_byte; \
  |  |  127|  12.0k|  size_t bytes_in_buffer = datasrc->bytes_in_buffer
  ------------------
  717|       |
  718|  12.0k|  INPUT_2BYTES(cinfo, length, return FALSE);
  ------------------
  |  |  162|  12.0k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|  24.1k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 1]
  |  |  |  |  |  Branch (279:38): [True: 1, False: 12.0k]
  |  |  |  |  |  Branch (279:38): [True: 0, False: 6]
  |  |  |  |  |  Branch (279:38): [True: 6, False: 12.0k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 12.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  163|  12.0k|            bytes_in_buffer--; \
  |  |  164|  12.0k|            V = ((unsigned int)(*next_input_byte++)) << 8; \
  |  |  165|  12.0k|            MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  166|  12.0k|            bytes_in_buffer--; \
  |  |  167|  12.0k|            V += *next_input_byte++; )
  ------------------
  719|  12.0k|  length -= 2;
  720|       |
  721|       |  /* get the interesting part of the marker data */
  722|  12.0k|  if (length >= APPN_DATA_LEN)
  ------------------
  |  |  602|  12.0k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  |  Branch (722:7): [True: 9.38k, False: 2.70k]
  ------------------
  723|  9.38k|    numtoread = APPN_DATA_LEN;
  ------------------
  |  |  602|  9.38k|#define APPN_DATA_LEN   14      /* Must be the largest of the above!! */
  ------------------
  724|  2.70k|  else if (length > 0)
  ------------------
  |  Branch (724:12): [True: 2.15k, False: 547]
  ------------------
  725|  2.15k|    numtoread = (unsigned int)length;
  726|    547|  else
  727|    547|    numtoread = 0;
  728|   167k|  for (i = 0; i < numtoread; i++)
  ------------------
  |  Branch (728:15): [True: 155k, False: 12.0k]
  ------------------
  729|   155k|    INPUT_BYTE(cinfo, b[i], return FALSE);
  ------------------
  |  |  154|   155k|  MAKESTMT( MAKE_BYTE_AVAIL(cinfo, action); \
  |  |  ------------------
  |  |  |  |  279|   167k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:38): [True: 0, False: 23]
  |  |  |  |  |  Branch (279:38): [True: 23, False: 155k]
  |  |  |  |  |  Branch (279:53): [Folded, False: 155k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  155|  12.0k|            bytes_in_buffer--; \
  |  |  156|  12.0k|            V = *next_input_byte++; )
  ------------------
  730|  12.0k|  length -= numtoread;
  731|       |
  732|       |  /* process it */
  733|  12.0k|  switch (cinfo->unread_marker) {
  734|  9.28k|  case M_APP0:
  ------------------
  |  Branch (734:3): [True: 9.28k, False: 2.79k]
  ------------------
  735|  9.28k|    examine_app0(cinfo, (JOCTET *)b, numtoread, length);
  736|  9.28k|    break;
  737|  2.76k|  case M_APP14:
  ------------------
  |  Branch (737:3): [True: 2.76k, False: 9.31k]
  ------------------
  738|  2.76k|    examine_app14(cinfo, (JOCTET *)b, numtoread, length);
  739|  2.76k|    break;
  740|      0|  default:
  ------------------
  |  Branch (740:3): [True: 0, False: 12.0k]
  ------------------
  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|  12.0k|  }
  745|       |
  746|       |  /* skip any remaining data -- could be lots */
  747|  12.0k|  INPUT_SYNC(cinfo);
  ------------------
  |  |  131|  12.0k|  ( datasrc->next_input_byte = next_input_byte, \
  |  |  132|  12.0k|    datasrc->bytes_in_buffer = bytes_in_buffer )
  ------------------
  748|  12.0k|  if (length > 0)
  ------------------
  |  Branch (748:7): [True: 1.18k, False: 10.8k]
  ------------------
  749|  1.18k|    (*cinfo->src->skip_input_data) (cinfo, (long)length);
  750|       |
  751|  12.0k|  return TRUE;
  ------------------
  |  |  210|  12.0k|#define TRUE    1
  ------------------
  752|  12.0k|}
jdmarker.c:examine_app0:
  612|  9.28k|{
  613|  9.28k|  JLONG totallen = (JLONG)datalen + remaining;
  614|       |
  615|  9.28k|  if (datalen >= APP0_DATA_LEN &&
  ------------------
  |  |  600|  18.5k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  |  Branch (615:7): [True: 8.33k, False: 947]
  ------------------
  616|  8.33k|      data[0] == 0x4A &&
  ------------------
  |  Branch (616:7): [True: 5.44k, False: 2.88k]
  ------------------
  617|  5.44k|      data[1] == 0x46 &&
  ------------------
  |  Branch (617:7): [True: 4.97k, False: 476]
  ------------------
  618|  4.97k|      data[2] == 0x49 &&
  ------------------
  |  Branch (618:7): [True: 4.59k, False: 374]
  ------------------
  619|  4.59k|      data[3] == 0x46 &&
  ------------------
  |  Branch (619:7): [True: 3.03k, False: 1.56k]
  ------------------
  620|  3.03k|      data[4] == 0) {
  ------------------
  |  Branch (620:7): [True: 2.45k, False: 580]
  ------------------
  621|       |    /* Found JFIF APP0 marker: save info */
  622|  2.45k|    cinfo->saw_JFIF_marker = TRUE;
  ------------------
  |  |  210|  2.45k|#define TRUE    1
  ------------------
  623|  2.45k|    cinfo->JFIF_major_version = data[5];
  624|  2.45k|    cinfo->JFIF_minor_version = data[6];
  625|  2.45k|    cinfo->density_unit = data[7];
  626|  2.45k|    cinfo->X_density = (data[8] << 8) + data[9];
  627|  2.45k|    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|  2.45k|    if (cinfo->JFIF_major_version != 1)
  ------------------
  |  Branch (634:9): [True: 7, False: 2.44k]
  ------------------
  635|      7|      WARNMS2(cinfo, JWRN_JFIF_MAJOR,
  ------------------
  |  |  290|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      7|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      7|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      7|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  636|  2.45k|              cinfo->JFIF_major_version, cinfo->JFIF_minor_version);
  637|       |    /* Generate trace messages */
  638|  2.45k|    TRACEMS5(cinfo, 1, JTRC_JFIF,
  ------------------
  |  |  319|  2.45k|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|  2.45k|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 2.45k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  320|  2.45k|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  321|  2.45k|           _mp[4] = (p5); \
  |  |  322|  2.45k|           (cinfo)->err->msg_code = (code); \
  |  |  323|  2.45k|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  639|  2.45k|             cinfo->JFIF_major_version, cinfo->JFIF_minor_version,
  640|  2.45k|             cinfo->X_density, cinfo->Y_density, cinfo->density_unit);
  641|       |    /* Validate thumbnail dimensions and issue appropriate messages */
  642|  2.45k|    if (data[12] | data[13])
  ------------------
  |  Branch (642:9): [True: 659, False: 1.79k]
  ------------------
  643|    659|      TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, data[12], data[13]);
  ------------------
  |  |  304|    659|  ((cinfo)->err->msg_code = (code), \
  |  |  305|    659|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|    659|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|    659|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  644|  2.45k|    totallen -= APP0_DATA_LEN;
  ------------------
  |  |  600|  2.45k|#define APP0_DATA_LEN   14      /* Length of interesting data in APP0 */
  ------------------
  645|  2.45k|    if (totallen != ((JLONG)data[12] * (JLONG)data[13] * (JLONG)3))
  ------------------
  |  Branch (645:9): [True: 242, False: 2.21k]
  ------------------
  646|    242|      TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, (int)totallen);
  ------------------
  |  |  300|    242|  ((cinfo)->err->msg_code = (code), \
  |  |  301|    242|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|    242|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  647|  6.82k|  } else if (datalen >= 6 &&
  ------------------
  |  Branch (647:14): [True: 6.30k, False: 521]
  ------------------
  648|  6.30k|             data[0] == 0x4A &&
  ------------------
  |  Branch (648:14): [True: 3.12k, False: 3.18k]
  ------------------
  649|  3.12k|             data[1] == 0x46 &&
  ------------------
  |  Branch (649:14): [True: 2.51k, False: 606]
  ------------------
  650|  2.51k|             data[2] == 0x58 &&
  ------------------
  |  Branch (650:14): [True: 82, False: 2.43k]
  ------------------
  651|     82|             data[3] == 0x58 &&
  ------------------
  |  Branch (651:14): [True: 72, False: 10]
  ------------------
  652|     72|             data[4] == 0) {
  ------------------
  |  Branch (652:14): [True: 61, False: 11]
  ------------------
  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|     61|    switch (data[5]) {
  658|     18|    case 0x10:
  ------------------
  |  Branch (658:5): [True: 18, False: 43]
  ------------------
  659|     18|      TRACEMS1(cinfo, 1, JTRC_THUMB_JPEG, (int)totallen);
  ------------------
  |  |  300|     18|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     18|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     18|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  660|     18|      break;
  661|     21|    case 0x11:
  ------------------
  |  Branch (661:5): [True: 21, False: 40]
  ------------------
  662|     21|      TRACEMS1(cinfo, 1, JTRC_THUMB_PALETTE, (int)totallen);
  ------------------
  |  |  300|     21|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     21|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     21|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  663|     21|      break;
  664|     10|    case 0x13:
  ------------------
  |  Branch (664:5): [True: 10, False: 51]
  ------------------
  665|     10|      TRACEMS1(cinfo, 1, JTRC_THUMB_RGB, (int)totallen);
  ------------------
  |  |  300|     10|  ((cinfo)->err->msg_code = (code), \
  |  |  301|     10|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|     10|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  666|     10|      break;
  667|     12|    default:
  ------------------
  |  Branch (667:5): [True: 12, False: 49]
  ------------------
  668|     12|      TRACEMS2(cinfo, 1, JTRC_JFIF_EXTENSION, data[5], (int)totallen);
  ------------------
  |  |  304|     12|  ((cinfo)->err->msg_code = (code), \
  |  |  305|     12|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  306|     12|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  307|     12|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  669|     12|      break;
  670|     61|    }
  671|  6.76k|  } else {
  672|       |    /* Start of APP0 does not match "JFIF" or "JFXX", or too short */
  673|  6.76k|    TRACEMS1(cinfo, 1, JTRC_APP0, (int)totallen);
  ------------------
  |  |  300|  6.76k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  6.76k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  6.76k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  674|  6.76k|  }
  675|  9.28k|}
jdmarker.c:examine_app14:
  685|  2.76k|{
  686|  2.76k|  unsigned int version, flags0, flags1, transform;
  687|       |
  688|  2.76k|  if (datalen >= APP14_DATA_LEN &&
  ------------------
  |  |  601|  5.53k|#define APP14_DATA_LEN  12      /* Length of interesting data in APP14 */
  ------------------
  |  Branch (688:7): [True: 2.54k, False: 229]
  ------------------
  689|  2.54k|      data[0] == 0x41 &&
  ------------------
  |  Branch (689:7): [True: 1.13k, False: 1.40k]
  ------------------
  690|  1.13k|      data[1] == 0x64 &&
  ------------------
  |  Branch (690:7): [True: 794, False: 340]
  ------------------
  691|    794|      data[2] == 0x6F &&
  ------------------
  |  Branch (691:7): [True: 685, False: 109]
  ------------------
  692|    685|      data[3] == 0x62 &&
  ------------------
  |  Branch (692:7): [True: 480, False: 205]
  ------------------
  693|    480|      data[4] == 0x65) {
  ------------------
  |  Branch (693:7): [True: 458, False: 22]
  ------------------
  694|       |    /* Found Adobe APP14 marker */
  695|    458|    version = (data[5] << 8) + data[6];
  696|    458|    flags0 = (data[7] << 8) + data[8];
  697|    458|    flags1 = (data[9] << 8) + data[10];
  698|    458|    transform = data[11];
  699|    458|    TRACEMS4(cinfo, 1, JTRC_ADOBE, version, flags0, flags1, transform);
  ------------------
  |  |  314|    458|  MAKESTMT(int *_mp = (cinfo)->err->msg_parm.i; \
  |  |  ------------------
  |  |  |  |  279|    458|#define MAKESTMT(stuff)         do { stuff } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (279:53): [Folded, False: 458]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  315|    458|           _mp[0] = (p1);  _mp[1] = (p2);  _mp[2] = (p3);  _mp[3] = (p4); \
  |  |  316|    458|           (cinfo)->err->msg_code = (code); \
  |  |  317|    458|           (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)); )
  ------------------
  700|    458|    cinfo->saw_Adobe_marker = TRUE;
  ------------------
  |  |  210|    458|#define TRUE    1
  ------------------
  701|    458|    cinfo->Adobe_transform = (UINT8)transform;
  702|  2.31k|  } else {
  703|       |    /* Start of APP14 does not match "Adobe", or too short */
  704|  2.31k|    TRACEMS1(cinfo, 1, JTRC_APP14, (int)(datalen + remaining));
  ------------------
  |  |  300|  2.31k|  ((cinfo)->err->msg_code = (code), \
  |  |  301|  2.31k|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  302|  2.31k|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), (lvl)))
  ------------------
  705|  2.31k|  }
  706|  2.76k|}

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

jinit_phuff_decoder:
  654|    727|{
  655|    727|  phuff_entropy_ptr entropy;
  656|    727|  int *coef_bit_ptr;
  657|    727|  int ci, i;
  658|       |
  659|    727|  entropy = (phuff_entropy_ptr)
  660|    727|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    727|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  661|    727|                                sizeof(phuff_entropy_decoder));
  662|    727|  cinfo->entropy = (struct jpeg_entropy_decoder *)entropy;
  663|    727|  entropy->pub.start_pass = start_pass_phuff_decoder;
  664|       |
  665|       |  /* Mark derived tables unallocated */
  666|  3.63k|  for (i = 0; i < NUM_HUFF_TBLS; i++) {
  ------------------
  |  |   69|  3.63k|#define NUM_HUFF_TBLS       4   /* Huffman tables are numbered 0..3 */
  ------------------
  |  Branch (666:15): [True: 2.90k, False: 727]
  ------------------
  667|  2.90k|    entropy->derived_tbls[i] = NULL;
  668|  2.90k|  }
  669|       |
  670|       |  /* Create progression status table */
  671|    727|  cinfo->coef_bits = (int (*)[DCTSIZE2])
  672|    727|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    727|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  673|    727|                                cinfo->num_components * 2 * DCTSIZE2 *
  ------------------
  |  |   67|    727|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  674|    727|                                sizeof(int));
  675|    727|  coef_bit_ptr = &cinfo->coef_bits[0][0];
  676|  2.95k|  for (ci = 0; ci < cinfo->num_components; ci++)
  ------------------
  |  Branch (676:16): [True: 2.22k, False: 727]
  ------------------
  677|   144k|    for (i = 0; i < DCTSIZE2; i++)
  ------------------
  |  |   67|   144k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (677:17): [True: 142k, False: 2.22k]
  ------------------
  678|   142k|      *coef_bit_ptr++ = -1;
  679|    727|}
jdphuff.c:start_pass_phuff_decoder:
   83|  2.60k|{
   84|  2.60k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
   85|  2.60k|  boolean is_DC_band, bad;
   86|  2.60k|  int ci, coefi, tbl;
   87|  2.60k|  d_derived_tbl **pdtbl;
   88|  2.60k|  int *coef_bit_ptr, *prev_coef_bit_ptr;
   89|  2.60k|  jpeg_component_info *compptr;
   90|       |
   91|  2.60k|  is_DC_band = (cinfo->Ss == 0);
   92|       |
   93|       |  /* Validate scan parameters */
   94|  2.60k|  bad = FALSE;
  ------------------
  |  |  207|  2.60k|#define FALSE   0               /* values of boolean */
  ------------------
   95|  2.60k|  if (is_DC_band) {
  ------------------
  |  Branch (95:7): [True: 817, False: 1.78k]
  ------------------
   96|    817|    if (cinfo->Se != 0)
  ------------------
  |  Branch (96:9): [True: 4, False: 813]
  ------------------
   97|      4|      bad = TRUE;
  ------------------
  |  |  210|      4|#define TRUE    1
  ------------------
   98|  1.78k|  } else {
   99|       |    /* need not check Ss/Se < 0 since they came from unsigned bytes */
  100|  1.78k|    if (cinfo->Ss > cinfo->Se || cinfo->Se >= DCTSIZE2)
  ------------------
  |  |   67|  1.76k|#define DCTSIZE2            64  /* DCTSIZE squared; # of elements in a block */
  ------------------
  |  Branch (100:9): [True: 21, False: 1.76k]
  |  Branch (100:34): [True: 12, False: 1.75k]
  ------------------
  101|     33|      bad = TRUE;
  ------------------
  |  |  210|     33|#define TRUE    1
  ------------------
  102|       |    /* AC scans may have only one component */
  103|  1.78k|    if (cinfo->comps_in_scan != 1)
  ------------------
  |  Branch (103:9): [True: 34, False: 1.74k]
  ------------------
  104|     34|      bad = TRUE;
  ------------------
  |  |  210|     34|#define TRUE    1
  ------------------
  105|  1.78k|  }
  106|  2.60k|  if (cinfo->Ah != 0) {
  ------------------
  |  Branch (106:7): [True: 641, False: 1.95k]
  ------------------
  107|       |    /* Successive approximation refinement scan: must have Al = Ah-1. */
  108|    641|    if (cinfo->Al != cinfo->Ah - 1)
  ------------------
  |  Branch (108:9): [True: 22, False: 619]
  ------------------
  109|     22|      bad = TRUE;
  ------------------
  |  |  210|     22|#define TRUE    1
  ------------------
  110|    641|  }
  111|  2.60k|  if (cinfo->Al > 13)           /* need not check for < 0 */
  ------------------
  |  Branch (111:7): [True: 15, False: 2.58k]
  ------------------
  112|     15|    bad = TRUE;
  ------------------
  |  |  210|     15|#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|  2.60k|  if (bad)
  ------------------
  |  Branch (119:7): [True: 45, False: 2.55k]
  ------------------
  120|     45|    ERREXIT4(cinfo, JERR_BAD_PROGRESSION,
  ------------------
  |  |  258|     45|  ((cinfo)->err->msg_code = (code), \
  |  |  259|     45|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  260|     45|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  261|     45|   (cinfo)->err->msg_parm.i[2] = (p3), \
  |  |  262|     45|   (cinfo)->err->msg_parm.i[3] = (p4), \
  |  |  263|     45|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  121|  2.60k|             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|  6.76k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (126:16): [True: 4.16k, False: 2.60k]
  ------------------
  127|  4.16k|    int cindex = cinfo->cur_comp_info[ci]->component_index;
  128|  4.16k|    coef_bit_ptr = &cinfo->coef_bits[cindex][0];
  129|  4.16k|    prev_coef_bit_ptr = &cinfo->coef_bits[cindex + cinfo->num_components][0];
  130|  4.16k|    if (!is_DC_band && coef_bit_ptr[0] < 0) /* AC without prior DC scan */
  ------------------
  |  Branch (130:9): [True: 1.74k, False: 2.42k]
  |  Branch (130:24): [True: 3, False: 1.74k]
  ------------------
  131|      3|      WARNMS2(cinfo, JWRN_BOGUS_PROGRESSION, cindex, 0);
  ------------------
  |  |  290|      3|  ((cinfo)->err->msg_code = (code), \
  |  |  291|      3|   (cinfo)->err->msg_parm.i[0] = (p1), \
  |  |  292|      3|   (cinfo)->err->msg_parm.i[1] = (p2), \
  |  |  293|      3|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  132|   118k|    for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  515|  4.16k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 2.42k, False: 1.74k]
  |  |  ------------------
  ------------------
                  for (coefi = MIN(cinfo->Ss, 1); coefi <= MAX(cinfo->Se, 9); coefi++) {
  ------------------
  |  |  513|   118k|#define MAX(a, b)       ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (513:26): [True: 88.1k, False: 30.1k]
  |  |  ------------------
  ------------------
  |  Branch (132:37): [True: 114k, False: 4.16k]
  ------------------
  133|   114k|      if (cinfo->input_scan_number > 1)
  ------------------
  |  Branch (133:11): [True: 93.8k, False: 20.3k]
  ------------------
  134|  93.8k|        prev_coef_bit_ptr[coefi] = coef_bit_ptr[coefi];
  135|  20.3k|      else
  136|  20.3k|        prev_coef_bit_ptr[coefi] = 0;
  137|   114k|    }
  138|  93.8k|    for (coefi = cinfo->Ss; coefi <= cinfo->Se; coefi++) {
  ------------------
  |  Branch (138:29): [True: 89.6k, False: 4.16k]
  ------------------
  139|  89.6k|      int expected = (coef_bit_ptr[coefi] < 0) ? 0 : coef_bit_ptr[coefi];
  ------------------
  |  Branch (139:22): [True: 47.9k, False: 41.7k]
  ------------------
  140|  89.6k|      if (cinfo->Ah != expected)
  ------------------
  |  Branch (140:11): [True: 4, False: 89.6k]
  ------------------
  141|      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))
  ------------------
  142|  89.6k|      coef_bit_ptr[coefi] = cinfo->Al;
  143|  89.6k|    }
  144|  4.16k|  }
  145|       |
  146|       |  /* Select MCU decoding routine */
  147|  2.60k|  if (cinfo->Ah == 0) {
  ------------------
  |  Branch (147:7): [True: 1.94k, False: 655]
  ------------------
  148|  1.94k|    if (is_DC_band)
  ------------------
  |  Branch (148:9): [True: 677, False: 1.26k]
  ------------------
  149|    677|      entropy->pub.decode_mcu = decode_mcu_DC_first;
  150|  1.26k|    else
  151|  1.26k|      entropy->pub.decode_mcu = decode_mcu_AC_first;
  152|  1.94k|  } else {
  153|    655|    if (is_DC_band)
  ------------------
  |  Branch (153:9): [True: 129, False: 526]
  ------------------
  154|    129|      entropy->pub.decode_mcu = decode_mcu_DC_refine;
  155|    526|    else
  156|    526|      entropy->pub.decode_mcu = decode_mcu_AC_refine;
  157|    655|  }
  158|       |
  159|  6.74k|  for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
  ------------------
  |  Branch (159:16): [True: 4.14k, False: 2.60k]
  ------------------
  160|  4.14k|    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|  4.14k|    if (is_DC_band) {
  ------------------
  |  Branch (164:9): [True: 2.40k, False: 1.74k]
  ------------------
  165|  2.40k|      if (cinfo->Ah == 0) {     /* DC refinement needs no table */
  ------------------
  |  Branch (165:11): [True: 2.02k, False: 385]
  ------------------
  166|  2.02k|        tbl = compptr->dc_tbl_no;
  167|  2.02k|        pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  168|  2.02k|        jpeg_make_d_derived_tbl(cinfo, TRUE, tbl, pdtbl);
  ------------------
  |  |  210|  2.02k|#define TRUE    1
  ------------------
  169|  2.02k|      }
  170|  2.40k|    } else {
  171|  1.74k|      tbl = compptr->ac_tbl_no;
  172|  1.74k|      pdtbl = (d_derived_tbl **)(entropy->derived_tbls) + tbl;
  173|  1.74k|      jpeg_make_d_derived_tbl(cinfo, FALSE, tbl, pdtbl);
  ------------------
  |  |  207|  1.74k|#define FALSE   0               /* values of boolean */
  ------------------
  174|       |      /* remember the single active table */
  175|  1.74k|      entropy->ac_derived_tbl = entropy->derived_tbls[tbl];
  176|  1.74k|    }
  177|       |    /* Initialize DC predictions to 0 */
  178|  4.14k|    entropy->saved.last_dc_val[ci] = 0;
  179|  4.14k|  }
  180|       |
  181|       |  /* Initialize bitread state variables */
  182|  2.60k|  entropy->bitstate.bits_left = 0;
  183|  2.60k|  entropy->bitstate.get_buffer = 0; /* unnecessary, but keeps Purify quiet */
  184|  2.60k|  entropy->pub.insufficient_data = FALSE;
  ------------------
  |  |  207|  2.60k|#define FALSE   0               /* values of boolean */
  ------------------
  185|       |
  186|       |  /* Initialize private state variables */
  187|  2.60k|  entropy->saved.EOBRUN = 0;
  188|       |
  189|       |  /* Initialize restart counter */
  190|  2.60k|  entropy->restarts_to_go = cinfo->restart_interval;
  191|  2.60k|}
jdphuff.c:decode_mcu_DC_first:
  291|  50.3k|{
  292|  50.3k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  293|  50.3k|  int Al = cinfo->Al;
  294|  50.3k|  register int s, r;
  295|  50.3k|  int blkn, ci;
  296|  50.3k|  JBLOCKROW block;
  297|  50.3k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  50.3k|  register bit_buf_type get_buffer; \
  |  |  126|  50.3k|  register int bits_left; \
  |  |  127|  50.3k|  bitread_working_state br_state
  ------------------
  298|  50.3k|  savable_state state;
  299|  50.3k|  d_derived_tbl *tbl;
  300|  50.3k|  jpeg_component_info *compptr;
  301|       |
  302|       |  /* Process restart marker if needed; may have to suspend */
  303|  50.3k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (303:7): [True: 0, False: 50.3k]
  ------------------
  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|  50.3k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (312:7): [True: 50.3k, False: 0]
  ------------------
  313|       |
  314|       |    /* Load up working state */
  315|  50.3k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  50.3k|  br_state.cinfo = cinfop; \
  |  |  131|  50.3k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  50.3k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  50.3k|  get_buffer = permstate.get_buffer; \
  |  |  134|  50.3k|  bits_left = permstate.bits_left;
  ------------------
  316|  50.3k|    state = entropy->saved;
  317|       |
  318|       |    /* Outer loop handles each block in the MCU */
  319|       |
  320|   311k|    for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (320:20): [True: 260k, False: 50.2k]
  ------------------
  321|   260k|      block = MCU_data[blkn];
  322|   260k|      ci = cinfo->MCU_membership[blkn];
  323|   260k|      compptr = cinfo->cur_comp_info[ci];
  324|   260k|      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|   260k|      HUFF_DECODE(s, br_state, tbl, return FALSE, label1);
  ------------------
  |  |  200|   260k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   260k|  register int nb, look; \
  |  |  202|   260k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   260k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 26.0k, False: 234k]
  |  |  ------------------
  |  |  203|  26.0k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 26.0k]
  |  |  ------------------
  |  |  204|  26.0k|      { failaction; } \
  |  |  205|  26.0k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  26.0k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  26.0k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 347, False: 25.7k]
  |  |  ------------------
  |  |  207|    347|      nb = 1;  goto slowlabel; \
  |  |  208|    347|    } \
  |  |  209|  26.0k|  } \
  |  |  210|   260k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   260k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   260k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   260k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   260k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 260k, False: 328]
  |  |  ------------------
  |  |  212|   260k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   260k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   260k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   260k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   260k|  } else { \
  |  |  215|    629|slowlabel: \
  |  |  216|    629|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 629]
  |  |  ------------------
  |  |  217|    629|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|    629|      { failaction; } \
  |  |  219|    629|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|    629|  } \
  |  |  221|   260k|}
  ------------------
  330|   260k|      if (s) {
  ------------------
  |  Branch (330:11): [True: 203k, False: 57.5k]
  ------------------
  331|   203k|        CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|   203k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   203k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.57k, False: 201k]
  |  |  ------------------
  |  |  162|  1.57k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.57k]
  |  |  ------------------
  |  |  163|  1.57k|      { action; } \
  |  |  164|  1.57k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.57k|  } \
  |  |  166|   203k|}
  ------------------
  332|   203k|        r = GET_BITS(s);
  ------------------
  |  |  169|   203k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  333|   203k|        s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|   203k|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|   104k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 104k, False: 98.5k]
  |  |  ------------------
  ------------------
  334|   203k|      }
  335|       |
  336|       |      /* Convert DC difference to actual value, update last_dc_val */
  337|   260k|      if ((state.last_dc_val[ci] >= 0 &&
  ------------------
  |  Branch (337:12): [True: 124k, False: 136k]
  ------------------
  338|   124k|           s > INT_MAX - state.last_dc_val[ci]) ||
  ------------------
  |  Branch (338:12): [True: 0, False: 124k]
  ------------------
  339|   260k|          (state.last_dc_val[ci] < 0 && s < INT_MIN - state.last_dc_val[ci]))
  ------------------
  |  Branch (339:12): [True: 136k, False: 124k]
  |  Branch (339:41): [True: 0, False: 136k]
  ------------------
  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|   260k|      s += state.last_dc_val[ci];
  342|   260k|      state.last_dc_val[ci] = s;
  343|       |      /* Scale and output the coefficient (assumes jpeg_natural_order[0]=0) */
  344|   260k|      (*block)[0] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|   260k|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  345|   260k|    }
  346|       |
  347|       |    /* Completed MCU, so update state */
  348|  50.2k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  50.2k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  50.2k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  50.2k|  permstate.get_buffer = get_buffer; \
  |  |  140|  50.2k|  permstate.bits_left = bits_left
  ------------------
  349|  50.2k|    entropy->saved = state;
  350|  50.2k|  }
  351|       |
  352|       |  /* Account for restart interval (no-op if not using restarts) */
  353|  50.2k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (353:7): [True: 0, False: 50.2k]
  ------------------
  354|      0|    entropy->restarts_to_go--;
  355|       |
  356|  50.2k|  return TRUE;
  ------------------
  |  |  210|  50.2k|#define TRUE    1
  ------------------
  357|  50.3k|}
jdphuff.c:decode_mcu_AC_first:
  367|   261k|{
  368|   261k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  369|   261k|  int Se = cinfo->Se;
  370|   261k|  int Al = cinfo->Al;
  371|   261k|  register int s, k, r;
  372|   261k|  unsigned int EOBRUN;
  373|   261k|  JBLOCKROW block;
  374|   261k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   261k|  register bit_buf_type get_buffer; \
  |  |  126|   261k|  register int bits_left; \
  |  |  127|   261k|  bitread_working_state br_state
  ------------------
  375|   261k|  d_derived_tbl *tbl;
  376|       |
  377|       |  /* Process restart marker if needed; may have to suspend */
  378|   261k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (378:7): [True: 0, False: 261k]
  ------------------
  379|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (379:9): [True: 0, False: 0]
  ------------------
  380|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (380:11): [True: 0, False: 0]
  ------------------
  381|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  382|      0|  }
  383|       |
  384|       |  /* If we've run out of data, just leave the MCU set to zeroes.
  385|       |   * This way, we return uniform gray for the remainder of the segment.
  386|       |   */
  387|   261k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (387:7): [True: 261k, False: 0]
  ------------------
  388|       |
  389|       |    /* Load up working state.
  390|       |     * We can avoid loading/saving bitread state if in an EOB run.
  391|       |     */
  392|   261k|    EOBRUN = entropy->saved.EOBRUN;     /* only part of saved state we need */
  393|       |
  394|       |    /* There is always only one block per MCU */
  395|       |
  396|   261k|    if (EOBRUN > 0)             /* if it's a band of zeroes... */
  ------------------
  |  Branch (396:9): [True: 65.9k, False: 195k]
  ------------------
  397|  65.9k|      EOBRUN--;                 /* ...process it now (we do nothing) */
  398|   195k|    else {
  399|   195k|      BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   195k|  br_state.cinfo = cinfop; \
  |  |  131|   195k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   195k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   195k|  get_buffer = permstate.get_buffer; \
  |  |  134|   195k|  bits_left = permstate.bits_left;
  ------------------
  400|   195k|      block = MCU_data[0];
  401|   195k|      tbl = entropy->ac_derived_tbl;
  402|       |
  403|  1.35M|      for (k = cinfo->Ss; k <= Se; k++) {
  ------------------
  |  Branch (403:27): [True: 1.27M, False: 72.9k]
  ------------------
  404|  1.27M|        HUFF_DECODE(s, br_state, tbl, return FALSE, label2);
  ------------------
  |  |  200|  1.27M|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|  1.27M|  register int nb, look; \
  |  |  202|  1.27M|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.27M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 118k, False: 1.15M]
  |  |  ------------------
  |  |  203|   118k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 118k]
  |  |  ------------------
  |  |  204|   118k|      { failaction; } \
  |  |  205|   118k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|   118k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   118k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 241, False: 117k]
  |  |  ------------------
  |  |  207|    241|      nb = 1;  goto slowlabel; \
  |  |  208|    241|    } \
  |  |  209|   118k|  } \
  |  |  210|  1.27M|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|  1.27M|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|  1.27M|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.27M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  1.27M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 1.25M, False: 21.8k]
  |  |  ------------------
  |  |  212|  1.25M|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|  1.25M|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|  1.25M|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|  1.25M|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|  1.25M|  } else { \
  |  |  215|  22.0k|slowlabel: \
  |  |  216|  22.0k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 22.0k]
  |  |  ------------------
  |  |  217|  22.0k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  22.0k|      { failaction; } \
  |  |  219|  22.0k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  22.0k|  } \
  |  |  221|  1.27M|}
  ------------------
  405|  1.27M|        r = s >> 4;
  406|  1.27M|        s &= 15;
  407|  1.27M|        if (s) {
  ------------------
  |  Branch (407:13): [True: 1.15M, False: 124k]
  ------------------
  408|  1.15M|          k += r;
  409|  1.15M|          CHECK_BIT_BUFFER(br_state, s, return FALSE);
  ------------------
  |  |  160|  1.15M|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  1.15M|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 4.55k, False: 1.14M]
  |  |  ------------------
  |  |  162|  4.55k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 4.55k]
  |  |  ------------------
  |  |  163|  4.55k|      { action; } \
  |  |  164|  4.55k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  4.55k|  } \
  |  |  166|  1.15M|}
  ------------------
  410|  1.15M|          r = GET_BITS(s);
  ------------------
  |  |  169|  1.15M|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  411|  1.15M|          s = HUFF_EXTEND(r, s);
  ------------------
  |  |  204|  1.15M|  ((x) < (1 << ((s) - 1)) ? (x) + (((NEG_1) << (s)) + 1) : (x))
  |  |  ------------------
  |  |  |  |  202|   576k|#define NEG_1  ((unsigned)-1)
  |  |  ------------------
  |  |  |  Branch (204:4): [True: 576k, False: 575k]
  |  |  ------------------
  ------------------
  412|       |          /* Scale and output coefficient in natural (dezigzagged) order */
  413|  1.15M|          (*block)[jpeg_natural_order[k]] = (JCOEF)LEFT_SHIFT(s, Al);
  ------------------
  |  |   85|  1.15M|#define LEFT_SHIFT(a, b)  ((JLONG)((unsigned long)(a) << (b)))
  ------------------
  414|  1.15M|        } else {
  415|   124k|          if (r == 15) {        /* ZRL */
  ------------------
  |  Branch (415:15): [True: 1.77k, False: 122k]
  ------------------
  416|  1.77k|            k += 15;            /* skip 15 zeroes in band */
  417|   122k|          } else {              /* EOBr, run length is 2^r + appended bits */
  418|   122k|            EOBRUN = 1 << r;
  419|   122k|            if (r) {            /* EOBr, r > 0 */
  ------------------
  |  Branch (419:17): [True: 14.8k, False: 108k]
  ------------------
  420|  14.8k|              CHECK_BIT_BUFFER(br_state, r, return FALSE);
  ------------------
  |  |  160|  14.8k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  14.8k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 296, False: 14.5k]
  |  |  ------------------
  |  |  162|    296|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 296]
  |  |  ------------------
  |  |  163|    296|      { action; } \
  |  |  164|    296|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    296|  } \
  |  |  166|  14.8k|}
  ------------------
  421|  14.8k|              r = GET_BITS(r);
  ------------------
  |  |  169|  14.8k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  422|  14.8k|              EOBRUN += r;
  423|  14.8k|            }
  424|   122k|            EOBRUN--;           /* this band is processed at this moment */
  425|   122k|            break;              /* force end-of-band */
  426|   122k|          }
  427|   124k|        }
  428|  1.27M|      }
  429|       |
  430|   195k|      BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   195k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   195k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   195k|  permstate.get_buffer = get_buffer; \
  |  |  140|   195k|  permstate.bits_left = bits_left
  ------------------
  431|   195k|    }
  432|       |
  433|       |    /* Completed MCU, so update state */
  434|   261k|    entropy->saved.EOBRUN = EOBRUN;     /* only part of saved state we need */
  435|   261k|  }
  436|       |
  437|       |  /* Account for restart interval (no-op if not using restarts) */
  438|   261k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (438:7): [True: 0, False: 261k]
  ------------------
  439|      0|    entropy->restarts_to_go--;
  440|       |
  441|   261k|  return TRUE;
  ------------------
  |  |  210|   261k|#define TRUE    1
  ------------------
  442|   261k|}
jdphuff.c:decode_mcu_DC_refine:
  453|  18.8k|{
  454|  18.8k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  455|  18.8k|  int p1 = 1 << cinfo->Al;      /* 1 in the bit position being coded */
  456|  18.8k|  int blkn;
  457|  18.8k|  JBLOCKROW block;
  458|  18.8k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|  18.8k|  register bit_buf_type get_buffer; \
  |  |  126|  18.8k|  register int bits_left; \
  |  |  127|  18.8k|  bitread_working_state br_state
  ------------------
  459|       |
  460|       |  /* Process restart marker if needed; may have to suspend */
  461|  18.8k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (461:7): [True: 0, False: 18.8k]
  ------------------
  462|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (462:9): [True: 0, False: 0]
  ------------------
  463|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (463:11): [True: 0, False: 0]
  ------------------
  464|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  465|      0|  }
  466|       |
  467|       |  /* Not worth the cycles to check insufficient_data here,
  468|       |   * since we will not change the data anyway if we read zeroes.
  469|       |   */
  470|       |
  471|       |  /* Load up working state */
  472|  18.8k|  BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|  18.8k|  br_state.cinfo = cinfop; \
  |  |  131|  18.8k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|  18.8k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|  18.8k|  get_buffer = permstate.get_buffer; \
  |  |  134|  18.8k|  bits_left = permstate.bits_left;
  ------------------
  473|       |
  474|       |  /* Outer loop handles each block in the MCU */
  475|       |
  476|   119k|  for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
  ------------------
  |  Branch (476:18): [True: 100k, False: 18.8k]
  ------------------
  477|   100k|    block = MCU_data[blkn];
  478|       |
  479|       |    /* Encoded data is simply the next bit of the two's-complement DC value */
  480|   100k|    CHECK_BIT_BUFFER(br_state, 1, return FALSE);
  ------------------
  |  |  160|   100k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   100k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 1.65k, False: 98.7k]
  |  |  ------------------
  |  |  162|  1.65k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 1.65k]
  |  |  ------------------
  |  |  163|  1.65k|      { action; } \
  |  |  164|  1.65k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  1.65k|  } \
  |  |  166|   100k|}
  ------------------
  481|   100k|    if (GET_BITS(1))
  ------------------
  |  |  169|   100k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 32.6k, False: 67.7k]
  |  |  ------------------
  ------------------
  482|  32.6k|      (*block)[0] |= p1;
  483|       |    /* Note: since we use |=, repeating the assignment later is safe */
  484|   100k|  }
  485|       |
  486|       |  /* Completed MCU, so update state */
  487|  18.8k|  BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|  18.8k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|  18.8k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|  18.8k|  permstate.get_buffer = get_buffer; \
  |  |  140|  18.8k|  permstate.bits_left = bits_left
  ------------------
  488|       |
  489|       |  /* Account for restart interval (no-op if not using restarts) */
  490|  18.8k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (490:7): [True: 0, False: 18.8k]
  ------------------
  491|      0|    entropy->restarts_to_go--;
  492|       |
  493|  18.8k|  return TRUE;
  ------------------
  |  |  210|  18.8k|#define TRUE    1
  ------------------
  494|  18.8k|}
jdphuff.c:decode_mcu_AC_refine:
  503|   133k|{
  504|   133k|  phuff_entropy_ptr entropy = (phuff_entropy_ptr)cinfo->entropy;
  505|   133k|  int Se = cinfo->Se;
  506|   133k|  int p1 = 1 << cinfo->Al;        /* 1 in the bit position being coded */
  507|   133k|  int m1 = (NEG_1) << cinfo->Al;  /* -1 in the bit position being coded */
  ------------------
  |  |  202|   133k|#define NEG_1  ((unsigned)-1)
  ------------------
  508|   133k|  register int s, k, r;
  509|   133k|  unsigned int EOBRUN;
  510|   133k|  JBLOCKROW block;
  511|   133k|  JCOEFPTR thiscoef;
  512|   133k|  BITREAD_STATE_VARS;
  ------------------
  |  |  125|   133k|  register bit_buf_type get_buffer; \
  |  |  126|   133k|  register int bits_left; \
  |  |  127|   133k|  bitread_working_state br_state
  ------------------
  513|   133k|  d_derived_tbl *tbl;
  514|   133k|  int num_newnz;
  515|   133k|  int newnz_pos[DCTSIZE2];
  516|       |
  517|       |  /* Process restart marker if needed; may have to suspend */
  518|   133k|  if (cinfo->restart_interval) {
  ------------------
  |  Branch (518:7): [True: 0, False: 133k]
  ------------------
  519|      0|    if (entropy->restarts_to_go == 0)
  ------------------
  |  Branch (519:9): [True: 0, False: 0]
  ------------------
  520|      0|      if (!process_restart(cinfo))
  ------------------
  |  Branch (520:11): [True: 0, False: 0]
  ------------------
  521|      0|        return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  522|      0|  }
  523|       |
  524|       |  /* If we've run out of data, don't modify the MCU.
  525|       |   */
  526|   133k|  if (!entropy->pub.insufficient_data) {
  ------------------
  |  Branch (526:7): [True: 133k, False: 0]
  ------------------
  527|       |
  528|       |    /* Load up working state */
  529|   133k|    BITREAD_LOAD_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  130|   133k|  br_state.cinfo = cinfop; \
  |  |  131|   133k|  br_state.next_input_byte = cinfop->src->next_input_byte; \
  |  |  132|   133k|  br_state.bytes_in_buffer = cinfop->src->bytes_in_buffer; \
  |  |  133|   133k|  get_buffer = permstate.get_buffer; \
  |  |  134|   133k|  bits_left = permstate.bits_left;
  ------------------
  530|   133k|    EOBRUN = entropy->saved.EOBRUN; /* only part of saved state we need */
  531|       |
  532|       |    /* There is always only one block per MCU */
  533|   133k|    block = MCU_data[0];
  534|   133k|    tbl = entropy->ac_derived_tbl;
  535|       |
  536|       |    /* If we are forced to suspend, we must undo the assignments to any newly
  537|       |     * nonzero coefficients in the block, because otherwise we'd get confused
  538|       |     * next time about which coefficients were already nonzero.
  539|       |     * But we need not undo addition of bits to already-nonzero coefficients;
  540|       |     * instead, we can test the current bit to see if we already did it.
  541|       |     */
  542|   133k|    num_newnz = 0;
  543|       |
  544|       |    /* initialize coefficient loop counter to start of band */
  545|   133k|    k = cinfo->Ss;
  546|       |
  547|   133k|    if (EOBRUN == 0) {
  ------------------
  |  Branch (547:9): [True: 92.5k, False: 41.0k]
  ------------------
  548|   942k|      for (; k <= Se; k++) {
  ------------------
  |  Branch (548:14): [True: 934k, False: 8.07k]
  ------------------
  549|   934k|        HUFF_DECODE(s, br_state, tbl, goto undoit, label3);
  ------------------
  |  |  200|   934k|#define HUFF_DECODE(result, state, htbl, failaction, slowlabel) { \
  |  |  201|   934k|  register int nb, look; \
  |  |  202|   934k|  if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   934k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (202:7): [True: 68.2k, False: 866k]
  |  |  ------------------
  |  |  203|  68.2k|    if (!jpeg_fill_bit_buffer(&state, get_buffer, bits_left, 0)) \
  |  |  ------------------
  |  |  |  Branch (203:9): [True: 0, False: 68.2k]
  |  |  ------------------
  |  |  204|  68.2k|      { failaction; } \
  |  |  205|  68.2k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  206|  68.2k|    if (bits_left < HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|  68.2k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (206:9): [True: 246, False: 68.0k]
  |  |  ------------------
  |  |  207|    246|      nb = 1;  goto slowlabel; \
  |  |  208|    246|    } \
  |  |  209|  68.2k|  } \
  |  |  210|   934k|  look = PEEK_BITS(HUFF_LOOKAHEAD); \
  |  |  ------------------
  |  |  |  |  172|   934k|  (((int)(get_buffer >> (bits_left -  (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  211|   934k|  if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   934k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |                 if ((nb = (htbl->lookup[look] >> HUFF_LOOKAHEAD)) <= HUFF_LOOKAHEAD) { \
  |  |  ------------------
  |  |  |  |   25|   934k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  |  Branch (211:7): [True: 929k, False: 5.39k]
  |  |  ------------------
  |  |  212|   929k|    DROP_BITS(nb); \
  |  |  ------------------
  |  |  |  |  175|   929k|  (bits_left -= (nbits))
  |  |  ------------------
  |  |  213|   929k|    result = htbl->lookup[look] & ((1 << HUFF_LOOKAHEAD) - 1); \
  |  |  ------------------
  |  |  |  |   25|   929k|#define HUFF_LOOKAHEAD  8       /* # of bits of lookahead */
  |  |  ------------------
  |  |  214|   929k|  } else { \
  |  |  215|  5.60k|slowlabel: \
  |  |  216|  5.60k|    if ((result = \
  |  |  ------------------
  |  |  |  Branch (216:9): [True: 0, False: 5.60k]
  |  |  ------------------
  |  |  217|  5.60k|         jpeg_huff_decode(&state, get_buffer, bits_left, htbl, nb)) < 0) \
  |  |  218|  5.60k|      { failaction; } \
  |  |  219|  5.60k|    get_buffer = state.get_buffer;  bits_left = state.bits_left; \
  |  |  220|  5.60k|  } \
  |  |  221|   934k|}
  ------------------
  550|   934k|        r = s >> 4;
  551|   934k|        s &= 15;
  552|   934k|        if (s) {
  ------------------
  |  Branch (552:13): [True: 845k, False: 89.6k]
  ------------------
  553|   845k|          if (s != 1)           /* size of new coef should always be 1 */
  ------------------
  |  Branch (553:15): [True: 17, False: 845k]
  ------------------
  554|     17|            WARNMS(cinfo, JWRN_HUFF_BAD_CODE);
  ------------------
  |  |  283|     17|  ((cinfo)->err->msg_code = (code), \
  |  |  284|     17|   (*(cinfo)->err->emit_message) ((j_common_ptr)(cinfo), -1))
  ------------------
  555|   845k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|   845k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   845k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 323, False: 844k]
  |  |  ------------------
  |  |  162|    323|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 323]
  |  |  ------------------
  |  |  163|    323|      { action; } \
  |  |  164|    323|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    323|  } \
  |  |  166|   845k|}
  ------------------
  556|   845k|          if (GET_BITS(1))
  ------------------
  |  |  169|   845k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 408k, False: 436k]
  |  |  ------------------
  ------------------
  557|   408k|            s = p1;             /* newly nonzero coef is positive */
  558|   436k|          else
  559|   436k|            s = m1;             /* newly nonzero coef is negative */
  560|   845k|        } else {
  561|  89.6k|          if (r != 15) {
  ------------------
  |  Branch (561:15): [True: 84.4k, False: 5.27k]
  ------------------
  562|  84.4k|            EOBRUN = 1 << r;    /* EOBr, run length is 2^r + appended bits */
  563|  84.4k|            if (r) {
  ------------------
  |  Branch (563:17): [True: 5.87k, False: 78.5k]
  ------------------
  564|  5.87k|              CHECK_BIT_BUFFER(br_state, r, goto undoit);
  ------------------
  |  |  160|  5.87k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|  5.87k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 104, False: 5.77k]
  |  |  ------------------
  |  |  162|    104|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 104]
  |  |  ------------------
  |  |  163|    104|      { action; } \
  |  |  164|    104|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|    104|  } \
  |  |  166|  5.87k|}
  ------------------
  565|  5.87k|              r = GET_BITS(r);
  ------------------
  |  |  169|  5.87k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  ------------------
  566|  5.87k|              EOBRUN += r;
  567|  5.87k|            }
  568|  84.4k|            break;              /* rest of block is handled by EOB logic */
  569|  84.4k|          }
  570|       |          /* note s = 0 for processing ZRL */
  571|  89.6k|        }
  572|       |        /* Advance over already-nonzero coefs and r still-zero coefs,
  573|       |         * appending correction bits to the nonzeroes.  A correction bit is 1
  574|       |         * if the absolute value of the coefficient must be increased.
  575|       |         */
  576|  3.02M|        do {
  577|  3.02M|          thiscoef = *block + jpeg_natural_order[k];
  578|  3.02M|          if (*thiscoef != 0) {
  ------------------
  |  Branch (578:15): [True: 989k, False: 2.03M]
  ------------------
  579|   989k|            CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|   989k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   989k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 5.71k, False: 983k]
  |  |  ------------------
  |  |  162|  5.71k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 5.71k]
  |  |  ------------------
  |  |  163|  5.71k|      { action; } \
  |  |  164|  5.71k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  5.71k|  } \
  |  |  166|   989k|}
  ------------------
  580|   989k|            if (GET_BITS(1)) {
  ------------------
  |  |  169|   989k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 404k, False: 585k]
  |  |  ------------------
  ------------------
  581|   404k|              if ((*thiscoef & p1) == 0) { /* do nothing if already set it */
  ------------------
  |  Branch (581:19): [True: 404k, False: 346]
  ------------------
  582|   404k|                if (*thiscoef >= 0)
  ------------------
  |  Branch (582:21): [True: 202k, False: 201k]
  ------------------
  583|   202k|                  *thiscoef += (JCOEF)p1;
  584|   201k|                else
  585|   201k|                  *thiscoef += (JCOEF)m1;
  586|   404k|              }
  587|   404k|            }
  588|  2.03M|          } else {
  589|  2.03M|            if (--r < 0)
  ------------------
  |  Branch (589:17): [True: 846k, False: 1.18M]
  ------------------
  590|   846k|              break;            /* reached target zero coefficient */
  591|  2.03M|          }
  592|  2.17M|          k++;
  593|  2.17M|        } while (k <= Se);
  ------------------
  |  Branch (593:18): [True: 2.17M, False: 3.63k]
  ------------------
  594|   850k|        if (s) {
  ------------------
  |  Branch (594:13): [True: 845k, False: 5.30k]
  ------------------
  595|   845k|          int pos = jpeg_natural_order[k];
  596|       |          /* Output newly nonzero coefficient */
  597|   845k|          (*block)[pos] = (JCOEF)s;
  598|       |          /* Remember its position in case we have to suspend */
  599|   845k|          newnz_pos[num_newnz++] = pos;
  600|   845k|        }
  601|   850k|      }
  602|  92.5k|    }
  603|       |
  604|   133k|    if (EOBRUN > 0) {
  ------------------
  |  Branch (604:9): [True: 125k, False: 8.07k]
  ------------------
  605|       |      /* Scan any remaining coefficient positions after the end-of-band
  606|       |       * (the last newly nonzero coefficient, if any).  Append a correction
  607|       |       * bit to each already-nonzero coefficient.  A correction bit is 1
  608|       |       * if the absolute value of the coefficient must be increased.
  609|       |       */
  610|  5.49M|      for (; k <= Se; k++) {
  ------------------
  |  Branch (610:14): [True: 5.37M, False: 125k]
  ------------------
  611|  5.37M|        thiscoef = *block + jpeg_natural_order[k];
  612|  5.37M|        if (*thiscoef != 0) {
  ------------------
  |  Branch (612:13): [True: 575k, False: 4.79M]
  ------------------
  613|   575k|          CHECK_BIT_BUFFER(br_state, 1, goto undoit);
  ------------------
  |  |  160|   575k|#define CHECK_BIT_BUFFER(state, nbits, action) { \
  |  |  161|   575k|  if (bits_left < (nbits)) { \
  |  |  ------------------
  |  |  |  Branch (161:7): [True: 8.70k, False: 566k]
  |  |  ------------------
  |  |  162|  8.70k|    if (!jpeg_fill_bit_buffer(&(state), get_buffer, bits_left, nbits)) \
  |  |  ------------------
  |  |  |  Branch (162:9): [True: 0, False: 8.70k]
  |  |  ------------------
  |  |  163|  8.70k|      { action; } \
  |  |  164|  8.70k|    get_buffer = (state).get_buffer;  bits_left = (state).bits_left; \
  |  |  165|  8.70k|  } \
  |  |  166|   575k|}
  ------------------
  614|   575k|          if (GET_BITS(1)) {
  ------------------
  |  |  169|   575k|  (((int)(get_buffer >> (bits_left -= (nbits)))) & ((1 << (nbits)) - 1))
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 129k, False: 445k]
  |  |  ------------------
  ------------------
  615|   129k|            if ((*thiscoef & p1) == 0) { /* do nothing if already changed it */
  ------------------
  |  Branch (615:17): [True: 129k, False: 327]
  ------------------
  616|   129k|              if (*thiscoef >= 0)
  ------------------
  |  Branch (616:19): [True: 64.6k, False: 64.9k]
  ------------------
  617|  64.6k|                *thiscoef += (JCOEF)p1;
  618|  64.9k|              else
  619|  64.9k|                *thiscoef += (JCOEF)m1;
  620|   129k|            }
  621|   129k|          }
  622|   575k|        }
  623|  5.37M|      }
  624|       |      /* Count one block completed in EOB run */
  625|   125k|      EOBRUN--;
  626|   125k|    }
  627|       |
  628|       |    /* Completed MCU, so update state */
  629|   133k|    BITREAD_SAVE_STATE(cinfo, entropy->bitstate);
  ------------------
  |  |  137|   133k|  cinfop->src->next_input_byte = br_state.next_input_byte; \
  |  |  138|   133k|  cinfop->src->bytes_in_buffer = br_state.bytes_in_buffer; \
  |  |  139|   133k|  permstate.get_buffer = get_buffer; \
  |  |  140|   133k|  permstate.bits_left = bits_left
  ------------------
  630|   133k|    entropy->saved.EOBRUN = EOBRUN; /* only part of saved state we need */
  631|   133k|  }
  632|       |
  633|       |  /* Account for restart interval (no-op if not using restarts) */
  634|   133k|  if (cinfo->restart_interval)
  ------------------
  |  Branch (634:7): [True: 0, False: 133k]
  ------------------
  635|      0|    entropy->restarts_to_go--;
  636|       |
  637|   133k|  return TRUE;
  ------------------
  |  |  210|   133k|#define TRUE    1
  ------------------
  638|       |
  639|      0|undoit:
  640|       |  /* Re-zero any output coefficients that we made newly nonzero */
  641|      0|  while (num_newnz > 0)
  ------------------
  |  Branch (641:10): [True: 0, False: 0]
  ------------------
  642|      0|    (*block)[newnz_pos[--num_newnz]] = 0;
  643|       |
  644|      0|  return FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  645|   133k|}

jinit_d_post_controller:
  267|  3.51k|{
  268|  3.51k|  my_post_ptr post;
  269|       |
  270|  3.51k|#ifdef D_LOSSLESS_SUPPORTED
  271|  3.51k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 526, False: 2.99k]
  ------------------
  272|    526|#if BITS_IN_JSAMPLE == 8
  273|    526|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.05k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (273:9): [True: 0, False: 526]
  |  Branch (273:52): [True: 0, False: 526]
  ------------------
  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|    526|  } else
  280|  2.99k|#endif
  281|  2.99k|  {
  282|  2.99k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  2.99k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (282:9): [True: 0, False: 2.99k]
  ------------------
  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|  2.99k|  }
  285|       |
  286|  3.51k|  post = (my_post_ptr)
  287|  3.51k|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.51k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|  3.51k|                                sizeof(my_post_controller));
  289|  3.51k|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|  3.51k|  post->pub.start_pass = start_pass_dpost;
  291|  3.51k|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|  3.51k|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|  3.51k|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 3.51k]
  ------------------
  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|  3.51k|}
jdpostct-8.c:start_pass_dpost:
   85|  2.15k|{
   86|  2.15k|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|  2.15k|  switch (pass_mode) {
   89|  2.15k|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 2.15k, False: 0]
  ------------------
   90|  2.15k|#if BITS_IN_JSAMPLE != 16
   91|  2.15k|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 2.15k]
  ------------------
   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|  2.15k|#endif
  105|  2.15k|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|  2.15k|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  260|  2.15k|#define _post_process_data  post_process_data
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  265|  2.15k|#define _upsample  upsample
  ------------------
  110|  2.15k|    }
  111|  2.15k|    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: 2.15k]
  ------------------
  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: 2.15k]
  ------------------
  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: 2.15k]
  ------------------
  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|  2.15k|  }
  130|  2.15k|  post->starting_row = post->next_row = 0;
  131|  2.15k|}
j12init_d_post_controller:
  267|    902|{
  268|    902|  my_post_ptr post;
  269|       |
  270|    902|#ifdef D_LOSSLESS_SUPPORTED
  271|    902|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 441, False: 461]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|    441|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    882|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (275:9): [True: 0, False: 441]
  ------------------
  276|    441|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    441|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (276:9): [True: 0, False: 441]
  ------------------
  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|    441|  } else
  280|    461|#endif
  281|    461|  {
  282|    461|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    461|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (282:9): [True: 0, False: 461]
  ------------------
  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|    461|  }
  285|       |
  286|    902|  post = (my_post_ptr)
  287|    902|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    902|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|    902|                                sizeof(my_post_controller));
  289|    902|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|    902|  post->pub.start_pass = start_pass_dpost;
  291|    902|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|    902|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|    902|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 902]
  ------------------
  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|    902|}
jdpostct-12.c:start_pass_dpost:
   85|    112|{
   86|    112|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|    112|  switch (pass_mode) {
   89|    112|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 112, False: 0]
  ------------------
   90|    112|#if BITS_IN_JSAMPLE != 16
   91|    112|    if (cinfo->quantize_colors) {
  ------------------
  |  Branch (91:9): [True: 0, False: 112]
  ------------------
   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|    112|#endif
  105|    112|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|    112|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  144|    112|#define _post_process_data  post_process_data_12
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |  149|    112|#define _upsample  upsample_12
  ------------------
  110|    112|    }
  111|    112|    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: 112]
  ------------------
  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: 112]
  ------------------
  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: 112]
  ------------------
  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|    112|  }
  130|    112|  post->starting_row = post->next_row = 0;
  131|    112|}
j16init_d_post_controller:
  267|    454|{
  268|    454|  my_post_ptr post;
  269|       |
  270|    454|#ifdef D_LOSSLESS_SUPPORTED
  271|    454|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (271:7): [True: 454, False: 0]
  ------------------
  272|       |#if BITS_IN_JSAMPLE == 8
  273|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  274|       |#else
  275|    454|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    908|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (275:9): [True: 0, False: 454]
  ------------------
  276|    454|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    454|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (276:9): [True: 0, False: 454]
  ------------------
  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|    454|  } 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|    454|  post = (my_post_ptr)
  287|    454|    (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    454|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  288|    454|                                sizeof(my_post_controller));
  289|    454|  cinfo->post = (struct jpeg_d_post_controller *)post;
  290|    454|  post->pub.start_pass = start_pass_dpost;
  291|    454|  post->whole_image = NULL;     /* flag for no virtual arrays */
  292|    454|  post->buffer = NULL;          /* flag for no strip buffer */
  293|       |
  294|       |  /* Create the quantization buffer, if needed */
  295|    454|  if (cinfo->quantize_colors) {
  ------------------
  |  Branch (295:7): [True: 0, False: 454]
  ------------------
  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|    454|}
jdpostct-16.c:start_pass_dpost:
   85|      5|{
   86|      5|  my_post_ptr post = (my_post_ptr)cinfo->post;
   87|       |
   88|      5|  switch (pass_mode) {
   89|      5|  case JBUF_PASS_THRU:
  ------------------
  |  Branch (89:3): [True: 5, 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|      5|    {
  106|       |      /* For single-pass processing without color quantization,
  107|       |       * I have no work to do; just call the upsampler directly.
  108|       |       */
  109|      5|      post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |   55|      5|#define _post_process_data  post_process_data_16
  ------------------
                    post->pub._post_process_data = cinfo->upsample->_upsample;
  ------------------
  |  |   57|      5|#define _upsample  upsample_16
  ------------------
  110|      5|    }
  111|      5|    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: 5]
  ------------------
  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|      5|  }
  130|      5|  post->starting_row = post->next_row = 0;
  131|      5|}

jinit_upsampler:
  438|  3.52k|{
  439|  3.52k|  my_upsample_ptr upsample;
  440|  3.52k|  int ci;
  441|  3.52k|  jpeg_component_info *compptr;
  442|  3.52k|  boolean need_buffer, do_fancy;
  443|  3.52k|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|  3.52k|#ifdef D_LOSSLESS_SUPPORTED
  446|  3.52k|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 528, False: 2.99k]
  ------------------
  447|    528|#if BITS_IN_JSAMPLE == 8
  448|    528|    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  ------------------
  |  |   12|  1.05k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (448:9): [True: 0, False: 528]
  |  Branch (448:52): [True: 0, False: 528]
  ------------------
  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|    528|  } else
  455|  2.99k|#endif
  456|  2.99k|  {
  457|  2.99k|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|  2.99k|#define BITS_IN_JSAMPLE  8
  ------------------
  |  Branch (457:9): [True: 0, False: 2.99k]
  ------------------
  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|  2.99k|  }
  460|       |
  461|  3.52k|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 3.52k, False: 0]
  ------------------
  462|  3.52k|    upsample = (my_upsample_ptr)
  463|  3.52k|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.52k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|  3.52k|                                  sizeof(my_upsampler));
  465|  3.52k|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|  3.52k|    upsample->pub.start_pass = start_pass_upsample;
  467|  3.52k|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  265|  3.52k|#define _upsample  upsample
  ------------------
  468|  3.52k|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|  3.52k|#define FALSE   0               /* values of boolean */
  ------------------
  469|  3.52k|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|  3.52k|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 3.52k]
  ------------------
  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|  3.52k|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|  3.52k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 3.52k, False: 0]
  |  Branch (478:44): [True: 2.99k, False: 528]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  12.2k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 8.73k, False: 3.52k]
  ------------------
  484|  8.73k|       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|  8.73k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  8.73k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  8.73k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  8.73k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  8.73k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  8.73k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  8.73k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  8.73k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  8.73k|    h_out_group = cinfo->max_h_samp_factor;
  493|  8.73k|    v_out_group = cinfo->max_v_samp_factor;
  494|  8.73k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  8.73k|    need_buffer = TRUE;
  ------------------
  |  |  210|  8.73k|#define TRUE    1
  ------------------
  496|  8.73k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 8.73k]
  ------------------
  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|  8.73k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 4.77k, False: 3.95k]
  |  Branch (500:45): [True: 3.63k, False: 1.14k]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|  3.63k|      upsample->methods[ci] = fullsize_upsample;
  503|  3.63k|      need_buffer = FALSE;
  ------------------
  |  |  207|  3.63k|#define FALSE   0               /* values of boolean */
  ------------------
  504|  5.10k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 3.44k, False: 1.66k]
  |  Branch (504:49): [True: 571, False: 2.87k]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|    571|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 421, False: 150]
  |  Branch (506:23): [True: 346, False: 75]
  ------------------
  507|    346|#ifdef WITH_SIMD
  508|    346|        if (jsimd_set_h2v1_fancy_upsample(cinfo))
  ------------------
  |  Branch (508:13): [True: 0, False: 346]
  ------------------
  509|      0|          upsample->methods[ci] = jsimd_h2v1_fancy_upsample;
  510|    346|        else
  511|    346|#endif
  512|    346|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|    346|      } else {
  514|    225|#ifdef WITH_SIMD
  515|    225|        if (jsimd_set_h2v1_upsample(cinfo))
  ------------------
  |  Branch (515:13): [True: 0, False: 225]
  ------------------
  516|      0|          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|    225|        else
  518|    225|#endif
  519|    225|          upsample->methods[ci] = h2v1_upsample;
  520|    225|      }
  521|  4.53k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 1.14k, False: 3.38k]
  ------------------
  522|  1.14k|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 452, False: 693]
  |  Branch (522:49): [True: 306, False: 146]
  ------------------
  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|    306|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|    306|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|    306|#define TRUE    1
  ------------------
  531|  4.22k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 2.87k, False: 1.35k]
  ------------------
  532|  2.87k|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 2.66k, False: 209]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|  2.66k|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 2.56k, False: 99]
  |  Branch (534:23): [True: 2.50k, False: 61]
  ------------------
  535|  2.50k|#ifdef WITH_SIMD
  536|  2.50k|        if (jsimd_set_h2v2_fancy_upsample(cinfo))
  ------------------
  |  Branch (536:13): [True: 0, False: 2.50k]
  ------------------
  537|      0|          upsample->methods[ci] = jsimd_h2v2_fancy_upsample;
  538|  2.50k|        else
  539|  2.50k|#endif
  540|  2.50k|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|  2.50k|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|  2.50k|#define TRUE    1
  ------------------
  542|  2.50k|      } else {
  543|    160|#ifdef WITH_SIMD
  544|    160|        if (jsimd_set_h2v2_upsample(cinfo))
  ------------------
  |  Branch (544:13): [True: 0, False: 160]
  ------------------
  545|      0|          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|    160|        else
  547|    160|#endif
  548|    160|          upsample->methods[ci] = h2v2_upsample;
  549|    160|      }
  550|  2.66k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 1.56k, False: 3]
  ------------------
  551|  1.56k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 1.55k, False: 2]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|  1.55k|      upsample->methods[ci] = int_upsample;
  554|  1.55k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|  1.55k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|  1.55k|    } 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|  8.73k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 5.09k, False: 3.63k]
  |  Branch (558:24): [True: 5.09k, False: 0]
  ------------------
  559|  5.09k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|  5.09k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  5.09k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|  5.09k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|  5.09k|                               (long)cinfo->max_h_samp_factor),
  563|  5.09k|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|  5.09k|    }
  565|  8.73k|  }
  566|  3.52k|}
jdsample-8.c:start_pass_upsample:
   47|  2.15k|{
   48|  2.15k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|  2.15k|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|  2.15k|  upsample->rows_to_go = cinfo->output_height;
   54|  2.15k|}
jdsample-8.c:sep_upsample:
   70|   665k|{
   71|   665k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   72|   665k|  int ci;
   73|   665k|  jpeg_component_info *compptr;
   74|   665k|  JDIMENSION num_rows;
   75|       |
   76|       |  /* Fill the conversion buffer, if it's empty */
   77|   665k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (77:7): [True: 348k, False: 317k]
  ------------------
   78|  1.17M|    for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (78:46): [True: 831k, False: 348k]
  ------------------
   79|   831k|         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|   831k|      (*upsample->methods[ci]) (cinfo, compptr,
   87|   831k|        input_buf[ci] + (*in_row_group_ctr * upsample->rowgroup_height[ci]),
   88|   831k|        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|   831k|    }
   95|   348k|    upsample->next_row_out = 0;
   96|   348k|  }
   97|       |
   98|       |  /* Color-convert and emit rows */
   99|       |
  100|       |  /* How many we have in the buffer: */
  101|   665k|  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|   665k|  if (num_rows > upsample->rows_to_go)
  ------------------
  |  Branch (105:7): [True: 364, False: 665k]
  ------------------
  106|    364|    num_rows = upsample->rows_to_go;
  107|       |  /* And not more than what the client can accept: */
  108|   665k|  out_rows_avail -= *out_row_ctr;
  109|   665k|  if (num_rows > out_rows_avail)
  ------------------
  |  Branch (109:7): [True: 317k, False: 348k]
  ------------------
  110|   317k|    num_rows = out_rows_avail;
  111|       |
  112|       |#ifdef WITH_PROFILE
  113|       |  cinfo->master->start = getTime();
  114|       |#endif
  115|   665k|  (*cinfo->cconvert->_color_convert) (cinfo, upsample->color_buf,
  ------------------
  |  |  267|   665k|#define _color_convert  color_convert
  ------------------
  116|   665k|                                      (JDIMENSION)upsample->next_row_out,
  117|   665k|                                      output_buf + *out_row_ctr,
  118|   665k|                                      (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|   665k|  *out_row_ctr += num_rows;
  127|   665k|  upsample->rows_to_go -= num_rows;
  128|   665k|  upsample->next_row_out += num_rows;
  129|       |  /* When the buffer is emptied, declare this input row group consumed */
  130|   665k|  if (upsample->next_row_out >= cinfo->max_v_samp_factor)
  ------------------
  |  Branch (130:7): [True: 347k, False: 318k]
  ------------------
  131|   347k|    (*in_row_group_ctr)++;
  132|   665k|}
jdsample-8.c:fullsize_upsample:
  151|   373k|{
  152|   373k|  *output_data_ptr = input_data;
  153|   373k|}
jdsample-8.c:h2v1_fancy_upsample:
  298|   120k|{
  299|   120k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|   120k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  300|   120k|  register _JSAMPROW inptr, outptr;
  301|   120k|  register int invalue;
  302|   120k|  register JDIMENSION colctr;
  303|   120k|  int inrow;
  304|       |
  305|   318k|  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
  ------------------
  |  Branch (305:19): [True: 198k, False: 120k]
  ------------------
  306|   198k|    inptr = input_data[inrow];
  307|   198k|    outptr = output_data[inrow];
  308|       |    /* Special case for first column */
  309|   198k|    invalue = *inptr++;
  310|   198k|    *outptr++ = (_JSAMPLE)invalue;
  311|   198k|    *outptr++ = (_JSAMPLE)((invalue * 3 + inptr[0] + 2) >> 2);
  312|       |
  313|  9.72M|    for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
  ------------------
  |  Branch (313:51): [True: 9.52M, False: 198k]
  ------------------
  314|       |      /* General case: 3/4 * nearer component + 1/4 * further component */
  315|  9.52M|      invalue = (*inptr++) * 3;
  316|  9.52M|      *outptr++ = (_JSAMPLE)((invalue + inptr[-2] + 1) >> 2);
  317|  9.52M|      *outptr++ = (_JSAMPLE)((invalue + inptr[0] + 2) >> 2);
  318|  9.52M|    }
  319|       |
  320|       |    /* Special case for last column */
  321|   198k|    invalue = *inptr;
  322|   198k|    *outptr++ = (_JSAMPLE)((invalue * 3 + inptr[-1] + 1) >> 2);
  323|   198k|    *outptr++ = (_JSAMPLE)invalue;
  324|   198k|  }
  325|   120k|}
jdsample-8.c:h2v1_upsample:
  227|  47.5k|{
  228|  47.5k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  47.5k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  229|  47.5k|  register _JSAMPROW inptr, outptr;
  230|  47.5k|  register _JSAMPLE invalue;
  231|  47.5k|  _JSAMPROW outend;
  ------------------
  |  |  229|  47.5k|#define _JSAMPROW  JSAMPROW
  ------------------
  232|  47.5k|  int inrow;
  233|       |
  234|   194k|  for (inrow = 0; inrow < cinfo->max_v_samp_factor; inrow++) {
  ------------------
  |  Branch (234:19): [True: 147k, False: 47.5k]
  ------------------
  235|   147k|    inptr = input_data[inrow];
  236|   147k|    outptr = output_data[inrow];
  237|   147k|    outend = outptr + cinfo->output_width;
  238|   508k|    while (outptr < outend) {
  ------------------
  |  Branch (238:12): [True: 360k, False: 147k]
  ------------------
  239|   360k|      invalue = *inptr++;
  240|   360k|      *outptr++ = invalue;
  241|   360k|      *outptr++ = invalue;
  242|   360k|    }
  243|   147k|  }
  244|  47.5k|}
jdsample-8.c:h1v2_fancy_upsample:
  338|  86.5k|{
  339|  86.5k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  86.5k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  340|  86.5k|  _JSAMPROW inptr0, inptr1, outptr;
  ------------------
  |  |  229|  86.5k|#define _JSAMPROW  JSAMPROW
  ------------------
  341|  86.5k|#if BITS_IN_JSAMPLE == 8
  342|  86.5k|  int thiscolsum, bias;
  343|       |#else
  344|       |  JLONG thiscolsum, bias;
  345|       |#endif
  346|  86.5k|  JDIMENSION colctr;
  347|  86.5k|  int inrow, outrow, v;
  348|       |
  349|  86.5k|  inrow = outrow = 0;
  350|   240k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (350:10): [True: 153k, False: 86.5k]
  ------------------
  351|   460k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (351:17): [True: 307k, False: 153k]
  ------------------
  352|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  353|   307k|      inptr0 = input_data[inrow];
  354|   307k|      if (v == 0) {             /* next nearest is row above */
  ------------------
  |  Branch (354:11): [True: 153k, False: 153k]
  ------------------
  355|   153k|        inptr1 = input_data[inrow - 1];
  356|   153k|        bias = 1;
  357|   153k|      } else {                  /* next nearest is row below */
  358|   153k|        inptr1 = input_data[inrow + 1];
  359|   153k|        bias = 2;
  360|   153k|      }
  361|   307k|      outptr = output_data[outrow++];
  362|       |
  363|  16.8M|      for (colctr = 0; colctr < compptr->downsampled_width; colctr++) {
  ------------------
  |  Branch (363:24): [True: 16.5M, False: 307k]
  ------------------
  364|  16.5M|        thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  365|  16.5M|        *outptr++ = (_JSAMPLE)((thiscolsum + bias) >> 2);
  366|  16.5M|      }
  367|   307k|    }
  368|   153k|    inrow++;
  369|   153k|  }
  370|  86.5k|}
jdsample-8.c:h2v2_fancy_upsample:
  384|  42.4k|{
  385|  42.4k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  42.4k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  386|  42.4k|  register _JSAMPROW inptr0, inptr1, outptr;
  387|  42.4k|#if BITS_IN_JSAMPLE == 8
  388|  42.4k|  register int thiscolsum, lastcolsum, nextcolsum;
  389|       |#else
  390|       |  register JLONG thiscolsum, lastcolsum, nextcolsum;
  391|       |#endif
  392|  42.4k|  register JDIMENSION colctr;
  393|  42.4k|  int inrow, outrow, v;
  394|       |
  395|  42.4k|  inrow = outrow = 0;
  396|  95.1k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (396:10): [True: 52.6k, False: 42.4k]
  ------------------
  397|   157k|    for (v = 0; v < 2; v++) {
  ------------------
  |  Branch (397:17): [True: 105k, False: 52.6k]
  ------------------
  398|       |      /* inptr0 points to nearest input row, inptr1 points to next nearest */
  399|   105k|      inptr0 = input_data[inrow];
  400|   105k|      if (v == 0)               /* next nearest is row above */
  ------------------
  |  Branch (400:11): [True: 52.6k, False: 52.6k]
  ------------------
  401|  52.6k|        inptr1 = input_data[inrow - 1];
  402|  52.6k|      else                      /* next nearest is row below */
  403|  52.6k|        inptr1 = input_data[inrow + 1];
  404|   105k|      outptr = output_data[outrow++];
  405|       |
  406|       |      /* Special case for first column */
  407|   105k|      thiscolsum = (*inptr0++) * 3 + (*inptr1++);
  408|   105k|      nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  409|   105k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 8) >> 4);
  410|   105k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  411|   105k|      lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  412|       |
  413|  11.4M|      for (colctr = compptr->downsampled_width - 2; colctr > 0; colctr--) {
  ------------------
  |  Branch (413:53): [True: 11.3M, False: 105k]
  ------------------
  414|       |        /* General case: 3/4 * nearer component + 1/4 * further component in
  415|       |         * each dimension, thus 9/16, 3/16, 3/16, 1/16 overall
  416|       |         */
  417|  11.3M|        nextcolsum = (*inptr0++) * 3 + (*inptr1++);
  418|  11.3M|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  419|  11.3M|        *outptr++ = (_JSAMPLE)((thiscolsum * 3 + nextcolsum + 7) >> 4);
  420|  11.3M|        lastcolsum = thiscolsum;  thiscolsum = nextcolsum;
  421|  11.3M|      }
  422|       |
  423|       |      /* Special case for last column */
  424|   105k|      *outptr++ = (_JSAMPLE)((thiscolsum * 3 + lastcolsum + 8) >> 4);
  425|   105k|      *outptr++ = (_JSAMPLE)((thiscolsum * 4 + 7) >> 4);
  426|   105k|    }
  427|  52.6k|    inrow++;
  428|  52.6k|  }
  429|  42.4k|}
jdsample-8.c:h2v2_upsample:
  255|  33.1k|{
  256|  33.1k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|  33.1k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  257|  33.1k|  register _JSAMPROW inptr, outptr;
  258|  33.1k|  register _JSAMPLE invalue;
  259|  33.1k|  _JSAMPROW outend;
  ------------------
  |  |  229|  33.1k|#define _JSAMPROW  JSAMPROW
  ------------------
  260|  33.1k|  int inrow, outrow;
  261|       |
  262|  33.1k|  inrow = outrow = 0;
  263|  91.5k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (263:10): [True: 58.4k, False: 33.1k]
  ------------------
  264|  58.4k|    inptr = input_data[inrow];
  265|  58.4k|    outptr = output_data[outrow];
  266|  58.4k|    outend = outptr + cinfo->output_width;
  267|   202k|    while (outptr < outend) {
  ------------------
  |  Branch (267:12): [True: 144k, False: 58.4k]
  ------------------
  268|   144k|      invalue = *inptr++;
  269|   144k|      *outptr++ = invalue;
  270|   144k|      *outptr++ = invalue;
  271|   144k|    }
  272|  58.4k|    _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1, 1,
  ------------------
  |  |  297|  58.4k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  273|  58.4k|                       cinfo->output_width);
  274|  58.4k|    inrow++;
  275|  58.4k|    outrow += 2;
  276|  58.4k|  }
  277|  33.1k|}
jdsample-8.c:int_upsample:
  183|   128k|{
  184|   128k|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
  185|   128k|  _JSAMPARRAY output_data = *output_data_ptr;
  ------------------
  |  |  230|   128k|#define _JSAMPARRAY  JSAMPARRAY
  ------------------
  186|   128k|  register _JSAMPROW inptr, outptr;
  187|   128k|  register _JSAMPLE invalue;
  188|   128k|  register int h;
  189|   128k|  _JSAMPROW outend;
  ------------------
  |  |  229|   128k|#define _JSAMPROW  JSAMPROW
  ------------------
  190|   128k|  int h_expand, v_expand;
  191|   128k|  int inrow, outrow;
  192|       |
  193|   128k|  h_expand = upsample->h_expand[compptr->component_index];
  194|   128k|  v_expand = upsample->v_expand[compptr->component_index];
  195|       |
  196|   128k|  inrow = outrow = 0;
  197|   267k|  while (outrow < cinfo->max_v_samp_factor) {
  ------------------
  |  Branch (197:10): [True: 139k, False: 128k]
  ------------------
  198|       |    /* Generate one output row with proper horizontal expansion */
  199|   139k|    inptr = input_data[inrow];
  200|   139k|    outptr = output_data[outrow];
  201|   139k|    outend = outptr + cinfo->output_width;
  202|  3.71M|    while (outptr < outend) {
  ------------------
  |  Branch (202:12): [True: 3.57M, False: 139k]
  ------------------
  203|  3.57M|      invalue = *inptr++;
  204|  9.59M|      for (h = h_expand; h > 0; h--) {
  ------------------
  |  Branch (204:26): [True: 6.02M, False: 3.57M]
  ------------------
  205|  6.02M|        *outptr++ = invalue;
  206|  6.02M|      }
  207|  3.57M|    }
  208|       |    /* Generate any additional output rows by duplicating the first one */
  209|   139k|    if (v_expand > 1) {
  ------------------
  |  Branch (209:9): [True: 88.1k, False: 51.0k]
  ------------------
  210|  88.1k|      _jcopy_sample_rows(output_data, outrow, output_data, outrow + 1,
  ------------------
  |  |  297|  88.1k|#define _jcopy_sample_rows  jcopy_sample_rows
  ------------------
  211|  88.1k|                         v_expand - 1, cinfo->output_width);
  212|  88.1k|    }
  213|   139k|    inrow++;
  214|   139k|    outrow += v_expand;
  215|   139k|  }
  216|   128k|}
j12init_upsampler:
  438|    909|{
  439|    909|  my_upsample_ptr upsample;
  440|    909|  int ci;
  441|    909|  jpeg_component_info *compptr;
  442|    909|  boolean need_buffer, do_fancy;
  443|    909|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|    909|#ifdef D_LOSSLESS_SUPPORTED
  446|    909|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 448, False: 461]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|    448|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    896|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (450:9): [True: 0, False: 448]
  ------------------
  451|    448|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    448|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (451:9): [True: 0, False: 448]
  ------------------
  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|    448|  } else
  455|    461|#endif
  456|    461|  {
  457|    461|    if (cinfo->data_precision != BITS_IN_JSAMPLE)
  ------------------
  |  |   12|    461|#define BITS_IN_JSAMPLE  12
  ------------------
  |  Branch (457:9): [True: 0, False: 461]
  ------------------
  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|    461|  }
  460|       |
  461|    909|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 909, False: 0]
  ------------------
  462|    909|    upsample = (my_upsample_ptr)
  463|    909|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    909|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|    909|                                  sizeof(my_upsampler));
  465|    909|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|    909|    upsample->pub.start_pass = start_pass_upsample;
  467|    909|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |  149|    909|#define _upsample  upsample_12
  ------------------
  468|    909|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    909|#define FALSE   0               /* values of boolean */
  ------------------
  469|    909|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|    909|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 909]
  ------------------
  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|    909|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    909|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 909, False: 0]
  |  Branch (478:44): [True: 461, False: 448]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  3.63k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 2.72k, False: 909]
  ------------------
  484|  2.72k|       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|  2.72k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  2.72k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  2.72k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  2.72k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  2.72k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  2.72k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  2.72k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  2.72k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  2.72k|    h_out_group = cinfo->max_h_samp_factor;
  493|  2.72k|    v_out_group = cinfo->max_v_samp_factor;
  494|  2.72k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  2.72k|    need_buffer = TRUE;
  ------------------
  |  |  210|  2.72k|#define TRUE    1
  ------------------
  496|  2.72k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 2.72k]
  ------------------
  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|  2.72k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 1.51k, False: 1.21k]
  |  Branch (500:45): [True: 737, False: 773]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|    737|      upsample->methods[ci] = fullsize_upsample;
  503|    737|      need_buffer = FALSE;
  ------------------
  |  |  207|    737|#define FALSE   0               /* values of boolean */
  ------------------
  504|  1.98k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 760, False: 1.22k]
  |  Branch (504:49): [True: 302, False: 458]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|    302|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 268, False: 34]
  |  Branch (506:23): [True: 262, False: 6]
  ------------------
  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|    262|          upsample->methods[ci] = h2v1_fancy_upsample;
  513|    262|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|     40|          upsample->methods[ci] = h2v1_upsample;
  520|     40|      }
  521|  1.68k|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 773, False: 911]
  ------------------
  522|    773|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 313, False: 460]
  |  Branch (522:49): [True: 229, False: 84]
  ------------------
  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|    229|        upsample->methods[ci] = h1v2_fancy_upsample;
  530|    229|      upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|    229|#define TRUE    1
  ------------------
  531|  1.45k|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 458, False: 997]
  ------------------
  532|    458|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 388, False: 70]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|    388|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 285, False: 103]
  |  Branch (534:23): [True: 279, False: 6]
  ------------------
  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|    279|          upsample->methods[ci] = h2v2_fancy_upsample;
  541|    279|        upsample->pub.need_context_rows = TRUE;
  ------------------
  |  |  210|    279|#define TRUE    1
  ------------------
  542|    279|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|    109|          upsample->methods[ci] = h2v2_upsample;
  549|    109|      }
  550|  1.06k|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 1.06k, False: 1]
  ------------------
  551|  1.06k|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 1.06k, False: 6]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|  1.06k|      upsample->methods[ci] = int_upsample;
  554|  1.06k|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|  1.06k|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|  1.06k|    } else
  557|      7|      ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
  ------------------
  |  |  240|      7|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      7|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  558|  2.72k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 1.97k, False: 744]
  |  Branch (558:24): [True: 1.97k, False: 0]
  ------------------
  559|  1.97k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|  1.97k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.97k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|  1.97k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|  1.97k|                               (long)cinfo->max_h_samp_factor),
  563|  1.97k|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|  1.97k|    }
  565|  2.72k|  }
  566|    909|}
jdsample-12.c:start_pass_upsample:
   47|    112|{
   48|    112|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|    112|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|    112|  upsample->rows_to_go = cinfo->output_height;
   54|    112|}
j16init_upsampler:
  438|    457|{
  439|    457|  my_upsample_ptr upsample;
  440|    457|  int ci;
  441|    457|  jpeg_component_info *compptr;
  442|    457|  boolean need_buffer, do_fancy;
  443|    457|  int h_in_group, v_in_group, h_out_group, v_out_group;
  444|       |
  445|    457|#ifdef D_LOSSLESS_SUPPORTED
  446|    457|  if (cinfo->master->lossless) {
  ------------------
  |  Branch (446:7): [True: 457, False: 0]
  ------------------
  447|       |#if BITS_IN_JSAMPLE == 8
  448|       |    if (cinfo->data_precision > BITS_IN_JSAMPLE || cinfo->data_precision < 2)
  449|       |#else
  450|    457|    if (cinfo->data_precision > BITS_IN_JSAMPLE ||
  ------------------
  |  |   12|    914|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (450:9): [True: 0, False: 457]
  ------------------
  451|    457|        cinfo->data_precision < BITS_IN_JSAMPLE - 3)
  ------------------
  |  |   12|    457|#define BITS_IN_JSAMPLE  16
  ------------------
  |  Branch (451:9): [True: 0, False: 457]
  ------------------
  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|    457|  } 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|    457|  if (!cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (461:7): [True: 457, False: 0]
  ------------------
  462|    457|    upsample = (my_upsample_ptr)
  463|    457|      (*cinfo->mem->alloc_small) ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|    457|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  464|    457|                                  sizeof(my_upsampler));
  465|    457|    cinfo->upsample = (struct jpeg_upsampler *)upsample;
  466|    457|    upsample->pub.start_pass = start_pass_upsample;
  467|    457|    upsample->pub._upsample = sep_upsample;
  ------------------
  |  |   57|    457|#define _upsample  upsample_16
  ------------------
  468|    457|    upsample->pub.need_context_rows = FALSE; /* until we find out differently */
  ------------------
  |  |  207|    457|#define FALSE   0               /* values of boolean */
  ------------------
  469|    457|  } else
  470|      0|    upsample = (my_upsample_ptr)cinfo->upsample;
  471|       |
  472|    457|  if (cinfo->CCIR601_sampling)  /* this isn't supported */
  ------------------
  |  Branch (472:7): [True: 0, False: 457]
  ------------------
  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|    457|  do_fancy = cinfo->do_fancy_upsampling && cinfo->_min_DCT_scaled_size > 1;
  ------------------
  |  |   27|    457|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  |  Branch (478:14): [True: 457, False: 0]
  |  Branch (478:44): [True: 0, False: 457]
  ------------------
  479|       |
  480|       |  /* Verify we can handle the sampling factors, select per-component methods,
  481|       |   * and create storage as needed.
  482|       |   */
  483|  1.83k|  for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
  ------------------
  |  Branch (483:44): [True: 1.37k, False: 457]
  ------------------
  484|  1.37k|       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.37k|    h_in_group = (compptr->h_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.37k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  489|  1.37k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.37k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  490|  1.37k|    v_in_group = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
  ------------------
  |  |   24|  1.37k|#define _DCT_scaled_size  DCT_scaled_size
  ------------------
  491|  1.37k|                 cinfo->_min_DCT_scaled_size;
  ------------------
  |  |   27|  1.37k|#define _min_DCT_scaled_size  min_DCT_scaled_size
  ------------------
  492|  1.37k|    h_out_group = cinfo->max_h_samp_factor;
  493|  1.37k|    v_out_group = cinfo->max_v_samp_factor;
  494|  1.37k|    upsample->rowgroup_height[ci] = v_in_group; /* save for use later */
  495|  1.37k|    need_buffer = TRUE;
  ------------------
  |  |  210|  1.37k|#define TRUE    1
  ------------------
  496|  1.37k|    if (!compptr->component_needed) {
  ------------------
  |  Branch (496:9): [True: 0, False: 1.37k]
  ------------------
  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.37k|    } else if (h_in_group == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (500:16): [True: 874, False: 502]
  |  Branch (500:45): [True: 367, False: 507]
  ------------------
  501|       |      /* Fullsize components can be processed without any work. */
  502|    367|      upsample->methods[ci] = fullsize_upsample;
  503|    367|      need_buffer = FALSE;
  ------------------
  |  |  207|    367|#define FALSE   0               /* values of boolean */
  ------------------
  504|  1.00k|    } else if (h_in_group * 2 == h_out_group && v_in_group == v_out_group) {
  ------------------
  |  Branch (504:16): [True: 105, False: 904]
  |  Branch (504:49): [True: 35, False: 70]
  ------------------
  505|       |      /* Special cases for 2h1v upsampling */
  506|     35|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (506:11): [True: 0, False: 35]
  |  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|     35|      } else {
  514|       |#ifdef WITH_SIMD
  515|       |        if (jsimd_set_h2v1_upsample(cinfo))
  516|       |          upsample->methods[ci] = jsimd_h2v1_upsample;
  517|       |        else
  518|       |#endif
  519|     35|          upsample->methods[ci] = h2v1_upsample;
  520|     35|      }
  521|    974|    } else if (h_in_group == h_out_group &&
  ------------------
  |  Branch (521:16): [True: 507, False: 467]
  ------------------
  522|    507|               v_in_group * 2 == v_out_group && do_fancy) {
  ------------------
  |  Branch (522:16): [True: 138, False: 369]
  |  Branch (522:49): [True: 0, False: 138]
  ------------------
  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|    974|    } else if (h_in_group * 2 == h_out_group &&
  ------------------
  |  Branch (531:16): [True: 70, False: 904]
  ------------------
  532|     70|               v_in_group * 2 == v_out_group) {
  ------------------
  |  Branch (532:16): [True: 41, False: 29]
  ------------------
  533|       |      /* Special cases for 2h2v upsampling */
  534|     41|      if (do_fancy && compptr->downsampled_width > 2) {
  ------------------
  |  Branch (534:11): [True: 0, False: 41]
  |  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|     41|      } else {
  543|       |#ifdef WITH_SIMD
  544|       |        if (jsimd_set_h2v2_upsample(cinfo))
  545|       |          upsample->methods[ci] = jsimd_h2v2_upsample;
  546|       |        else
  547|       |#endif
  548|     41|          upsample->methods[ci] = h2v2_upsample;
  549|     41|      }
  550|    933|    } else if ((h_out_group % h_in_group) == 0 &&
  ------------------
  |  Branch (550:16): [True: 931, False: 2]
  ------------------
  551|    931|               (v_out_group % v_in_group) == 0) {
  ------------------
  |  Branch (551:16): [True: 930, False: 1]
  ------------------
  552|       |      /* Generic integral-factors upsampling method */
  553|    930|      upsample->methods[ci] = int_upsample;
  554|    930|      upsample->h_expand[ci] = (UINT8)(h_out_group / h_in_group);
  555|    930|      upsample->v_expand[ci] = (UINT8)(v_out_group / v_in_group);
  556|    930|    } 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|  1.37k|    if (need_buffer && !cinfo->master->jinit_upsampler_no_alloc) {
  ------------------
  |  Branch (558:9): [True: 1.00k, False: 370]
  |  Branch (558:24): [True: 1.00k, False: 0]
  ------------------
  559|  1.00k|      upsample->color_buf[ci] = (_JSAMPARRAY)(*cinfo->mem->alloc_sarray)
  560|  1.00k|        ((j_common_ptr)cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  1.00k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  561|  1.00k|         (JDIMENSION)jround_up((long)cinfo->output_width,
  562|  1.00k|                               (long)cinfo->max_h_samp_factor),
  563|  1.00k|         (JDIMENSION)cinfo->max_v_samp_factor);
  564|  1.00k|    }
  565|  1.37k|  }
  566|    457|}
jdsample-16.c:start_pass_upsample:
   47|      5|{
   48|      5|  my_upsample_ptr upsample = (my_upsample_ptr)cinfo->upsample;
   49|       |
   50|       |  /* Mark the conversion buffer empty */
   51|      5|  upsample->next_row_out = cinfo->max_v_samp_factor;
   52|       |  /* Initialize total-height counter for detecting bottom of image */
   53|      5|  upsample->rows_to_go = cinfo->output_height;
   54|      5|}

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

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

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

jinit_memory_mgr:
 1196|  6.47k|{
 1197|  6.47k|  my_mem_ptr mem;
 1198|  6.47k|  long max_to_use;
 1199|  6.47k|  int pool;
 1200|  6.47k|  size_t test_mac;
 1201|       |
 1202|  6.47k|  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|  6.47k|  if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  6.47k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                if ((ALIGN_SIZE & (ALIGN_SIZE - 1)) != 0)
  ------------------
  |  |   89|  6.47k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (1211:7): [Folded, False: 6.47k]
  ------------------
 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|  6.47k|  test_mac = (size_t)MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  6.47k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1219|  6.47k|  if ((long)test_mac != MAX_ALLOC_CHUNK ||
  ------------------
  |  |   62|  12.9k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (1219:7): [True: 0, False: 6.47k]
  ------------------
 1220|  6.47k|      (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   62|  6.47k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
                    (MAX_ALLOC_CHUNK % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  6.47k|#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|  6.47k|  max_to_use = jpeg_mem_init(cinfo); /* system-dependent initialization */
 1224|       |
 1225|       |  /* Attempt to allocate memory manager's control block */
 1226|  6.47k|  mem = (my_mem_ptr)jpeg_get_small(cinfo, sizeof(my_memory_mgr));
 1227|       |
 1228|  6.47k|  if (mem == NULL) {
  ------------------
  |  Branch (1228:7): [True: 0, False: 6.47k]
  ------------------
 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|  6.47k|  mem->pub.alloc_small = alloc_small;
 1235|  6.47k|  mem->pub.alloc_large = alloc_large;
 1236|  6.47k|  mem->pub.alloc_sarray = alloc_sarray;
 1237|  6.47k|  mem->pub.alloc_barray = alloc_barray;
 1238|  6.47k|  mem->pub.request_virt_sarray = request_virt_sarray;
 1239|  6.47k|  mem->pub.request_virt_barray = request_virt_barray;
 1240|  6.47k|  mem->pub.realize_virt_arrays = realize_virt_arrays;
 1241|  6.47k|  mem->pub.access_virt_sarray = access_virt_sarray;
 1242|  6.47k|  mem->pub.access_virt_barray = access_virt_barray;
 1243|  6.47k|  mem->pub.free_pool = free_pool;
 1244|  6.47k|  mem->pub.self_destruct = self_destruct;
 1245|       |
 1246|       |  /* Make MAX_ALLOC_CHUNK accessible to other modules */
 1247|  6.47k|  mem->pub.max_alloc_chunk = MAX_ALLOC_CHUNK;
  ------------------
  |  |   62|  6.47k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
 1248|       |
 1249|       |  /* Initialize working state */
 1250|  6.47k|  mem->pub.max_memory_to_use = max_to_use;
 1251|       |
 1252|  19.4k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  6.47k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  19.4k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1252:35): [True: 12.9k, False: 6.47k]
  ------------------
 1253|  12.9k|    mem->small_list[pool] = NULL;
 1254|  12.9k|    mem->large_list[pool] = NULL;
 1255|  12.9k|  }
 1256|  6.47k|  mem->virt_sarray_list = NULL;
 1257|  6.47k|  mem->virt_barray_list = NULL;
 1258|       |
 1259|  6.47k|  mem->total_space_allocated = sizeof(my_memory_mgr);
 1260|       |
 1261|       |  /* Declare ourselves open for business */
 1262|  6.47k|  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|  6.47k|#ifndef NO_GETENV
 1271|  6.47k|  {
 1272|  6.47k|    char memenv[30] = { 0 };
 1273|       |
 1274|  6.47k|    if (!GETENV_S(memenv, 30, "JPEGMEM") && strlen(memenv) > 0) {
  ------------------
  |  Branch (1274:9): [True: 6.47k, False: 0]
  |  Branch (1274:45): [True: 0, False: 6.47k]
  ------------------
 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|  6.47k|  }
 1288|  6.47k|#endif
 1289|       |
 1290|  6.47k|}
jmemmgr.c:alloc_small:
  269|   182k|{
  270|   182k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  271|   182k|  small_pool_ptr hdr_ptr, prev_hdr_ptr;
  272|   182k|  char *data_ptr;
  273|   182k|  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|   182k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|   182k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (281:7): [True: 0, False: 182k]
  ------------------
  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|   182k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|   182k|#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|   182k|  if ((sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|   182k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (289:7): [True: 0, False: 182k]
  ------------------
  290|   182k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|   182k|#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|   182k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|   182k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (294:7): [True: 0, False: 182k]
  |  Branch (294:22): [True: 0, False: 182k]
  ------------------
  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|   182k|  prev_hdr_ptr = NULL;
  297|   182k|  hdr_ptr = mem->small_list[pool_id];
  298|   190k|  while (hdr_ptr != NULL) {
  ------------------
  |  Branch (298:10): [True: 173k, False: 17.5k]
  ------------------
  299|   173k|    if (hdr_ptr->bytes_left >= sizeofobject)
  ------------------
  |  Branch (299:9): [True: 165k, False: 8.01k]
  ------------------
  300|   165k|      break;                    /* found pool with enough space */
  301|  8.01k|    prev_hdr_ptr = hdr_ptr;
  302|  8.01k|    hdr_ptr = hdr_ptr->next;
  303|  8.01k|  }
  304|       |
  305|       |  /* Time to make a new pool? */
  306|   182k|  if (hdr_ptr == NULL) {
  ------------------
  |  Branch (306:7): [True: 17.5k, False: 165k]
  ------------------
  307|       |    /* min_request is what we need now, slop is what will be leftover */
  308|  17.5k|    min_request = sizeof(small_pool_hdr) + sizeofobject + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  17.5k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  309|  17.5k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (309:9): [True: 11.8k, False: 5.63k]
  ------------------
  310|  11.8k|      slop = first_pool_slop[pool_id];
  311|  5.63k|    else
  312|  5.63k|      slop = extra_pool_slop[pool_id];
  313|       |    /* Don't ask for more than MAX_ALLOC_CHUNK */
  314|  17.5k|    if (slop > (size_t)(MAX_ALLOC_CHUNK - min_request))
  ------------------
  |  |   62|  17.5k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (314:9): [True: 0, False: 17.5k]
  ------------------
  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|  17.5k|    for (;;) {
  318|  17.5k|      hdr_ptr = (small_pool_ptr)jpeg_get_small(cinfo, min_request + slop);
  319|  17.5k|      if (hdr_ptr != NULL)
  ------------------
  |  Branch (319:11): [True: 17.5k, False: 0]
  ------------------
  320|  17.5k|        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|  17.5k|    mem->total_space_allocated += min_request + slop;
  326|       |    /* Success, initialize the new pool header and add to end of list */
  327|  17.5k|    hdr_ptr->next = NULL;
  328|  17.5k|    hdr_ptr->bytes_used = 0;
  329|  17.5k|    hdr_ptr->bytes_left = sizeofobject + slop;
  330|  17.5k|    if (prev_hdr_ptr == NULL)   /* first pool in class? */
  ------------------
  |  Branch (330:9): [True: 11.8k, False: 5.63k]
  ------------------
  331|  11.8k|      mem->small_list[pool_id] = hdr_ptr;
  332|  5.63k|    else
  333|  5.63k|      prev_hdr_ptr->next = hdr_ptr;
  334|  17.5k|  }
  335|       |
  336|       |  /* OK, allocate the object from the current pool */
  337|   182k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  338|   182k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  339|   182k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|   182k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (339:7): [True: 182k, False: 0]
  ------------------
  340|   182k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   182k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|   182k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  341|   182k|  data_ptr += hdr_ptr->bytes_used; /* point to place for object */
  342|   182k|  hdr_ptr->bytes_used += sizeofobject;
  343|   182k|  hdr_ptr->bytes_left -= sizeofobject;
  344|       |
  345|   182k|  return (void *)data_ptr;
  346|   182k|}
jmemmgr.c:round_up_pow2:
   45|   264k|{
   46|   264k|  return ((a + b - 1) & (~(b - 1)));
   47|   264k|}
jmemmgr.c:alloc_large:
  366|  44.0k|{
  367|  44.0k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  368|  44.0k|  large_pool_ptr hdr_ptr;
  369|  44.0k|  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|  44.0k|  if (sizeofobject > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  44.0k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (376:7): [True: 0, False: 44.0k]
  ------------------
  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|  44.0k|  sizeofobject = round_up_pow2(sizeofobject, ALIGN_SIZE);
  ------------------
  |  |   89|  44.0k|#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|  44.0k|  if ((sizeof(large_pool_hdr) + sizeofobject + ALIGN_SIZE - 1) >
  ------------------
  |  |   89|  44.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (384:7): [True: 0, False: 44.0k]
  ------------------
  385|  44.0k|      MAX_ALLOC_CHUNK)
  ------------------
  |  |   62|  44.0k|#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|  44.0k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  44.0k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (389:7): [True: 0, False: 44.0k]
  |  Branch (389:22): [True: 0, False: 44.0k]
  ------------------
  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|  44.0k|  hdr_ptr = (large_pool_ptr)jpeg_get_large(cinfo, sizeofobject +
  393|  44.0k|                                           sizeof(large_pool_hdr) +
  394|  44.0k|                                           ALIGN_SIZE - 1);
  ------------------
  |  |   89|  44.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  395|  44.0k|  if (hdr_ptr == NULL)
  ------------------
  |  Branch (395:7): [True: 0, False: 44.0k]
  ------------------
  396|      0|    out_of_memory(cinfo, 4);    /* jpeg_get_large failed */
  397|  44.0k|  mem->total_space_allocated += sizeofobject + sizeof(large_pool_hdr) +
  398|  44.0k|                                ALIGN_SIZE - 1;
  ------------------
  |  |   89|  44.0k|#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|  44.0k|  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|  44.0k|  hdr_ptr->bytes_used = sizeofobject;
  406|  44.0k|  hdr_ptr->bytes_left = 0;
  407|  44.0k|  mem->large_list[pool_id] = hdr_ptr;
  408|       |
  409|  44.0k|  data_ptr = (char *)hdr_ptr; /* point to first data byte in pool... */
  410|  44.0k|  data_ptr += sizeof(small_pool_hdr); /* ...by skipping the header... */
  411|  44.0k|  if ((size_t)data_ptr % ALIGN_SIZE) /* ...and adjust for alignment */
  ------------------
  |  |   89|  44.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (411:7): [True: 44.0k, False: 0]
  ------------------
  412|  44.0k|    data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  44.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
                  data_ptr += ALIGN_SIZE - (size_t)data_ptr % ALIGN_SIZE;
  ------------------
  |  |   89|  44.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  413|       |
  414|  44.0k|  return (void *)data_ptr;
  415|  44.0k|}
jmemmgr.c:alloc_sarray:
  438|  37.8k|{
  439|  37.8k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  440|  37.8k|  JSAMPARRAY result;
  441|  37.8k|  JSAMPROW workspace;
  442|  37.8k|  JDIMENSION rowsperchunk, currow, i;
  443|  37.8k|  long ltemp;
  444|  37.8k|  J12SAMPARRAY result12;
  445|  37.8k|  J12SAMPROW workspace12;
  446|  37.8k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  447|  37.8k|  J16SAMPARRAY result16;
  448|  37.8k|  J16SAMPROW workspace16;
  449|  37.8k|#endif
  450|  37.8k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (450:24): [True: 37.8k, False: 0]
  ------------------
  451|  37.8k|                        ((j_decompress_ptr)cinfo)->data_precision :
  452|  37.8k|                        ((j_compress_ptr)cinfo)->data_precision;
  453|  37.8k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (453:24): [True: 6.82k, False: 31.0k]
  ------------------
  454|  31.0k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (454:45): [True: 9.37k, False: 21.6k]
  ------------------
  455|  9.37k|                                            sizeof(J12SAMPLE) :
  456|  31.0k|                                            sizeof(JSAMPLE));
  457|       |
  458|       |  /* Make sure each row is properly aligned */
  459|  37.8k|  if ((ALIGN_SIZE % sample_size) != 0)
  ------------------
  |  |   89|  37.8k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (459:7): [True: 0, False: 37.8k]
  ------------------
  460|      0|    out_of_memory(cinfo, 5);    /* safety check */
  461|       |
  462|  37.8k|  if (samplesperrow == 0 || samplesperrow > MAX_ALLOC_CHUNK) {
  ------------------
  |  |   62|  37.8k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  |  Branch (462:7): [True: 0, False: 37.8k]
  |  Branch (462:29): [True: 0, False: 37.8k]
  ------------------
  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|  37.8k|  samplesperrow = (JDIMENSION)round_up_pow2(samplesperrow, (2 * ALIGN_SIZE) /
  ------------------
  |  |   89|  37.8k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  468|  37.8k|                                                           sample_size);
  469|       |
  470|       |  /* Calculate max # of rows allowed in one allocation chunk */
  471|  37.8k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  37.8k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  472|  37.8k|          ((long)samplesperrow * (long)sample_size);
  473|  37.8k|  if (ltemp <= 0)
  ------------------
  |  Branch (473:7): [True: 0, False: 37.8k]
  ------------------
  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|  37.8k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (475:7): [True: 0, False: 37.8k]
  ------------------
  476|      0|    rowsperchunk = (JDIMENSION)ltemp;
  477|  37.8k|  else
  478|  37.8k|    rowsperchunk = numrows;
  479|  37.8k|  mem->last_rowsperchunk = rowsperchunk;
  480|       |
  481|  37.8k|  if (data_precision <= 8) {
  ------------------
  |  Branch (481:7): [True: 21.6k, False: 16.1k]
  ------------------
  482|       |    /* Get space for row pointers (small object) */
  483|  21.6k|    result = (JSAMPARRAY)alloc_small(cinfo, pool_id,
  484|  21.6k|                                     (size_t)(numrows * sizeof(JSAMPROW)));
  485|       |
  486|       |    /* Get the rows themselves (large objects) */
  487|  21.6k|    currow = 0;
  488|  43.3k|    while (currow < numrows) {
  ------------------
  |  Branch (488:12): [True: 21.6k, False: 21.6k]
  ------------------
  489|  21.6k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  21.6k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 21.6k]
  |  |  ------------------
  ------------------
  490|  21.6k|      workspace = (JSAMPROW)alloc_large(cinfo, pool_id,
  491|  21.6k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  492|  2.92M|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (492:30): [True: 2.90M, False: 21.6k]
  ------------------
  493|  2.90M|        result[currow++] = workspace;
  494|  2.90M|        workspace += samplesperrow;
  495|  2.90M|      }
  496|  21.6k|    }
  497|       |
  498|  21.6k|    return result;
  499|  21.6k|  } else if (data_precision <= 12) {
  ------------------
  |  Branch (499:14): [True: 9.37k, False: 6.82k]
  ------------------
  500|       |    /* Get space for row pointers (small object) */
  501|  9.37k|    result12 = (J12SAMPARRAY)alloc_small(cinfo, pool_id,
  502|  9.37k|                                         (size_t)(numrows *
  503|  9.37k|                                                  sizeof(J12SAMPROW)));
  504|       |
  505|       |    /* Get the rows themselves (large objects) */
  506|  9.37k|    currow = 0;
  507|  18.7k|    while (currow < numrows) {
  ------------------
  |  Branch (507:12): [True: 9.37k, False: 9.37k]
  ------------------
  508|  9.37k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  9.37k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 9.37k]
  |  |  ------------------
  ------------------
  509|  9.37k|      workspace12 = (J12SAMPROW)alloc_large(cinfo, pool_id,
  510|  9.37k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  511|  2.61M|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (511:30): [True: 2.60M, False: 9.37k]
  ------------------
  512|  2.60M|        result12[currow++] = workspace12;
  513|  2.60M|        workspace12 += samplesperrow;
  514|  2.60M|      }
  515|  9.37k|    }
  516|       |
  517|  9.37k|    return (JSAMPARRAY)result12;
  518|  9.37k|  } else {
  519|  6.82k|#if defined(C_LOSSLESS_SUPPORTED) || defined(D_LOSSLESS_SUPPORTED)
  520|       |    /* Get space for row pointers (small object) */
  521|  6.82k|    result16 = (J16SAMPARRAY)alloc_small(cinfo, pool_id,
  522|  6.82k|                                         (size_t)(numrows *
  523|  6.82k|                                                  sizeof(J16SAMPROW)));
  524|       |
  525|       |    /* Get the rows themselves (large objects) */
  526|  6.82k|    currow = 0;
  527|  13.6k|    while (currow < numrows) {
  ------------------
  |  Branch (527:12): [True: 6.82k, False: 6.82k]
  ------------------
  528|  6.82k|      rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  6.82k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 6.82k]
  |  |  ------------------
  ------------------
  529|  6.82k|      workspace16 = (J16SAMPROW)alloc_large(cinfo, pool_id,
  530|  6.82k|        (size_t)((size_t)rowsperchunk * (size_t)samplesperrow * sample_size));
  531|  3.50M|      for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (531:30): [True: 3.50M, False: 6.82k]
  ------------------
  532|  3.50M|        result16[currow++] = workspace16;
  533|  3.50M|        workspace16 += samplesperrow;
  534|  3.50M|      }
  535|  6.82k|    }
  536|       |
  537|  6.82k|    return (JSAMPARRAY)result16;
  538|       |#else
  539|       |    ERREXIT1(cinfo, JERR_BAD_PRECISION, data_precision);
  540|       |    return NULL;
  541|       |#endif
  542|  6.82k|  }
  543|  37.8k|}
jmemmgr.c:alloc_barray:
  555|  4.49k|{
  556|  4.49k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  557|  4.49k|  JBLOCKARRAY result;
  558|  4.49k|  JBLOCKROW workspace;
  559|  4.49k|  JDIMENSION rowsperchunk, currow, i;
  560|  4.49k|  long ltemp;
  561|       |
  562|       |  /* Make sure each row is properly aligned */
  563|  4.49k|  if (blocksperrow == 0 || (sizeof(JBLOCK) % ALIGN_SIZE) != 0)
  ------------------
  |  |   89|  4.49k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
  |  Branch (563:7): [True: 0, False: 4.49k]
  |  Branch (563:28): [Folded, False: 0]
  ------------------
  564|      0|    out_of_memory(cinfo, 6);    /* safety check */
  565|       |
  566|       |  /* Calculate max # of rows allowed in one allocation chunk */
  567|  4.49k|  ltemp = (MAX_ALLOC_CHUNK - sizeof(large_pool_hdr)) /
  ------------------
  |  |   62|  4.49k|#define MAX_ALLOC_CHUNK  1000000000L
  ------------------
  568|  4.49k|          ((long)blocksperrow * sizeof(JBLOCK));
  569|  4.49k|  if (ltemp <= 0)
  ------------------
  |  Branch (569:7): [True: 0, False: 4.49k]
  ------------------
  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|  4.49k|  if (ltemp < (long)numrows)
  ------------------
  |  Branch (571:7): [True: 0, False: 4.49k]
  ------------------
  572|      0|    rowsperchunk = (JDIMENSION)ltemp;
  573|  4.49k|  else
  574|  4.49k|    rowsperchunk = numrows;
  575|  4.49k|  mem->last_rowsperchunk = rowsperchunk;
  576|       |
  577|       |  /* Get space for row pointers (small object) */
  578|  4.49k|  result = (JBLOCKARRAY)alloc_small(cinfo, pool_id,
  579|  4.49k|                                    (size_t)(numrows * sizeof(JBLOCKROW)));
  580|       |
  581|       |  /* Get the rows themselves (large objects) */
  582|  4.49k|  currow = 0;
  583|  8.99k|  while (currow < numrows) {
  ------------------
  |  Branch (583:10): [True: 4.49k, False: 4.49k]
  ------------------
  584|  4.49k|    rowsperchunk = MIN(rowsperchunk, numrows - currow);
  ------------------
  |  |  515|  4.49k|#define MIN(a, b)       ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (515:26): [True: 0, False: 4.49k]
  |  |  ------------------
  ------------------
  585|  4.49k|    workspace = (JBLOCKROW)alloc_large(cinfo, pool_id,
  586|  4.49k|        (size_t)((size_t)rowsperchunk * (size_t)blocksperrow *
  587|  4.49k|                  sizeof(JBLOCK)));
  588|   237k|    for (i = rowsperchunk; i > 0; i--) {
  ------------------
  |  Branch (588:28): [True: 233k, False: 4.49k]
  ------------------
  589|   233k|      result[currow++] = workspace;
  590|   233k|      workspace += blocksperrow;
  591|   233k|    }
  592|  4.49k|  }
  593|       |
  594|  4.49k|  return result;
  595|  4.49k|}
jmemmgr.c:request_virt_sarray:
  640|  3.60k|{
  641|  3.60k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  642|  3.60k|  jvirt_sarray_ptr result;
  643|       |
  644|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  645|  3.60k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  3.60k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (645:7): [True: 0, False: 3.60k]
  ------------------
  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|  3.60k|  result = (jvirt_sarray_ptr)alloc_small(cinfo, pool_id,
  650|  3.60k|                                         sizeof(struct jvirt_sarray_control));
  651|       |
  652|  3.60k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  653|  3.60k|  result->rows_in_array = numrows;
  654|  3.60k|  result->samplesperrow = samplesperrow;
  655|  3.60k|  result->maxaccess = maxaccess;
  656|  3.60k|  result->pre_zero = pre_zero;
  657|  3.60k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  3.60k|#define FALSE   0               /* values of boolean */
  ------------------
  658|  3.60k|  result->next = mem->virt_sarray_list; /* add to list of virtual arrays */
  659|  3.60k|  mem->virt_sarray_list = result;
  660|       |
  661|  3.60k|  return result;
  662|  3.60k|}
jmemmgr.c:request_virt_barray:
  670|  4.49k|{
  671|  4.49k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  672|  4.49k|  jvirt_barray_ptr result;
  673|       |
  674|       |  /* Only IMAGE-lifetime virtual arrays are currently supported */
  675|  4.49k|  if (pool_id != JPOOL_IMAGE)
  ------------------
  |  |  889|  4.49k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (675:7): [True: 0, False: 4.49k]
  ------------------
  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|  4.49k|  result = (jvirt_barray_ptr)alloc_small(cinfo, pool_id,
  680|  4.49k|                                         sizeof(struct jvirt_barray_control));
  681|       |
  682|  4.49k|  result->mem_buffer = NULL;    /* marks array not yet realized */
  683|  4.49k|  result->rows_in_array = numrows;
  684|  4.49k|  result->blocksperrow = blocksperrow;
  685|  4.49k|  result->maxaccess = maxaccess;
  686|  4.49k|  result->pre_zero = pre_zero;
  687|  4.49k|  result->b_s_open = FALSE;     /* no associated backing-store object */
  ------------------
  |  |  207|  4.49k|#define FALSE   0               /* values of boolean */
  ------------------
  688|  4.49k|  result->next = mem->virt_barray_list; /* add to list of virtual arrays */
  689|  4.49k|  mem->virt_barray_list = result;
  690|       |
  691|  4.49k|  return result;
  692|  4.49k|}
jmemmgr.c:realize_virt_arrays:
  698|  4.85k|{
  699|  4.85k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
  700|  4.85k|  size_t space_per_minheight, maximum_space, avail_mem;
  701|  4.85k|  size_t minheights, max_minheights;
  702|  4.85k|  jvirt_sarray_ptr sptr;
  703|  4.85k|  jvirt_barray_ptr bptr;
  704|  4.85k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (704:24): [True: 4.85k, False: 0]
  ------------------
  705|  4.85k|                        ((j_decompress_ptr)cinfo)->data_precision :
  706|  4.85k|                        ((j_compress_ptr)cinfo)->data_precision;
  707|  4.85k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (707:24): [True: 451, False: 4.40k]
  ------------------
  708|  4.40k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (708:45): [True: 887, False: 3.51k]
  ------------------
  709|    887|                                            sizeof(J12SAMPLE) :
  710|  4.40k|                                            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|  4.85k|  space_per_minheight = 0;
  717|  4.85k|  maximum_space = 0;
  718|  8.46k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (718:38): [True: 3.60k, False: 4.85k]
  ------------------
  719|  3.60k|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (719:9): [True: 3.60k, False: 0]
  ------------------
  720|  3.60k|      size_t new_space = (size_t)sptr->rows_in_array *
  721|  3.60k|                         (size_t)sptr->samplesperrow * sample_size;
  722|       |
  723|  3.60k|      space_per_minheight += (size_t)sptr->maxaccess *
  724|  3.60k|                             (size_t)sptr->samplesperrow * sample_size;
  725|  3.60k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (725:11): [True: 0, False: 3.60k]
  ------------------
  726|      0|        out_of_memory(cinfo, 10);
  727|  3.60k|      maximum_space += new_space;
  728|  3.60k|    }
  729|  3.60k|  }
  730|  9.34k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (730:38): [True: 4.49k, False: 4.85k]
  ------------------
  731|  4.49k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (731:9): [True: 4.49k, False: 0]
  ------------------
  732|  4.49k|      size_t new_space = (size_t)bptr->rows_in_array *
  733|  4.49k|                         (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  734|       |
  735|  4.49k|      space_per_minheight += (size_t)bptr->maxaccess *
  736|  4.49k|                             (size_t)bptr->blocksperrow * sizeof(JBLOCK);
  737|  4.49k|      if (SIZE_MAX - maximum_space < new_space)
  ------------------
  |  Branch (737:11): [True: 0, False: 4.49k]
  ------------------
  738|      0|        out_of_memory(cinfo, 11);
  739|  4.49k|      maximum_space += new_space;
  740|  4.49k|    }
  741|  4.49k|  }
  742|       |
  743|  4.85k|  if (space_per_minheight <= 0)
  ------------------
  |  Branch (743:7): [True: 1.90k, False: 2.94k]
  ------------------
  744|  1.90k|    return;                     /* no unrealized arrays, no work */
  745|       |
  746|       |  /* Determine amount of memory to actually use; this is system-dependent. */
  747|  2.94k|  avail_mem = jpeg_mem_available(cinfo, space_per_minheight, maximum_space,
  748|  2.94k|                                 mem->total_space_allocated);
  749|       |
  750|       |  /* If the maximum space needed is available, make all the buffers full
  751|       |   * height; otherwise parcel it out with the same number of minheights
  752|       |   * in each buffer.
  753|       |   */
  754|  2.94k|  if (avail_mem >= maximum_space)
  ------------------
  |  Branch (754:7): [True: 2.94k, False: 7]
  ------------------
  755|  2.94k|    max_minheights = 1000000000L;
  756|      7|  else {
  757|      7|    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|      7|    if (max_minheights <= 0)
  ------------------
  |  Branch (761:9): [True: 7, False: 0]
  ------------------
  762|      7|      max_minheights = 1;
  763|      7|  }
  764|       |
  765|       |  /* Allocate the in-memory buffers and initialize backing store as needed. */
  766|       |
  767|  6.55k|  for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (767:38): [True: 3.60k, False: 2.94k]
  ------------------
  768|  3.60k|    if (sptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (768:9): [True: 3.60k, False: 0]
  ------------------
  769|  3.60k|      minheights = ((long)sptr->rows_in_array - 1L) / sptr->maxaccess + 1L;
  770|  3.60k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (770:11): [True: 3.60k, False: 0]
  ------------------
  771|       |        /* This buffer fits in memory */
  772|  3.60k|        sptr->rows_in_mem = sptr->rows_in_array;
  773|  3.60k|      } 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|  3.60k|      sptr->mem_buffer = alloc_sarray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  3.60k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  783|  3.60k|                                      sptr->samplesperrow, sptr->rows_in_mem);
  784|  3.60k|      sptr->rowsperchunk = mem->last_rowsperchunk;
  785|  3.60k|      sptr->cur_start_row = 0;
  786|  3.60k|      sptr->first_undef_row = 0;
  787|  3.60k|      sptr->dirty = FALSE;
  ------------------
  |  |  207|  3.60k|#define FALSE   0               /* values of boolean */
  ------------------
  788|  3.60k|    }
  789|  3.60k|  }
  790|       |
  791|  7.44k|  for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (791:38): [True: 4.49k, False: 2.94k]
  ------------------
  792|  4.49k|    if (bptr->mem_buffer == NULL) { /* if not realized yet */
  ------------------
  |  Branch (792:9): [True: 4.49k, False: 0]
  ------------------
  793|  4.49k|      minheights = ((long)bptr->rows_in_array - 1L) / bptr->maxaccess + 1L;
  794|  4.49k|      if (minheights <= max_minheights) {
  ------------------
  |  Branch (794:11): [True: 4.49k, False: 0]
  ------------------
  795|       |        /* This buffer fits in memory */
  796|  4.49k|        bptr->rows_in_mem = bptr->rows_in_array;
  797|  4.49k|      } 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|  4.49k|      bptr->mem_buffer = alloc_barray(cinfo, JPOOL_IMAGE,
  ------------------
  |  |  889|  4.49k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  807|  4.49k|                                      bptr->blocksperrow, bptr->rows_in_mem);
  808|  4.49k|      bptr->rowsperchunk = mem->last_rowsperchunk;
  809|  4.49k|      bptr->cur_start_row = 0;
  810|  4.49k|      bptr->first_undef_row = 0;
  811|  4.49k|      bptr->dirty = FALSE;
  ------------------
  |  |  207|  4.49k|#define FALSE   0               /* values of boolean */
  ------------------
  812|  4.49k|    }
  813|  4.49k|  }
  814|  2.94k|}
jmemmgr.c:access_virt_sarray:
  924|  47.0k|{
  925|  47.0k|  JDIMENSION end_row = start_row + num_rows;
  926|  47.0k|  JDIMENSION undef_row;
  927|  47.0k|  int data_precision = cinfo->is_decompressor ?
  ------------------
  |  Branch (927:24): [True: 47.0k, False: 0]
  ------------------
  928|  47.0k|                        ((j_decompress_ptr)cinfo)->data_precision :
  929|  47.0k|                        ((j_compress_ptr)cinfo)->data_precision;
  930|  47.0k|  size_t sample_size = data_precision > 12 ?
  ------------------
  |  Branch (930:24): [True: 26.6k, False: 20.4k]
  ------------------
  931|  26.6k|                       sizeof(J16SAMPLE) : (data_precision > 8 ?
  ------------------
  |  Branch (931:45): [True: 8.75k, False: 11.7k]
  ------------------
  932|  8.75k|                                            sizeof(J12SAMPLE) :
  933|  20.4k|                                            sizeof(JSAMPLE));
  934|       |
  935|       |  /* debugging check */
  936|  47.0k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (936:7): [True: 0, False: 47.0k]
  |  Branch (936:39): [True: 0, False: 47.0k]
  ------------------
  937|  47.0k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (937:7): [True: 0, False: 47.0k]
  ------------------
  938|      0|    ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  939|       |
  940|       |  /* Make the desired part of the virtual array accessible */
  941|  47.0k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (941:7): [True: 0, False: 47.0k]
  ------------------
  942|  47.0k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (942:7): [True: 0, False: 47.0k]
  ------------------
  943|      0|    if (!ptr->b_s_open)
  ------------------
  |  Branch (943:9): [True: 0, False: 0]
  ------------------
  944|      0|      ERREXIT(cinfo, JERR_VIRTUAL_BUG);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  945|       |    /* Flush old buffer contents if necessary */
  946|      0|    if (ptr->dirty) {
  ------------------
  |  Branch (946:9): [True: 0, False: 0]
  ------------------
  947|      0|      do_sarray_io(cinfo, ptr, TRUE);
  ------------------
  |  |  210|      0|#define TRUE    1
  ------------------
  948|      0|      ptr->dirty = FALSE;
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  949|      0|    }
  950|       |    /* Decide what part of virtual array to access.
  951|       |     * Algorithm: if target address > current window, assume forward scan,
  952|       |     * load starting at target address.  If target address < current window,
  953|       |     * assume backward scan, load so that target area is top of window.
  954|       |     * Note that when switching from forward write to forward read, will have
  955|       |     * start_row = 0, so the limiting case applies and we load from 0 anyway.
  956|       |     */
  957|      0|    if (start_row > ptr->cur_start_row) {
  ------------------
  |  Branch (957:9): [True: 0, False: 0]
  ------------------
  958|      0|      ptr->cur_start_row = start_row;
  959|      0|    } else {
  960|       |      /* use long arithmetic here to avoid overflow & unsigned problems */
  961|      0|      long ltemp;
  962|       |
  963|      0|      ltemp = (long)end_row - (long)ptr->rows_in_mem;
  964|      0|      if (ltemp < 0)
  ------------------
  |  Branch (964:11): [True: 0, False: 0]
  ------------------
  965|      0|        ltemp = 0;              /* don't fall off front end of file */
  966|      0|      ptr->cur_start_row = (JDIMENSION)ltemp;
  967|      0|    }
  968|       |    /* Read in the selected part of the array.
  969|       |     * During the initial write pass, we will do no actual read
  970|       |     * because the selected part is all undefined.
  971|       |     */
  972|      0|    do_sarray_io(cinfo, ptr, FALSE);
  ------------------
  |  |  207|      0|#define FALSE   0               /* values of boolean */
  ------------------
  973|      0|  }
  974|       |  /* Ensure the accessed part of the array is defined; prezero if needed.
  975|       |   * To improve locality of access, we only prezero the part of the array
  976|       |   * that the caller is about to access, not the entire in-memory array.
  977|       |   */
  978|  47.0k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (978:7): [True: 37.4k, False: 9.61k]
  ------------------
  979|  37.4k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (979:9): [True: 0, False: 37.4k]
  ------------------
  980|      0|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (980:11): [True: 0, False: 0]
  ------------------
  981|      0|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      0|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      0|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  982|      0|      undef_row = start_row;    /* but reader is allowed to read ahead */
  983|  37.4k|    } else {
  984|  37.4k|      undef_row = ptr->first_undef_row;
  985|  37.4k|    }
  986|  37.4k|    if (writable)
  ------------------
  |  Branch (986:9): [True: 37.4k, False: 9]
  ------------------
  987|  37.4k|      ptr->first_undef_row = end_row;
  988|  37.4k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (988:9): [True: 0, False: 37.4k]
  ------------------
  989|      0|      size_t bytesperrow = (size_t)ptr->samplesperrow * sample_size;
  990|      0|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
  991|      0|      end_row -= ptr->cur_start_row;
  992|      0|      while (undef_row < end_row) {
  ------------------
  |  Branch (992:14): [True: 0, False: 0]
  ------------------
  993|      0|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
  994|      0|        undef_row++;
  995|      0|      }
  996|  37.4k|    } else {
  997|  37.4k|      if (!writable)            /* reader looking at undefined data */
  ------------------
  |  Branch (997:11): [True: 9, False: 37.4k]
  ------------------
  998|      9|        ERREXIT(cinfo, JERR_BAD_VIRTUAL_ACCESS);
  ------------------
  |  |  240|      9|  ((cinfo)->err->msg_code = (code), \
  |  |  241|      9|   (*(cinfo)->err->error_exit) ((j_common_ptr)(cinfo)))
  ------------------
  999|  37.4k|    }
 1000|  37.4k|  }
 1001|       |  /* Flag the buffer dirty if caller will write in it */
 1002|  47.0k|  if (writable)
  ------------------
  |  Branch (1002:7): [True: 47.0k, False: 50]
  ------------------
 1003|  47.0k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|  47.0k|#define TRUE    1
  ------------------
 1004|       |  /* Return address of proper part of the buffer */
 1005|  47.0k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1006|  47.0k|}
jmemmgr.c:access_virt_barray:
 1015|   337k|{
 1016|   337k|  JDIMENSION end_row = start_row + num_rows;
 1017|   337k|  JDIMENSION undef_row;
 1018|       |
 1019|       |  /* debugging check */
 1020|   337k|  if (end_row > ptr->rows_in_array || num_rows > ptr->maxaccess ||
  ------------------
  |  Branch (1020:7): [True: 0, False: 337k]
  |  Branch (1020:39): [True: 0, False: 337k]
  ------------------
 1021|   337k|      ptr->mem_buffer == NULL)
  ------------------
  |  Branch (1021:7): [True: 0, False: 337k]
  ------------------
 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|   337k|  if (start_row < ptr->cur_start_row ||
  ------------------
  |  Branch (1025:7): [True: 0, False: 337k]
  ------------------
 1026|   337k|      end_row > ptr->cur_start_row + ptr->rows_in_mem) {
  ------------------
  |  Branch (1026:7): [True: 0, False: 337k]
  ------------------
 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|   337k|  if (ptr->first_undef_row < end_row) {
  ------------------
  |  Branch (1062:7): [True: 111k, False: 225k]
  ------------------
 1063|   111k|    if (ptr->first_undef_row < start_row) {
  ------------------
  |  Branch (1063:9): [True: 3.17k, False: 108k]
  ------------------
 1064|  3.17k|      if (writable)             /* writer skipped over a section of array */
  ------------------
  |  Branch (1064:11): [True: 0, False: 3.17k]
  ------------------
 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|  3.17k|      undef_row = start_row;    /* but reader is allowed to read ahead */
 1067|   108k|    } else {
 1068|   108k|      undef_row = ptr->first_undef_row;
 1069|   108k|    }
 1070|   111k|    if (writable)
  ------------------
  |  Branch (1070:9): [True: 108k, False: 3.20k]
  ------------------
 1071|   108k|      ptr->first_undef_row = end_row;
 1072|   111k|    if (ptr->pre_zero) {
  ------------------
  |  Branch (1072:9): [True: 111k, False: 0]
  ------------------
 1073|   111k|      size_t bytesperrow = (size_t)ptr->blocksperrow * sizeof(JBLOCK);
 1074|   111k|      undef_row -= ptr->cur_start_row; /* make indexes relative to buffer */
 1075|   111k|      end_row -= ptr->cur_start_row;
 1076|   274k|      while (undef_row < end_row) {
  ------------------
  |  Branch (1076:14): [True: 162k, False: 111k]
  ------------------
 1077|   162k|        jzero_far((void *)ptr->mem_buffer[undef_row], bytesperrow);
 1078|   162k|        undef_row++;
 1079|   162k|      }
 1080|   111k|    } 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|   111k|  }
 1085|       |  /* Flag the buffer dirty if caller will write in it */
 1086|   337k|  if (writable)
  ------------------
  |  Branch (1086:7): [True: 275k, False: 61.7k]
  ------------------
 1087|   275k|    ptr->dirty = TRUE;
  ------------------
  |  |  210|   275k|#define TRUE    1
  ------------------
 1088|       |  /* Return address of proper part of the buffer */
 1089|   337k|  return ptr->mem_buffer + (start_row - ptr->cur_start_row);
 1090|   337k|}
jmemmgr.c:free_pool:
 1099|  13.4k|{
 1100|  13.4k|  my_mem_ptr mem = (my_mem_ptr)cinfo->mem;
 1101|  13.4k|  small_pool_ptr shdr_ptr;
 1102|  13.4k|  large_pool_ptr lhdr_ptr;
 1103|  13.4k|  size_t space_freed;
 1104|       |
 1105|  13.4k|  if (pool_id < 0 || pool_id >= JPOOL_NUMPOOLS)
  ------------------
  |  |  890|  13.4k|#define JPOOL_NUMPOOLS   2
  ------------------
  |  Branch (1105:7): [True: 0, False: 13.4k]
  |  Branch (1105:22): [True: 0, False: 13.4k]
  ------------------
 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|  13.4k|  if (pool_id == JPOOL_IMAGE) {
  ------------------
  |  |  889|  13.4k|#define JPOOL_IMAGE      1      /* lasts until done with image/datastream */
  ------------------
  |  Branch (1114:7): [True: 7.02k, False: 6.47k]
  ------------------
 1115|  7.02k|    jvirt_sarray_ptr sptr;
 1116|  7.02k|    jvirt_barray_ptr bptr;
 1117|       |
 1118|  10.6k|    for (sptr = mem->virt_sarray_list; sptr != NULL; sptr = sptr->next) {
  ------------------
  |  Branch (1118:40): [True: 3.60k, False: 7.02k]
  ------------------
 1119|  3.60k|      if (sptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1119:11): [True: 0, False: 3.60k]
  ------------------
 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|  3.60k|    }
 1124|  7.02k|    mem->virt_sarray_list = NULL;
 1125|  11.5k|    for (bptr = mem->virt_barray_list; bptr != NULL; bptr = bptr->next) {
  ------------------
  |  Branch (1125:40): [True: 4.49k, False: 7.02k]
  ------------------
 1126|  4.49k|      if (bptr->b_s_open) {     /* there may be no backing store */
  ------------------
  |  Branch (1126:11): [True: 0, False: 4.49k]
  ------------------
 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|  4.49k|    }
 1131|  7.02k|    mem->virt_barray_list = NULL;
 1132|  7.02k|  }
 1133|       |
 1134|       |  /* Release large objects */
 1135|  13.4k|  lhdr_ptr = mem->large_list[pool_id];
 1136|  13.4k|  mem->large_list[pool_id] = NULL;
 1137|       |
 1138|  57.5k|  while (lhdr_ptr != NULL) {
  ------------------
  |  Branch (1138:10): [True: 44.0k, False: 13.4k]
  ------------------
 1139|  44.0k|    large_pool_ptr next_lhdr_ptr = lhdr_ptr->next;
 1140|  44.0k|    space_freed = lhdr_ptr->bytes_used +
 1141|  44.0k|                  lhdr_ptr->bytes_left +
 1142|  44.0k|                  sizeof(large_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  44.0k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1143|  44.0k|    jpeg_free_large(cinfo, (void *)lhdr_ptr, space_freed);
 1144|  44.0k|    mem->total_space_allocated -= space_freed;
 1145|  44.0k|    lhdr_ptr = next_lhdr_ptr;
 1146|  44.0k|  }
 1147|       |
 1148|       |  /* Release small objects */
 1149|  13.4k|  shdr_ptr = mem->small_list[pool_id];
 1150|  13.4k|  mem->small_list[pool_id] = NULL;
 1151|       |
 1152|  31.0k|  while (shdr_ptr != NULL) {
  ------------------
  |  Branch (1152:10): [True: 17.5k, False: 13.4k]
  ------------------
 1153|  17.5k|    small_pool_ptr next_shdr_ptr = shdr_ptr->next;
 1154|  17.5k|    space_freed = shdr_ptr->bytes_used + shdr_ptr->bytes_left +
 1155|  17.5k|                  sizeof(small_pool_hdr) + ALIGN_SIZE - 1;
  ------------------
  |  |   89|  17.5k|#define ALIGN_SIZE  32 /* Most of the SIMD instructions we support require
  ------------------
 1156|  17.5k|    jpeg_free_small(cinfo, (void *)shdr_ptr, space_freed);
 1157|  17.5k|    mem->total_space_allocated -= space_freed;
 1158|  17.5k|    shdr_ptr = next_shdr_ptr;
 1159|  17.5k|  }
 1160|  13.4k|}
jmemmgr.c:self_destruct:
 1170|  6.47k|{
 1171|  6.47k|  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|  19.4k|  for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  890|  6.47k|#define JPOOL_NUMPOOLS   2
  ------------------
                for (pool = JPOOL_NUMPOOLS - 1; pool >= JPOOL_PERMANENT; pool--) {
  ------------------
  |  |  888|  19.4k|#define JPOOL_PERMANENT  0      /* lasts until master record is destroyed */
  ------------------
  |  Branch (1177:35): [True: 12.9k, False: 6.47k]
  ------------------
 1178|  12.9k|    free_pool(cinfo, pool);
 1179|  12.9k|  }
 1180|       |
 1181|       |  /* Release the memory manager control block too. */
 1182|  6.47k|  jpeg_free_small(cinfo, (void *)cinfo->mem, sizeof(my_memory_mgr));
 1183|  6.47k|  cinfo->mem = NULL;            /* ensures I will be called only once */
 1184|       |
 1185|  6.47k|  jpeg_mem_term(cinfo);         /* system-dependent cleanup */
 1186|  6.47k|}

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

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

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

LLVMFuzzerTestOneInput:
   50|  22.0k|{
   51|  22.0k|#ifndef _WIN32
   52|       |    // Used by jpeg library to work around false positives in memory sanitizer.
   53|  22.0k|    setenv("JSIMD_FORCENONE", "1", 1);
   54|  22.0k|#endif
   55|  22.0k|    FuzzHelper f(data, size);
   56|  22.0k|    f.run();
   57|  22.0k|    return 0;
   58|  22.0k|}
_ZN10FuzzHelperC2EPKhm:
   14|  22.0k|        input_buffer(const_cast<unsigned char*>(data), size)
   15|  22.0k|    {
   16|  22.0k|    }
_ZN10FuzzHelper3runEv:
   20|  22.0k|    {
   21|  22.0k|        qpdf::global::options::fuzz_mode(true);
   22|       |        // The goal here is that you should be able to throw anything at libqpdf and it will respond
   23|       |        // without any memory errors and never do anything worse than throwing a QPDFExc or
   24|       |        // std::runtime_error. Throwing any other kind of exception, segfaulting, or having a memory
   25|       |        // error (when built with appropriate sanitizers) will all cause abnormal exit.
   26|  22.0k|        try {
   27|  22.0k|            std::cerr << "\ninfo: starting testWrite\n";
   28|       |
   29|  22.0k|            auto is = std::make_shared<BufferInputSource>("fuzz input", &input_buffer);
   30|  22.0k|            QPDF qpdf;
   31|  22.0k|            qpdf.processInputSource(is);
   32|  22.0k|            QPDFWriter w(qpdf);
   33|  22.0k|            w.setOutputPipeline(&discard);
   34|  22.0k|            w.setDecodeLevel(qpdf_dl_all);
   35|  22.0k|            w.setDeterministicID(true);
   36|  22.0k|            w.setQDFMode(true);
   37|  22.0k|            w.write();
   38|  22.0k|        } catch (std::runtime_error const& e) {
   39|  13.7k|            std::cerr << "runtime_error: " << e.what() << '\n';
   40|  13.7k|        }
   41|  22.0k|    }

_ZN11InputSourceC2Ev:
   35|  82.7k|    InputSource() = default;
_ZN11InputSourceD2Ev:
   37|  82.7k|    virtual ~InputSource() = default;
_ZN11InputSource6FinderC2Ev:
   43|  96.8k|        Finder() = default;
_ZN11InputSource6FinderD2Ev:
   45|  23.2k|        virtual ~Finder() = default;

_ZNK4qpdf10BaseHandle5emptyEv:
   82|  24.1k|        {
   83|  24.1k|            return size() == 0;
   84|  24.1k|        }
_ZN4qpdf10BaseHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  120|  21.4M|            obj(obj) {};
_ZN4qpdf10BaseHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
  122|  27.7M|            obj(std::move(obj)) {};
_ZN4qpdf10BaseHandleC2Ev:
  118|   360M|        BaseHandle() = default;
_ZN4qpdf10BaseHandleD2Ev:
  131|  1.01G|        ~BaseHandle() = default;
_ZN4qpdf10BaseHandleC2ERKS0_:
  123|   209M|        BaseHandle(BaseHandle const&) = default;
_ZN4qpdf10BaseHandleaSEOS0_:
  126|  15.6M|        BaseHandle& operator=(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleC2EOS0_:
  125|  47.1M|        BaseHandle(BaseHandle&&) = default;
_ZN4qpdf10BaseHandleaSERKS0_:
  124|  84.6k|        BaseHandle& operator=(BaseHandle const&) = default;

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

_ZN5QIntC9to_offsetImEExRKT_:
  222|  4.89M|    {
  223|  4.89M|        return IntConverter<T, qpdf_offset_t>::convert(i);
  224|  4.89M|    }
_ZN5QIntC12IntConverterImxLb0ELb1EE7convertERKm:
  147|  4.89M|        {
  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|  4.89M|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|  4.89M|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 4.89M]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|  4.89M|            return static_cast<To>(i);
  155|  4.89M|        }
_ZN5QIntC11range_checkIxEEvRKT_S3_:
  274|   169k|    {
  275|   169k|        if ((delta > 0) != (cur > 0)) {
  ------------------
  |  Branch (275:13): [True: 140k, False: 28.5k]
  ------------------
  276|   140k|            return;
  277|   140k|        }
  278|  28.5k|        QIntC::range_check_error<T>(cur, delta);
  279|  28.5k|    }
_ZN5QIntC17range_check_errorIxEEvRKT_S3_:
  257|  28.5k|    {
  258|  28.5k|        if ((delta > 0) && ((std::numeric_limits<T>::max() - cur) < delta)) {
  ------------------
  |  Branch (258:13): [True: 28.5k, False: 0]
  |  Branch (258:28): [True: 31, False: 28.4k]
  ------------------
  259|     31|            std::ostringstream msg;
  260|     31|            msg.imbue(std::locale::classic());
  261|     31|            msg << "adding " << delta << " to " << cur << " would cause an integer overflow";
  262|     31|            throw std::range_error(msg.str());
  263|  28.4k|        } else if ((delta < 0) && ((std::numeric_limits<T>::min() - cur) > delta)) {
  ------------------
  |  Branch (263:20): [True: 0, False: 28.4k]
  |  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|  28.5k|    }
_ZN5QIntC7to_sizeIxEEmRKT_:
  215|  3.41M|    {
  216|  3.41M|        return IntConverter<T, size_t>::convert(i);
  217|  3.41M|    }
_ZN5QIntC12IntConverterIxmLb1ELb0EE7convertERKx:
  119|  3.41M|        {
  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|  3.41M|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  3.41M|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 3.41M]
  |  Branch (124:28): [True: 0, False: 3.41M]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  3.41M|            return static_cast<To>(i);
  128|  3.41M|        }
_ZN5QIntC6to_intImEEiRKT_:
  201|   153k|    {
  202|   153k|        return IntConverter<T, int>::convert(i);
  203|   153k|    }
_ZN5QIntC12IntConverterImiLb0ELb1EE7convertERKm:
  147|   153k|        {
  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|   153k|            auto maxval = static_cast<typename to_u<To>::type>(std::numeric_limits<To>::max());
  151|   153k|            if (i > maxval) {
  ------------------
  |  Branch (151:17): [True: 0, False: 153k]
  ------------------
  152|      0|                error(i);
  153|      0|            }
  154|   153k|            return static_cast<To>(i);
  155|   153k|        }
_ZN5QIntC7to_sizeIiEEmRKT_:
  215|   192k|    {
  216|   192k|        return IntConverter<T, size_t>::convert(i);
  217|   192k|    }
_ZN5QIntC12IntConverterIimLb1ELb0EE7convertERKi:
  119|   192k|        {
  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|   192k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   192k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 192k]
  |  Branch (124:28): [True: 0, False: 192k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   192k|            return static_cast<To>(i);
  128|   192k|        }
_ZN5QIntC6to_intIxEEiRKT_:
  201|  9.06M|    {
  202|  9.06M|        return IntConverter<T, int>::convert(i);
  203|  9.06M|    }
_ZN5QIntC12IntConverterIxiLb1ELb1EE7convertERKx:
   94|  9.06M|        {
   95|       |            // From and To are both signed.
   96|  9.06M|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 718, False: 9.06M]
  |  Branch (96:57): [True: 804, False: 9.06M]
  ------------------
   97|  1.52k|                error(i);
   98|  1.52k|            }
   99|  9.06M|            return static_cast<To>(i);
  100|  9.06M|        }
_ZN5QIntC12IntConverterIxiLb1ELb1EE5errorEx:
  104|  1.52k|        {
  105|  1.52k|            std::ostringstream msg;
  106|  1.52k|            msg.imbue(std::locale::classic());
  107|  1.52k|            msg << "integer out of range converting " << i << " from a " << sizeof(From)
  108|  1.52k|                << "-byte signed type to a " << sizeof(To) << "-byte signed type";
  109|  1.52k|            throw std::range_error(msg.str());
  110|  1.52k|        }
_ZN5QIntC11to_longlongImEExRKT_:
  243|    470|    {
  244|    470|        return IntConverter<T, long long>::convert(i);
  245|    470|    }
_ZN5QIntC12to_ulonglongIxEEyRKT_:
  250|  24.0k|    {
  251|  24.0k|        return IntConverter<T, unsigned long long>::convert(i);
  252|  24.0k|    }
_ZN5QIntC12IntConverterIxyLb1ELb0EE7convertERKx:
  119|  24.0k|        {
  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|  24.0k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  24.0k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 24.0k]
  |  Branch (124:28): [True: 0, False: 24.0k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  24.0k|            return static_cast<To>(i);
  128|  24.0k|        }
_ZN5QIntC12to_ulonglongIiEEyRKT_:
  250|  35.7k|    {
  251|  35.7k|        return IntConverter<T, unsigned long long>::convert(i);
  252|  35.7k|    }
_ZN5QIntC12IntConverterIiyLb1ELb0EE7convertERKi:
  119|  35.7k|        {
  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|  35.7k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  35.7k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 35.7k]
  |  Branch (124:28): [True: 0, False: 35.7k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  35.7k|            return static_cast<To>(i);
  128|  35.7k|        }
_ZN5QIntC7to_sizeImEEmRKT_:
  215|    109|    {
  216|    109|        return IntConverter<T, size_t>::convert(i);
  217|    109|    }
_ZN5QIntC12IntConverterImmLb0ELb0EE7convertERKm:
   69|   154k|        {
   70|       |            // From and To are both unsigned.
   71|   154k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 154k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|   154k|            return static_cast<To>(i);
   75|   154k|        }
_ZN5QIntC7to_uintIiEEjRKT_:
  208|  29.2k|    {
  209|  29.2k|        return IntConverter<T, unsigned int>::convert(i);
  210|  29.2k|    }
_ZN5QIntC12IntConverterIijLb1ELb0EE7convertERKi:
  119|  29.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|  29.2k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|  29.2k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 29.2k]
  |  Branch (124:28): [True: 0, False: 29.2k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|  29.2k|            return static_cast<To>(i);
  128|  29.2k|        }
_ZN5QIntC6to_intIlEEiRKT_:
  201|  8.17k|    {
  202|  8.17k|        return IntConverter<T, int>::convert(i);
  203|  8.17k|    }
_ZN5QIntC12IntConverterIliLb1ELb1EE7convertERKl:
   94|  8.17k|        {
   95|       |            // From and To are both signed.
   96|  8.17k|            if ((i < std::numeric_limits<To>::min()) || (i > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (96:17): [True: 0, False: 8.17k]
  |  Branch (96:57): [True: 0, False: 8.17k]
  ------------------
   97|      0|                error(i);
   98|      0|            }
   99|  8.17k|            return static_cast<To>(i);
  100|  8.17k|        }
_ZN5QIntC7to_sizeIyEEmRKT_:
  215|  28.6k|    {
  216|  28.6k|        return IntConverter<T, size_t>::convert(i);
  217|  28.6k|    }
_ZN5QIntC12IntConverterIymLb0ELb0EE7convertERKy:
   69|  28.6k|        {
   70|       |            // From and To are both unsigned.
   71|  28.6k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 28.6k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  28.6k|            return static_cast<To>(i);
   75|  28.6k|        }
_ZN5QIntC7to_sizeIlEEmRKT_:
  215|   583k|    {
  216|   583k|        return IntConverter<T, size_t>::convert(i);
  217|   583k|    }
_ZN5QIntC12IntConverterIlmLb1ELb0EE7convertERKl:
  119|   583k|        {
  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|   583k|            auto ii = static_cast<typename to_u<From>::type>(i);
  124|   583k|            if ((i < 0) || (ii > std::numeric_limits<To>::max())) {
  ------------------
  |  Branch (124:17): [True: 0, False: 583k]
  |  Branch (124:28): [True: 0, False: 583k]
  ------------------
  125|      0|                error(i);
  126|      0|            }
  127|   583k|            return static_cast<To>(i);
  128|   583k|        }
_ZN5QIntC7to_uintImEEjRKT_:
  208|  1.54M|    {
  209|  1.54M|        return IntConverter<T, unsigned int>::convert(i);
  210|  1.54M|    }
_ZN5QIntC12IntConverterImjLb0ELb0EE7convertERKm:
   69|  1.54M|        {
   70|       |            // From and To are both unsigned.
   71|  1.54M|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 1.54M]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  1.54M|            return static_cast<To>(i);
   75|  1.54M|        }
_ZN5QIntC7to_sizeIjEEmRKT_:
  215|  16.2k|    {
  216|  16.2k|        return IntConverter<T, size_t>::convert(i);
  217|  16.2k|    }
_ZN5QIntC12IntConverterIjmLb0ELb0EE7convertERKj:
   69|  16.2k|        {
   70|       |            // From and To are both unsigned.
   71|  16.2k|            if (i > std::numeric_limits<To>::max()) {
  ------------------
  |  Branch (71:17): [True: 0, False: 16.2k]
  ------------------
   72|      0|                error(i);
   73|      0|            }
   74|  16.2k|            return static_cast<To>(i);
   75|  16.2k|        }
_ZN5QIntC8to_ulongImEEmRKT_:
  236|   154k|    {
  237|   154k|        return IntConverter<T, unsigned long>::convert(i);
  238|   154k|    }

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

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

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

_ZN10QPDFObjGenC2Eii:
   40|  2.34M|        obj(obj),
   41|  2.34M|        gen(gen)
   42|  2.34M|    {
   43|  2.34M|    }
_ZNK10QPDFObjGenltERKS_:
   46|   223M|    {
   47|   223M|        return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
  ------------------
  |  Branch (47:16): [True: 146M, False: 77.5M]
  |  Branch (47:36): [True: 10.3M, False: 67.2M]
  |  Branch (47:54): [True: 115k, False: 10.2M]
  ------------------
   48|   223M|    }
_ZNK10QPDFObjGeneqERKS_:
   51|   313k|    {
   52|   313k|        return obj == rhs.obj && gen == rhs.gen;
  ------------------
  |  Branch (52:16): [True: 168k, False: 145k]
  |  Branch (52:34): [True: 168k, False: 194]
  ------------------
   53|   313k|    }
_ZNK10QPDFObjGenneERKS_:
   56|   143k|    {
   57|   143k|        return !(*this == rhs);
   58|   143k|    }
_ZNK10QPDFObjGen6getObjEv:
   61|  24.0M|    {
   62|  24.0M|        return obj;
   63|  24.0M|    }
_ZNK10QPDFObjGen6getGenEv:
   66|   206k|    {
   67|   206k|        return gen;
   68|   206k|    }
_ZNK10QPDFObjGen10isIndirectEv:
   71|   214M|    {
   72|   214M|        return obj != 0;
   73|   214M|    }
_ZNK10QPDFObjGen7unparseEc:
   76|   405k|    {
   77|   405k|        return std::to_string(obj) + separator + std::to_string(gen);
   78|   405k|    }
_ZN10QPDFObjGen3set3addES_:
  111|   103k|        {
  112|   103k|            if (og.isIndirect()) {
  ------------------
  |  Branch (112:17): [True: 41.4k, False: 61.7k]
  ------------------
  113|  41.4k|                if (count(og)) {
  ------------------
  |  Branch (113:21): [True: 2.25k, False: 39.1k]
  ------------------
  114|  2.25k|                    return false;
  115|  2.25k|                }
  116|  39.1k|                emplace(og);
  117|  39.1k|            }
  118|   100k|            return true;
  119|   103k|        }
_ZN10QPDFObjGen3set5eraseES_:
  123|  37.9k|        {
  124|  37.9k|            if (og.isIndirect()) {
  ------------------
  |  Branch (124:17): [True: 7.33k, False: 30.6k]
  ------------------
  125|  7.33k|                std::set<QPDFObjGen>::erase(og);
  126|  7.33k|            }
  127|  37.9k|        }
_ZN10QPDFObjGenC2Ev:
   38|  48.7M|    QPDFObjGen() = default;

_ZN16QPDFObjectHandle11TokenFilter16PipelineAccessor11setPipelineEPS0_P8Pipeline:
  176|  5.27k|            {
  177|  5.27k|                f->setPipeline(p);
  178|  5.27k|            }
_ZN16QPDFObjectHandle9RectangleC2Edddd:
  243|  7.98k|            llx(llx),
  244|  7.98k|            lly(lly),
  245|  7.98k|            urx(urx),
  246|  7.98k|            ury(ury)
  247|  7.98k|        {
  248|  7.98k|        }
_ZN16QPDFObjectHandleC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
 1315|   989k|        qpdf::BaseHandle(obj)
 1316|   989k|    {
 1317|   989k|    }
_ZN16QPDFObjectHandleC2EONSt3__110shared_ptrI10QPDFObjectEE:
 1319|  26.8M|        qpdf::BaseHandle(std::move(obj))
 1320|  26.8M|    {
 1321|  26.8M|    }
_ZNK4qpdf10BaseHandlecvbEv:
 1559|   195M|    {
 1560|   195M|        return static_cast<bool>(obj);
 1561|   195M|    }
_ZNK4qpdf10BaseHandlecv16QPDFObjectHandleEv:
 1565|   145k|    {
 1566|   145k|        return {obj};
 1567|   145k|    }
_ZN16QPDFObjectHandleC2Ev:
  289|   360M|    QPDFObjectHandle() = default;
_ZN16QPDFObjectHandleC2ERKS_:
  290|   209M|    QPDFObjectHandle(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandleaSEOS_:
  293|  15.6M|    QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleC2EOS_:
  292|  47.1M|    QPDFObjectHandle(QPDFObjectHandle&&) = default;
_ZN16QPDFObjectHandleaSERKS_:
  291|  84.6k|    QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
_ZN16QPDFObjectHandle11TokenFilterC2Ev:
  163|  45.5k|        TokenFilter() = default;

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

_ZN13QPDFTokenizer5TokenC2Ev:
   71|  4.34M|            type(tt_bad)
   72|  4.34M|        {
   73|  4.34M|        }
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEES8_S8_:
   81|  4.34M|            type(type),
   82|  4.34M|            value(value),
   83|  4.34M|            raw_value(raw_value),
   84|  4.34M|            error_message(error_message)
   85|  4.34M|        {
   86|  4.34M|        }
_ZNK13QPDFTokenizer5Token7getTypeEv:
   89|  7.61M|        {
   90|  7.61M|            return this->type;
   91|  7.61M|        }
_ZNK13QPDFTokenizer5Token8getValueEv:
   94|  2.37M|        {
   95|  2.37M|            return this->value;
   96|  2.37M|        }
_ZNK13QPDFTokenizer5Token11getRawValueEv:
   99|  1.63M|        {
  100|  1.63M|            return this->raw_value;
  101|  1.63M|        }
_ZNK13QPDFTokenizer5Token9isIntegerEv:
  116|  2.11M|        {
  117|  2.11M|            return this->type == tt_integer;
  118|  2.11M|        }
_ZNK13QPDFTokenizer5Token6isWordERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  126|  4.43M|        {
  127|  4.43M|            return this->type == tt_word && this->value == value;
  ------------------
  |  Branch (127:20): [True: 2.07M, False: 2.35M]
  |  Branch (127:45): [True: 496k, False: 1.58M]
  ------------------
  128|  4.43M|        }

_ZN10QPDFWriterD2Ev:
   75|  8.57k|    ~QPDFWriter() = default;

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

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

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

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

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

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

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

_ZN6BufferC2Em:
   38|  1.21M|    m(std::make_unique<Members>(std::string(size, '\0')))
   39|  1.21M|{
   40|  1.21M|}
_ZN6BufferC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
   43|  5.11k|    m(std::make_unique<Members>(std::move(content)))
   44|  5.11k|{
   45|  5.11k|}
_ZN6BufferC2EPhm:
   48|  22.0k|    m(std::make_unique<Members>(size, reinterpret_cast<char*>(buf)))
   49|  22.0k|{
   50|  22.0k|}
_ZN6BufferC2EOS_:
   58|  1.61M|    m(std::move(rhs.m))
   59|  1.61M|{
   60|  1.61M|}
_ZN6BufferD2Ev:
   69|  2.85M|Buffer::~Buffer() = default;
_ZNK6Buffer7getSizeEv:
   73|  70.3k|{
   74|  70.3k|    return m->size;
   75|  70.3k|}
_ZN6Buffer9getBufferEv:
   85|  5.41M|{
   86|  5.41M|    return reinterpret_cast<unsigned char*>(m->buf);
   87|  5.41M|}
_ZN6Buffer7MembersD2Ev:
   24|  1.23M|    ~Members() = default;
_ZN6Buffer7MembersC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   18|  1.21M|        str(std::move(content)),
   19|  1.21M|        size(str.size()),
   20|  1.21M|        buf(str.data())
   21|  1.21M|    {
   22|  1.21M|    }
_ZN6Buffer7MembersC2EmPc:
   13|  22.0k|        size(size),
   14|  22.0k|        buf(buf)
   15|  22.0k|    {
   16|  22.0k|    }

_ZN17BufferInputSourceC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEP6Bufferb:
   16|  22.0k|    own_memory(own_memory),
   17|  22.0k|    description(description),
   18|  22.0k|    buf(buf),
   19|  22.0k|    cur_offset(0),
   20|  22.0k|    max_offset(buf ? QIntC::to_offset(buf->getSize()) : 0)
  ------------------
  |  Branch (20:16): [True: 22.0k, False: 0]
  ------------------
   21|  22.0k|{
   22|  22.0k|}
_ZN17BufferInputSourceD2Ev:
   35|  22.0k|{
   36|  22.0k|    if (own_memory) {
  ------------------
  |  Branch (36:9): [True: 0, False: 22.0k]
  ------------------
   37|      0|        delete buf;
   38|      0|    }
   39|  22.0k|}
_ZN17BufferInputSource18findAndSkipNextEOLEv:
   43|  1.48M|{
   44|  1.48M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
   45|  1.48M|    qpdf_offset_t end_pos = max_offset;
   46|  1.48M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (46:9): [True: 6.81k, False: 1.47M]
  ------------------
   47|  6.81k|        last_offset = end_pos;
   48|  6.81k|        cur_offset = end_pos;
   49|  6.81k|        return end_pos;
   50|  6.81k|    }
   51|       |
   52|  1.47M|    qpdf_offset_t result = 0;
   53|  1.47M|    unsigned char const* buffer = buf->getBuffer();
   54|  1.47M|    unsigned char const* end = buffer + end_pos;
   55|  1.47M|    unsigned char const* p = buffer + cur_offset;
   56|       |
   57|   241M|    while ((p < end) && !((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (57:12): [True: 241M, False: 13.8k]
  |  Branch (57:27): [True: 506k, False: 240M]
  |  Branch (57:43): [True: 958k, False: 239M]
  ------------------
   58|   239M|        ++p;
   59|   239M|    }
   60|  1.47M|    if (p < end) {
  ------------------
  |  Branch (60:9): [True: 1.46M, False: 13.8k]
  ------------------
   61|  1.46M|        result = p - buffer;
   62|  1.46M|        cur_offset = result + 1;
   63|  1.46M|        ++p;
   64|  1.71M|        while ((cur_offset < end_pos) && ((*p == '\r') || (*p == '\n'))) {
  ------------------
  |  Branch (64:16): [True: 1.71M, False: 1.83k]
  |  Branch (64:43): [True: 22.3k, False: 1.68M]
  |  Branch (64:59): [True: 225k, False: 1.46M]
  ------------------
   65|   247k|            ++p;
   66|   247k|            ++cur_offset;
   67|   247k|        }
   68|  1.46M|    } else {
   69|  13.8k|        cur_offset = end_pos;
   70|  13.8k|        result = end_pos;
   71|  13.8k|    }
   72|  1.47M|    return result;
   73|  1.48M|}
_ZNK17BufferInputSource7getNameEv:
   77|   963k|{
   78|   963k|    return description;
   79|   963k|}
_ZN17BufferInputSource4tellEv:
   83|  16.1M|{
   84|  16.1M|    return cur_offset;
   85|  16.1M|}
_ZN17BufferInputSource4seekExi:
   89|  11.4M|{
   90|  11.4M|    switch (whence) {
   91|  11.2M|    case SEEK_SET:
  ------------------
  |  Branch (91:5): [True: 11.2M, False: 169k]
  ------------------
   92|  11.2M|        cur_offset = offset;
   93|  11.2M|        break;
   94|       |
   95|  43.0k|    case SEEK_END:
  ------------------
  |  Branch (95:5): [True: 43.0k, False: 11.3M]
  ------------------
   96|  43.0k|        QIntC::range_check(max_offset, offset);
   97|  43.0k|        cur_offset = max_offset + offset;
   98|  43.0k|        break;
   99|       |
  100|   125k|    default:
  ------------------
  |  Branch (100:5): [True: 125k, False: 11.2M]
  ------------------
  101|   125k|        util::assertion(whence == SEEK_CUR, "invalid argument to BufferInputSource::seek");
  102|   125k|        QIntC::range_check(cur_offset, offset);
  103|   125k|        cur_offset += offset;
  104|  11.4M|    }
  105|       |
  106|  11.4M|    if (cur_offset < 0) {
  ------------------
  |  Branch (106:9): [True: 407, False: 11.4M]
  ------------------
  107|    407|        throw std::runtime_error(description + ": seek before beginning of buffer");
  108|    407|    }
  109|  11.4M|}
_ZN17BufferInputSource4readEPcm:
  119|  2.72M|{
  120|  2.72M|    util::internal_error_if(cur_offset < 0, "BufferInputSource offset < 0");
  121|  2.72M|    qpdf_offset_t end_pos = max_offset;
  122|  2.72M|    if (cur_offset >= end_pos) {
  ------------------
  |  Branch (122:9): [True: 71.9k, False: 2.65M]
  ------------------
  123|  71.9k|        last_offset = end_pos;
  124|  71.9k|        return 0;
  125|  71.9k|    }
  126|       |
  127|  2.65M|    last_offset = cur_offset;
  128|  2.65M|    size_t len = std::min(QIntC::to_size(end_pos - cur_offset), length);
  129|  2.65M|    memcpy(buffer, buf->getBuffer() + cur_offset, len);
  130|  2.65M|    cur_offset += QIntC::to_offset(len);
  131|  2.65M|    return len;
  132|  2.72M|}
_ZN17BufferInputSource8unreadChEc:
  136|  15.1k|{
  137|  15.1k|    if (cur_offset > 0) {
  ------------------
  |  Branch (137:9): [True: 15.1k, False: 0]
  ------------------
  138|  15.1k|        --cur_offset;
  139|  15.1k|    }
  140|  15.1k|}
_ZN4qpdf2is12OffsetBuffer4seekExi:
  258|  25.4M|{
  259|  25.4M|    switch (whence) {
  260|  25.4M|    case SEEK_SET:
  ------------------
  |  Branch (260:5): [True: 25.4M, False: 0]
  ------------------
  261|  25.4M|        pos = offset - global_offset;
  262|  25.4M|        break;
  263|       |
  264|      0|    case SEEK_END:
  ------------------
  |  Branch (264:5): [True: 0, False: 25.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: 25.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|  25.4M|    }
  274|       |
  275|  25.4M|    if (pos < 0) {
  ------------------
  |  Branch (275:9): [True: 0, False: 25.4M]
  ------------------
  276|      0|        throw std::runtime_error(description + ": seek before beginning of buffer");
  277|      0|    }
  278|  25.4M|}
_ZN4qpdf2is12OffsetBuffer4readEPcm:
  282|   697k|{
  283|   697k|    util::internal_error_if(pos < 0, "is::OffsetBuffer offset < 0");
  284|   697k|    auto end_pos = static_cast<qpdf_offset_t>(view_.size());
  285|   697k|    if (pos >= end_pos) {
  ------------------
  |  Branch (285:9): [True: 16.1k, False: 681k]
  ------------------
  286|  16.1k|        last_offset = end_pos + global_offset;
  287|  16.1k|        return 0;
  288|  16.1k|    }
  289|       |
  290|   681k|    last_offset = pos + global_offset;
  291|   681k|    size_t len = std::min(QIntC::to_size(end_pos - pos), length);
  292|   681k|    memcpy(buffer, view_.data() + pos, len);
  293|   681k|    pos += QIntC::to_offset(len);
  294|   681k|    return len;
  295|   697k|}

_ZN17ContentNormalizer11handleTokenERKN13QPDFTokenizer5TokenE:
   10|  1.63M|{
   11|  1.63M|    QPDFTokenizer::token_type_e token_type = token.getType();
   12|       |
   13|  1.63M|    if (token_type == QPDFTokenizer::tt_bad) {
  ------------------
  |  Branch (13:9): [True: 179k, False: 1.45M]
  ------------------
   14|   179k|        this->any_bad_tokens = true;
   15|   179k|        this->last_token_was_bad = true;
   16|  1.45M|    } else if (token_type != QPDFTokenizer::tt_eof) {
  ------------------
  |  Branch (16:16): [True: 1.45M, False: 2.47k]
  ------------------
   17|  1.45M|        this->last_token_was_bad = false;
   18|  1.45M|    }
   19|       |
   20|  1.63M|    switch (token_type) {
   21|   565k|    case QPDFTokenizer::tt_space:
  ------------------
  |  Branch (21:5): [True: 565k, False: 1.07M]
  ------------------
   22|   565k|        {
   23|   565k|            std::string const& value = token.getRawValue();
   24|   565k|            auto size = value.size();
   25|   565k|            size_t pos = 0;
   26|   565k|            auto r_pos = value.find('\r');
   27|   864k|            while (r_pos != std::string::npos) {
  ------------------
  |  Branch (27:20): [True: 307k, False: 556k]
  ------------------
   28|   307k|                if (pos != r_pos) {
  ------------------
  |  Branch (28:21): [True: 6.17k, False: 301k]
  ------------------
   29|  6.17k|                    write(&value[pos], r_pos - pos);
   30|  6.17k|                }
   31|   307k|                if (++r_pos >= size) {
  ------------------
  |  Branch (31:21): [True: 9.10k, False: 298k]
  ------------------
   32|  9.10k|                    write("\n");
   33|  9.10k|                    return;
   34|  9.10k|                }
   35|   298k|                if (value[r_pos] != '\n') {
  ------------------
  |  Branch (35:21): [True: 293k, False: 4.83k]
  ------------------
   36|   293k|                    write("\n");
   37|   293k|                }
   38|   298k|                pos = r_pos;
   39|   298k|                r_pos = value.find('\r', pos);
   40|   298k|            }
   41|   556k|            if (pos < size) {
  ------------------
  |  Branch (41:17): [True: 556k, False: 0]
  ------------------
   42|   556k|                write(&value[pos], size - pos);
   43|   556k|            }
   44|   556k|        }
   45|      0|        return;
   46|       |
   47|  47.1k|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (47:5): [True: 47.1k, False: 1.59M]
  ------------------
   48|       |        // Replacing string and name tokens in this way normalizes their representation as this will
   49|       |        // automatically handle quoting of unprintable characters, etc.
   50|  47.1k|        write(QPDFObjectHandle::newString(token.getValue()).unparse());
   51|  47.1k|        break;
   52|       |
   53|   141k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (53:5): [True: 141k, False: 1.49M]
  ------------------
   54|   141k|        write(Name::normalize(token.getValue()));
   55|   141k|        break;
   56|       |
   57|   883k|    default:
  ------------------
  |  Branch (57:5): [True: 883k, False: 754k]
  ------------------
   58|   883k|        writeToken(token);
   59|   883k|        return;
   60|  1.63M|    }
   61|       |
   62|       |    // tt_string or tt_name
   63|   188k|    std::string const& value = token.getRawValue();
   64|   188k|    if (value.find('\r') != std::string::npos || value.find('\n') != std::string::npos) {
  ------------------
  |  Branch (64:9): [True: 1.87k, False: 186k]
  |  Branch (64:50): [True: 702, False: 185k]
  ------------------
   65|  2.57k|        write("\n");
   66|  2.57k|    }
   67|   188k|}

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

_ZN11InputSource13setLastOffsetEx:
   15|  34.0M|{
   16|  34.0M|    this->last_offset = offset;
   17|  34.0M|}
_ZNK11InputSource13getLastOffsetEv:
   21|  27.7M|{
   22|  27.7M|    return this->last_offset;
   23|  27.7M|}
_ZN11InputSource9read_lineERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   27|  11.0k|{
   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|  11.0k|    read(str, count, at);
   34|  11.0k|    auto eol = str.find_first_of("\n\r"sv);
   35|  11.0k|    if (eol != std::string::npos) {
  ------------------
  |  Branch (35:9): [True: 8.99k, False: 2.09k]
  ------------------
   36|  8.99k|        auto next_line = str.find_first_not_of("\n\r"sv, eol);
   37|  8.99k|        str.resize(eol);
   38|  8.99k|        if (next_line != std::string::npos) {
  ------------------
  |  Branch (38:13): [True: 8.45k, False: 536]
  ------------------
   39|  8.45k|            seek(last_offset + static_cast<qpdf_offset_t>(next_line), SEEK_SET);
   40|  8.45k|            return eol;
   41|  8.45k|        }
   42|  8.99k|    }
   43|       |    // We did not necessarily find the end of the trailing newline sequence.
   44|  2.63k|    seek(last_offset, SEEK_SET);
   45|  2.63k|    findAndSkipNextEOL();
   46|  2.63k|    return eol;
   47|  11.0k|}
_ZN11InputSource8readLineEm:
   51|  11.0k|{
   52|  11.0k|    return read_line(max_line_length);
   53|  11.0k|}
_ZN11InputSource9findFirstEPKcxmRNS_6FinderE:
   65|   101k|{
   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|   101k|    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|   101k|    size_t size = sizeof(buf) - 1;
   79|   101k|    util::assertion(
   80|   101k|        !(strlen(start_chars) < 1 || strlen(start_chars) > size),
  ------------------
  |  Branch (80:11): [True: 0, False: 101k]
  |  Branch (80:38): [True: 0, False: 101k]
  ------------------
   81|   101k|        "InputSource::findSource called with too small or too large of a character sequence" //
   82|   101k|    );
   83|       |
   84|   101k|    char* p = nullptr;
   85|   101k|    qpdf_offset_t buf_offset = offset;
   86|   101k|    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|   618k|    while (true) {
  ------------------
  |  Branch (91:12): [True: 618k, 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|   618k|        if ((p == nullptr) || ((p + strlen(start_chars)) > (buf + bytes_read))) {
  ------------------
  |  Branch (97:13): [True: 101k, False: 516k]
  |  Branch (97:31): [True: 219k, False: 296k]
  ------------------
   98|   321k|            if (p) {
  ------------------
  |  Branch (98:17): [True: 219k, False: 101k]
  ------------------
   99|   219k|                QTC::TC(
  100|   219k|                    "libtests", "InputSource read next block", ((p == buf + bytes_read) ? 0 : 1));
  ------------------
  |  Branch (100:65): [True: 216k, False: 3.63k]
  ------------------
  101|   219k|                buf_offset += (p - buf);
  102|   219k|            }
  103|   321k|            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|   321k|            bytes_read = this->read(buf, size);
  108|   321k|            if (bytes_read < strlen(start_chars)) {
  ------------------
  |  Branch (108:17): [True: 45.3k, False: 276k]
  ------------------
  109|  45.3k|                QTC::TC("libtests", "InputSource find EOF", bytes_read == 0 ? 0 : 1);
  ------------------
  |  Branch (109:61): [True: 39.2k, False: 6.12k]
  ------------------
  110|  45.3k|                return false;
  111|  45.3k|            }
  112|   276k|            memset(buf + bytes_read, '\0', 1 + (size - bytes_read));
  113|   276k|            p = buf;
  114|   276k|        }
  115|       |
  116|       |        // Search for the first character.
  117|   572k|        if ((p = static_cast<char*>(
  ------------------
  |  Branch (117:13): [True: 356k, False: 216k]
  ------------------
  118|       |                 // line-break
  119|   572k|                 memchr(p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) != nullptr) {
  120|   356k|            if (p == buf) {
  ------------------
  |  Branch (120:17): [True: 5.84k, False: 351k]
  ------------------
  121|  5.84k|                QTC::TC("libtests", "InputSource found match at buf[0]");
  122|  5.84k|            }
  123|       |            // Found first letter.
  124|   356k|            if (len != 0) {
  ------------------
  |  Branch (124:17): [True: 25.6k, False: 331k]
  ------------------
  125|       |                // Make sure it's in range.
  126|  25.6k|                size_t p_relative_offset = QIntC::to_size((p - buf) + (buf_offset - offset));
  127|  25.6k|                if (p_relative_offset >= len) {
  ------------------
  |  Branch (127:21): [True: 1.91k, False: 23.7k]
  ------------------
  128|       |                    // out of range
  129|  1.91k|                    QTC::TC("libtests", "InputSource out of range");
  130|  1.91k|                    return false;
  131|  1.91k|                }
  132|  25.6k|            }
  133|   355k|            if ((p + strlen(start_chars)) > (buf + bytes_read)) {
  ------------------
  |  Branch (133:17): [True: 3.08k, False: 351k]
  ------------------
  134|       |                // If there are not enough bytes left in the file for start_chars, we will detect
  135|       |                // this on the next pass as EOF and return.
  136|  3.08k|                QTC::TC("libtests", "InputSource not enough bytes");
  137|  3.08k|                continue;
  138|  3.08k|            }
  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|   351k|            if (strncmp(p, start_chars, strlen(start_chars)) == 0) {
  ------------------
  |  Branch (142:17): [True: 68.7k, False: 283k]
  ------------------
  143|       |                // Call finder.check() with the input source positioned to the point of the match.
  144|  68.7k|                this->seek(buf_offset + (p - buf), SEEK_SET);
  145|  68.7k|                if (finder.check()) {
  ------------------
  |  Branch (145:21): [True: 54.5k, False: 14.1k]
  ------------------
  146|  54.5k|                    return true;
  147|  54.5k|                } else {
  148|  14.1k|                    QTC::TC("libtests", "InputSource start_chars matched but not check");
  149|  14.1k|                }
  150|   283k|            } else {
  151|   283k|                QTC::TC("libtests", "InputSource first char matched but not string");
  152|   283k|            }
  153|       |            // This occurrence of the first character wasn't a match. Skip over it and keep
  154|       |            // searching.
  155|   297k|            ++p;
  156|   297k|        } else {
  157|       |            // Trigger reading the next block
  158|   216k|            p = buf + bytes_read;
  159|   216k|        }
  160|   572k|    }
  161|   101k|}
_ZN11InputSource8findLastEPKcxmRNS_6FinderE:
  165|  22.0k|{
  166|  22.0k|    bool found = false;
  167|  22.0k|    qpdf_offset_t after_found_offset = 0;
  168|  22.0k|    qpdf_offset_t cur_offset = offset;
  169|  22.0k|    size_t cur_len = len;
  170|  27.1k|    while (this->findFirst(start_chars, cur_offset, cur_len, finder)) {
  ------------------
  |  Branch (170:12): [True: 5.07k, False: 22.0k]
  ------------------
  171|  5.07k|        if (found) {
  ------------------
  |  Branch (171:13): [True: 347, False: 4.72k]
  ------------------
  172|    347|            QTC::TC("libtests", "InputSource findLast found more than one");
  173|  4.72k|        } else {
  174|  4.72k|            found = true;
  175|  4.72k|        }
  176|  5.07k|        after_found_offset = this->tell();
  177|  5.07k|        cur_offset = after_found_offset;
  178|  5.07k|        cur_len = len - QIntC::to_size((cur_offset - offset));
  179|  5.07k|    }
  180|  22.0k|    if (found) {
  ------------------
  |  Branch (180:9): [True: 4.72k, False: 17.3k]
  ------------------
  181|       |        this->seek(after_found_offset, SEEK_SET);
  182|  4.72k|    }
  183|  22.0k|    return found;
  184|  22.0k|}
_ZN11InputSource9read_lineEmx:
   57|  11.0k|{
   58|  11.0k|    std::string result(count, '\0');
   59|  11.0k|    read_line(result, count, at);
   60|  11.0k|    return result;
   61|  11.0k|}

_ZN3MD5C2Ev:
   12|   113k|{
   13|   113k|    init();
   14|   113k|}
_ZN3MD54initEv:
   18|   121k|{
   19|   121k|    crypto = QPDFCryptoProvider::getImpl();
   20|   121k|    crypto->MD5_init();
   21|   121k|}
_ZN3MD55resetEv:
   31|  8.50k|{
   32|  8.50k|    init();
   33|  8.50k|}
_ZN3MD512encodeStringEPKc:
   37|  8.38k|{
   38|  8.38k|    size_t len = strlen(str);
   39|  8.38k|    crypto->MD5_init();
   40|  8.38k|    encodeDataIncrementally(str, len);
   41|  8.38k|    crypto->MD5_finalize();
   42|  8.38k|}
_ZN3MD56digestEPh:
   88|   113k|{
   89|   113k|    crypto->MD5_finalize();
   90|   113k|    crypto->MD5_digest(result);
   91|   113k|}
_ZN3MD56digestEv:
   95|    941|{
   96|    941|    Digest digest_val;
   97|    941|    digest(digest_val);
   98|    941|    return {reinterpret_cast<char*>(digest_val), 16};
   99|    941|}
_ZN3MD56digestENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
  103|  5.21k|{
  104|  5.21k|    MD5 m;
  105|  5.21k|    m.encodeDataIncrementally(data.data(), data.size());
  106|  5.21k|    Digest digest_val;
  107|  5.21k|    m.digest(digest_val);
  108|  5.21k|    return {reinterpret_cast<char*>(digest_val), 16};
  109|  5.21k|}
_ZN3MD57unparseEv:
  126|  8.38k|{
  127|  8.38k|    crypto->MD5_finalize();
  128|  8.38k|    Digest digest_val;
  129|  8.38k|    digest(digest_val);
  130|  8.38k|    return QUtil::hex_encode(std::string(reinterpret_cast<char*>(digest_val), 16));
  131|  8.38k|}
_ZN6Pl_MD55writeEPKhm:
  171|  5.07M|{
  172|  5.07M|    if (enabled) {
  ------------------
  |  Branch (172:9): [True: 5.00M, False: 68.9k]
  ------------------
  173|  5.00M|        if (!in_progress) {
  ------------------
  |  Branch (173:13): [True: 8.50k, False: 4.99M]
  ------------------
  174|  8.50k|            md5.reset();
  175|  8.50k|            in_progress = true;
  176|  8.50k|        }
  177|       |
  178|       |        // Write in chunks in case len is too big to fit in an int. Assume int is at least 32 bits.
  179|  5.00M|        static size_t const max_bytes = 1 << 30;
  180|  5.00M|        size_t bytes_left = len;
  181|  5.00M|        unsigned char const* data = buf;
  182|  10.0M|        while (bytes_left > 0) {
  ------------------
  |  Branch (182:16): [True: 5.00M, False: 5.00M]
  ------------------
  183|  5.00M|            size_t bytes = (bytes_left >= max_bytes ? max_bytes : bytes_left);
  ------------------
  |  Branch (183:29): [True: 0, False: 5.00M]
  ------------------
  184|  5.00M|            md5.encodeDataIncrementally(reinterpret_cast<char const*>(data), bytes);
  185|  5.00M|            bytes_left -= bytes;
  186|  5.00M|            data += bytes;
  187|  5.00M|        }
  188|  5.00M|    }
  189|       |
  190|  5.07M|    if (next()) {
  ------------------
  |  Branch (190:9): [True: 5.07M, False: 0]
  ------------------
  191|  5.07M|        next()->write(buf, len);
  192|  5.07M|    }
  193|  5.07M|}

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

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

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

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

_ZN17Pl_ASCII85DecoderC2EPKcP8Pipeline:
   12|  2.35k|    Pipeline(identifier, next)
   13|  2.35k|{
   14|  2.35k|    util::assertion(next, "Attempt to create Pl_ASCII85Decoder with nullptr as next");
   15|  2.35k|}
_ZN17Pl_ASCII85Decoder5writeEPKhm:
   19|  10.9k|{
   20|  10.9k|    if (eod > 1) {
  ------------------
  |  Branch (20:9): [True: 8.45k, False: 2.53k]
  ------------------
   21|  8.45k|        return;
   22|  8.45k|    }
   23|   456k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (23:24): [True: 455k, False: 1.09k]
  ------------------
   24|   455k|        switch (buf[i]) {
  ------------------
  |  Branch (24:17): [True: 3.73k, False: 451k]
  ------------------
   25|    870|        case ' ':
  ------------------
  |  Branch (25:9): [True: 870, False: 454k]
  ------------------
   26|  1.15k|        case '\f':
  ------------------
  |  Branch (26:9): [True: 287, False: 455k]
  ------------------
   27|  1.41k|        case '\v':
  ------------------
  |  Branch (27:9): [True: 256, False: 455k]
  ------------------
   28|  1.73k|        case '\t':
  ------------------
  |  Branch (28:9): [True: 317, False: 455k]
  ------------------
   29|  2.23k|        case '\r':
  ------------------
  |  Branch (29:9): [True: 509, False: 455k]
  ------------------
   30|  3.73k|        case '\n':
  ------------------
  |  Branch (30:9): [True: 1.49k, False: 454k]
  ------------------
   31|  3.73k|            QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
   32|       |            // ignore whitespace
   33|  3.73k|            continue;
   34|   455k|        }
   35|   451k|        if (eod > 1) {
  ------------------
  |  Branch (35:13): [True: 77, False: 451k]
  ------------------
   36|     77|            break;
   37|   451k|        } else if (eod == 1) {
  ------------------
  |  Branch (37:20): [True: 529, False: 451k]
  ------------------
   38|    529|            util::no_ci_rt_error_if(buf[i] != '>', "broken end-of-data sequence in base 85 data");
   39|    529|            flush();
   40|    529|            eod = 2;
   41|   451k|        } else {
   42|   451k|            switch (buf[i]) {
   43|    581|            case '~':
  ------------------
  |  Branch (43:13): [True: 581, False: 450k]
  ------------------
   44|    581|                eod = 1;
   45|    581|                break;
   46|       |
   47|  2.02k|            case 'z':
  ------------------
  |  Branch (47:13): [True: 2.02k, False: 449k]
  ------------------
   48|  2.02k|                if (pos != 0) {
  ------------------
  |  Branch (48:21): [True: 40, False: 1.98k]
  ------------------
   49|     40|                    throw std::runtime_error("unexpected z during base 85 decode");
   50|     40|                }
   51|  1.98k|                unsigned char zeroes[4];
   52|  1.98k|                memset(zeroes, '\0', 4);
   53|  1.98k|                next()->write(zeroes, 4);
   54|  1.98k|                break;
   55|       |
   56|   448k|            default:
  ------------------
  |  Branch (56:13): [True: 448k, False: 2.60k]
  ------------------
   57|   448k|                if (buf[i] < 33 || buf[i] > 117) {
  ------------------
  |  Branch (57:21): [True: 240, False: 448k]
  |  Branch (57:36): [True: 954, False: 447k]
  ------------------
   58|  1.19k|                    error = true;
   59|  1.19k|                    throw std::runtime_error("character out of range during base 85 decode");
   60|   447k|                } else {
   61|   447k|                    this->inbuf[this->pos++] = buf[i];
   62|   447k|                    if (pos == 5) {
  ------------------
  |  Branch (62:25): [True: 88.7k, False: 358k]
  ------------------
   63|  88.7k|                        flush();
   64|  88.7k|                    }
   65|   447k|                }
   66|   447k|                break;
   67|   451k|            }
   68|   451k|        }
   69|   451k|    }
   70|  2.53k|}
_ZN17Pl_ASCII85Decoder5flushEv:
   74|  90.5k|{
   75|  90.5k|    if (this->pos == 0) {
  ------------------
  |  Branch (75:9): [True: 981, False: 89.5k]
  ------------------
   76|    981|        return;
   77|    981|    }
   78|  89.5k|    unsigned long lval = 0;
   79|   537k|    for (int i = 0; i < 5; ++i) {
  ------------------
  |  Branch (79:21): [True: 447k, False: 89.5k]
  ------------------
   80|   447k|        lval *= 85;
   81|   447k|        lval += (this->inbuf[i] - 33U);
   82|   447k|    }
   83|       |
   84|  89.5k|    unsigned char outbuf[4];
   85|  89.5k|    memset(outbuf, 0, 4);
   86|   447k|    for (int i = 3; i >= 0; --i) {
  ------------------
  |  Branch (86:21): [True: 358k, False: 89.5k]
  ------------------
   87|   358k|        outbuf[i] = lval & 0xff;
   88|   358k|        lval >>= 8;
   89|   358k|    }
   90|       |
   91|  89.5k|    QTC::TC("libtests", "Pl_ASCII85Decoder partial flush", (this->pos == 5) ? 0 : 1);
  ------------------
  |  Branch (91:60): [True: 88.7k, False: 765]
  ------------------
   92|       |    // Reset before calling getNext()->write in case that throws an exception.
   93|  89.5k|    auto t = this->pos - 1;
   94|  89.5k|    this->pos = 0;
   95|  89.5k|    memset(this->inbuf, 117, 5);
   96|       |
   97|  89.5k|    next()->write(outbuf, t);
   98|  89.5k|}
_ZN17Pl_ASCII85Decoder6finishEv:
  102|  2.11k|{
  103|  2.11k|    if (error) {
  ------------------
  |  Branch (103:9): [True: 851, False: 1.26k]
  ------------------
  104|    851|        return;
  105|    851|    }
  106|  1.26k|    flush();
  107|  1.26k|    next()->finish();
  108|  1.26k|}

_ZN18Pl_ASCIIHexDecoderC2EPKcP8Pipeline:
   13|  2.06k|    Pipeline(identifier, next)
   14|  2.06k|{
   15|  2.06k|    util::assertion(next, "Attempt to create Pl_ASCIIHexDecoder with nullptr as next");
   16|  2.06k|}
_ZN18Pl_ASCIIHexDecoder5writeEPKhm:
   20|  2.62k|{
   21|  2.62k|    if (eod) {
  ------------------
  |  Branch (21:9): [True: 278, False: 2.34k]
  ------------------
   22|    278|        return;
   23|    278|    }
   24|   271k|    for (size_t i = 0; i < len; ++i) {
  ------------------
  |  Branch (24:24): [True: 270k, False: 604]
  ------------------
   25|   270k|        char ch = static_cast<char>(toupper(buf[i]));
   26|   270k|        switch (ch) {
   27|  3.41k|        case ' ':
  ------------------
  |  Branch (27:9): [True: 3.41k, False: 267k]
  ------------------
   28|  3.70k|        case '\f':
  ------------------
  |  Branch (28:9): [True: 286, False: 270k]
  ------------------
   29|  4.16k|        case '\v':
  ------------------
  |  Branch (29:9): [True: 461, False: 270k]
  ------------------
   30|  4.46k|        case '\t':
  ------------------
  |  Branch (30:9): [True: 298, False: 270k]
  ------------------
   31|  5.61k|        case '\r':
  ------------------
  |  Branch (31:9): [True: 1.15k, False: 269k]
  ------------------
   32|  6.03k|        case '\n':
  ------------------
  |  Branch (32:9): [True: 422, False: 270k]
  ------------------
   33|  6.03k|            QTC::TC("libtests", "Pl_ASCIIHexDecoder ignore space");
   34|       |            // ignore whitespace
   35|  6.03k|            break;
   36|       |
   37|     89|        case '>':
  ------------------
  |  Branch (37:9): [True: 89, False: 270k]
  ------------------
   38|     89|            eod = true;
   39|     89|            flush();
   40|     89|            break;
   41|       |
   42|   264k|        default:
  ------------------
  |  Branch (42:9): [True: 264k, False: 6.12k]
  ------------------
   43|   264k|            if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F')) {
  ------------------
  |  Branch (43:18): [True: 263k, False: 1.08k]
  |  Branch (43:31): [True: 148k, False: 115k]
  |  Branch (43:46): [True: 115k, False: 1.15k]
  |  Branch (43:59): [True: 114k, False: 497]
  ------------------
   44|   263k|                inbuf[pos++] = ch;
   45|   263k|                if (pos == 2) {
  ------------------
  |  Branch (45:21): [True: 131k, False: 131k]
  ------------------
   46|   131k|                    flush();
   47|   131k|                }
   48|   263k|            } else {
   49|  1.65k|                char t[2];
   50|  1.65k|                t[0] = ch;
   51|  1.65k|                t[1] = 0;
   52|  1.65k|                throw std::runtime_error("character out of range during base Hex decode: "s + t);
   53|  1.65k|            }
   54|   263k|            break;
   55|   270k|        }
   56|   269k|        if (eod) {
  ------------------
  |  Branch (56:13): [True: 87, False: 269k]
  ------------------
   57|     87|            break;
   58|     87|        }
   59|   269k|    }
   60|  2.34k|}
_ZN18Pl_ASCIIHexDecoder5flushEv:
   64|   132k|{
   65|   132k|    if (pos == 0) {
  ------------------
  |  Branch (65:9): [True: 1.04k, False: 131k]
  ------------------
   66|  1.04k|        QTC::TC("libtests", "Pl_ASCIIHexDecoder no-op flush");
   67|  1.04k|        return;
   68|  1.04k|    }
   69|   131k|    int b[2];
   70|   395k|    for (int i = 0; i < 2; ++i) {
  ------------------
  |  Branch (70:21): [True: 263k, False: 131k]
  ------------------
   71|   263k|        if (inbuf[i] >= 'A') {
  ------------------
  |  Branch (71:13): [True: 114k, False: 149k]
  ------------------
   72|   114k|            b[i] = inbuf[i] - 'A' + 10;
   73|   149k|        } else {
   74|   149k|            b[i] = inbuf[i] - '0';
   75|   149k|        }
   76|   263k|    }
   77|   131k|    auto ch = static_cast<unsigned char>((b[0] << 4) + b[1]);
   78|       |
   79|   131k|    QTC::TC("libtests", "Pl_ASCIIHexDecoder partial flush", (pos == 2) ? 0 : 1);
  ------------------
  |  Branch (79:61): [True: 131k, False: 786]
  ------------------
   80|       |    // Reset before calling getNext()->write in case that throws an exception.
   81|   131k|    pos = 0;
   82|   131k|    inbuf[0] = '0';
   83|   131k|    inbuf[1] = '0';
   84|   131k|    inbuf[2] = '\0';
   85|       |
   86|   131k|    next()->write(&ch, 1);
   87|   131k|}
_ZN18Pl_ASCIIHexDecoder6finishEv:
   91|  1.74k|{
   92|  1.74k|    flush();
   93|  1.74k|    next()->finish();
   94|  1.74k|}

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

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

_ZN10Pl_DiscardC2Ev:
    9|  22.0k|    Pipeline("discard", nullptr)
   10|  22.0k|{
   11|  22.0k|}
_ZN10Pl_DiscardD2Ev:
   14|  22.0k|Pl_Discard::~Pl_Discard() = default;
_ZN10Pl_Discard5writeEPKhm:
   18|  5.07M|{
   19|  5.07M|}
_ZN10Pl_Discard6finishEv:
   23|  16.8k|{
   24|  16.8k|}

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

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

_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|  2.35M|{
   30|  2.35M|    m->os.write(reinterpret_cast<char const*>(buf), static_cast<std::streamsize>(len));
   31|  2.35M|}
_ZN10Pl_OStream6finishEv:
   35|      2|{
   36|      2|    m->os.flush();
   37|      2|}
_ZN10Pl_OStream7MembersC2ERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE:
    9|      2|        os(os)
   10|      2|    {
   11|      2|    }

_ZN12Pl_PNGFilterC2EPKcP8PipelineNS_8action_eEjjj:
   30|  1.64k|    Pipeline(identifier, next),
   31|  1.64k|    action(action)
   32|  1.64k|{
   33|  1.64k|    util::assertion(next, "Attempt to create Pl_PNGFilter with nullptr as next");
   34|  1.64k|    util::no_ci_rt_error_if(
   35|  1.64k|        samples_per_pixel < 1, "PNGFilter created with invalid samples_per_pixel");
   36|  1.64k|    util::no_ci_rt_error_if(
   37|  1.64k|        !(bits_per_sample == 1 || bits_per_sample == 2 || bits_per_sample == 4 ||
  ------------------
  |  Branch (37:11): [True: 74, False: 1.57k]
  |  Branch (37:35): [True: 66, False: 1.50k]
  |  Branch (37:59): [True: 69, False: 1.43k]
  ------------------
   38|  1.43k|          bits_per_sample == 8 || bits_per_sample == 16),
  ------------------
  |  Branch (38:11): [True: 1.40k, False: 36]
  |  Branch (38:35): [True: 15, False: 21]
  ------------------
   39|  1.64k|        "PNGFilter created with invalid bits_per_sample not 1, 2, 4, 8, or 16");
   40|  1.64k|    auto bits_per_pixel = 1ULL * bits_per_sample * samples_per_pixel;
   41|  1.64k|    util::no_ci_rt_error_if(
   42|  1.64k|        !util::fits<uint32_t>(bits_per_pixel + 7),
   43|  1.64k|        "PNGFilter created with bits_per_sample and samples_per_pixel values that cause overflow");
   44|  1.64k|    util::no_ci_rt_error_if(
   45|  1.64k|        !util::fits<uint32_t>(columns),
   46|  1.64k|        "PNGFilter created with columns value that causes overflow");
   47|  1.64k|    bytes_per_pixel = static_cast<uint32_t>((bits_per_pixel + 7) / 8);
   48|  1.64k|    auto bpr = ((columns * bits_per_pixel) + 7) / 8;
   49|  1.64k|    util::no_ci_rt_error_if(
   50|  1.64k|        bpr == 0 || !util::fits<uint32_t>(bpr), "PNGFilter created with invalid columns value");
  ------------------
  |  Branch (50:9): [True: 29, False: 1.61k]
  |  Branch (50:21): [True: 3, False: 1.61k]
  ------------------
   51|  1.64k|    util::no_ci_rt_error_if(
   52|  1.64k|        memory_limit > 0 && bpr > (memory_limit / 2U), "PNGFilter memory limit exceeded");
  ------------------
  |  Branch (52:9): [True: 1.61k, False: 32]
  |  Branch (52:29): [True: 16, False: 1.59k]
  ------------------
   53|  1.64k|    bytes_per_row = static_cast<uint32_t>(bpr);
   54|  1.64k|    buf1 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   55|  1.64k|    buf2 = QUtil::make_shared_array<unsigned char>(bytes_per_row + 1);
   56|  1.64k|    memset(buf1.get(), 0, bytes_per_row + 1);
   57|  1.64k|    memset(buf2.get(), 0, bytes_per_row + 1);
   58|  1.64k|    cur_row = buf1.get();
   59|  1.64k|    prev_row = buf2.get();
   60|       |
   61|       |    // number of bytes per incoming row
   62|  1.64k|    incoming = (action == a_encode ? bytes_per_row : bytes_per_row + 1);
  ------------------
  |  Branch (62:17): [True: 0, False: 1.64k]
  ------------------
   63|  1.64k|}
_ZN12Pl_PNGFilter5writeEPKhm:
   73|   159k|{
   74|   159k|    size_t left = incoming - pos;
   75|   159k|    size_t offset = 0;
   76|  2.38M|    while (len >= left) {
  ------------------
  |  Branch (76:12): [True: 2.22M, False: 159k]
  ------------------
   77|       |        // finish off current row
   78|  2.22M|        memcpy(cur_row + pos, data + offset, left);
   79|  2.22M|        offset += left;
   80|  2.22M|        len -= left;
   81|       |
   82|  2.22M|        processRow();
   83|       |
   84|       |        // Swap rows
   85|  2.22M|        unsigned char* t = prev_row;
   86|  2.22M|        prev_row = cur_row;
   87|  2.22M|        cur_row = t ? t : buf2.get();
  ------------------
  |  Branch (87:19): [True: 2.22M, False: 5]
  ------------------
   88|  2.22M|        memset(cur_row, 0, bytes_per_row + 1);
   89|  2.22M|        left = incoming;
   90|  2.22M|        pos = 0;
   91|  2.22M|    }
   92|   159k|    if (len) {
  ------------------
  |  Branch (92:9): [True: 158k, False: 927]
  ------------------
   93|   158k|        memcpy(cur_row + pos, data + offset, len);
   94|   158k|    }
   95|   159k|    pos += len;
   96|   159k|}
_ZN12Pl_PNGFilter10processRowEv:
  100|  2.23M|{
  101|  2.23M|    if (action == a_encode) {
  ------------------
  |  Branch (101:9): [True: 0, False: 2.23M]
  ------------------
  102|      0|        encodeRow();
  103|  2.23M|    } else {
  104|  2.23M|        decodeRow();
  105|  2.23M|    }
  106|  2.23M|}
_ZN12Pl_PNGFilter9decodeRowEv:
  110|  2.23M|{
  111|  2.23M|    int filter = cur_row[0];
  112|  2.23M|    if (prev_row) {
  ------------------
  |  Branch (112:9): [True: 2.23M, False: 0]
  ------------------
  113|  2.23M|        switch (filter) {
  114|   446k|        case 0:
  ------------------
  |  Branch (114:9): [True: 446k, False: 1.78M]
  ------------------
  115|   446k|            break;
  116|   158k|        case 1:
  ------------------
  |  Branch (116:9): [True: 158k, False: 2.07M]
  ------------------
  117|   158k|            decodeSub();
  118|   158k|            break;
  119|   823k|        case 2:
  ------------------
  |  Branch (119:9): [True: 823k, False: 1.40M]
  ------------------
  120|   823k|            decodeUp();
  121|   823k|            break;
  122|  5.17k|        case 3:
  ------------------
  |  Branch (122:9): [True: 5.17k, False: 2.22M]
  ------------------
  123|  5.17k|            decodeAverage();
  124|  5.17k|            break;
  125|  2.33k|        case 4:
  ------------------
  |  Branch (125:9): [True: 2.33k, False: 2.22M]
  ------------------
  126|  2.33k|            decodePaeth();
  127|  2.33k|            break;
  128|   794k|        default:
  ------------------
  |  Branch (128:9): [True: 794k, False: 1.43M]
  ------------------
  129|       |            // ignore
  130|   794k|            break;
  131|  2.23M|        }
  132|  2.23M|    }
  133|       |
  134|  2.23M|    next()->write(cur_row + 1, bytes_per_row);
  135|  2.23M|}
_ZN12Pl_PNGFilter9decodeSubEv:
  139|   158k|{
  140|   158k|    unsigned char* buffer = cur_row + 1;
  141|   158k|    unsigned int bpp = bytes_per_pixel;
  142|       |
  143|   726k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (143:30): [True: 567k, False: 158k]
  ------------------
  144|   567k|        unsigned char left = 0;
  145|       |
  146|   567k|        if (i >= bpp) {
  ------------------
  |  Branch (146:13): [True: 408k, False: 158k]
  ------------------
  147|   408k|            left = buffer[i - bpp];
  148|   408k|        }
  149|       |
  150|   567k|        buffer[i] = static_cast<unsigned char>(buffer[i] + left);
  151|   567k|    }
  152|   158k|}
_ZN12Pl_PNGFilter8decodeUpEv:
  156|   823k|{
  157|   823k|    unsigned char* buffer = cur_row + 1;
  158|   823k|    unsigned char* above_buffer = prev_row + 1;
  159|       |
  160|  3.25M|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (160:30): [True: 2.43M, False: 823k]
  ------------------
  161|  2.43M|        unsigned char up = above_buffer[i];
  162|  2.43M|        buffer[i] = static_cast<unsigned char>(buffer[i] + up);
  163|  2.43M|    }
  164|   823k|}
_ZN12Pl_PNGFilter13decodeAverageEv:
  168|  5.17k|{
  169|  5.17k|    unsigned char* buffer = cur_row + 1;
  170|  5.17k|    unsigned char* above_buffer = prev_row + 1;
  171|  5.17k|    auto bpp = bytes_per_pixel;
  172|       |
  173|   829k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (173:30): [True: 824k, False: 5.17k]
  ------------------
  174|   824k|        int left = 0;
  175|   824k|        int up = 0;
  176|       |
  177|   824k|        if (i >= bpp) {
  ------------------
  |  Branch (177:13): [True: 20.2k, False: 803k]
  ------------------
  178|  20.2k|            left = buffer[i - bpp];
  179|  20.2k|        }
  180|       |
  181|   824k|        up = above_buffer[i];
  182|   824k|        buffer[i] = static_cast<unsigned char>(buffer[i] + (left + up) / 2);
  183|   824k|    }
  184|  5.17k|}
_ZN12Pl_PNGFilter11decodePaethEv:
  188|  2.33k|{
  189|  2.33k|    unsigned char* buffer = cur_row + 1;
  190|  2.33k|    unsigned char* above_buffer = prev_row + 1;
  191|  2.33k|    auto bpp = bytes_per_pixel;
  192|       |
  193|   625k|    for (unsigned int i = 0; i < bytes_per_row; ++i) {
  ------------------
  |  Branch (193:30): [True: 623k, False: 2.33k]
  ------------------
  194|   623k|        int left = 0;
  195|   623k|        int up = above_buffer[i];
  196|   623k|        int upper_left = 0;
  197|       |
  198|   623k|        if (i >= bpp) {
  ------------------
  |  Branch (198:13): [True: 445k, False: 177k]
  ------------------
  199|   445k|            left = buffer[i - bpp];
  200|   445k|            upper_left = above_buffer[i - bpp];
  201|   445k|        }
  202|       |
  203|   623k|        buffer[i] = static_cast<unsigned char>(buffer[i] + PaethPredictor(left, up, upper_left));
  204|   623k|    }
  205|  2.33k|}
_ZN12Pl_PNGFilter14PaethPredictorEiii:
  209|   623k|{
  210|   623k|    int p = a + b - c;
  211|   623k|    int pa = abs_diff(p, a);
  212|   623k|    int pb = abs_diff(p, b);
  213|   623k|    int pc = abs_diff(p, c);
  214|       |
  215|   623k|    if (pa <= pb && pa <= pc) {
  ------------------
  |  Branch (215:9): [True: 613k, False: 9.22k]
  |  Branch (215:21): [True: 613k, False: 727]
  ------------------
  216|   613k|        return a;
  217|   613k|    }
  218|  9.94k|    if (pb <= pc) {
  ------------------
  |  Branch (218:9): [True: 8.93k, False: 1.00k]
  ------------------
  219|  8.93k|        return b;
  220|  8.93k|    }
  221|  1.00k|    return c;
  222|  9.94k|}
_ZN12Pl_PNGFilter6finishEv:
  242|  1.58k|{
  243|  1.58k|    if (pos) {
  ------------------
  |  Branch (243:9): [True: 646, False: 940]
  ------------------
  244|       |        // write partial row
  245|    646|        processRow();
  246|    646|    }
  247|  1.58k|    prev_row = nullptr;
  248|  1.58k|    cur_row = buf1.get();
  249|  1.58k|    pos = 0;
  250|  1.58k|    memset(cur_row, 0, bytes_per_row + 1);
  251|       |
  252|  1.58k|    next()->finish();
  253|  1.58k|}
Pl_PNGFilter.cc:_ZL8abs_diffii:
   19|  1.86M|{
   20|  1.86M|    return a > b ? a - b : b - a;
  ------------------
  |  Branch (20:12): [True: 869k, False: 1.00M]
  ------------------
   21|  1.86M|}

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

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

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

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

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

_ZN4QPDF15StringDecrypterC2EPS_10QPDFObjGen:
  118|   124k|    qpdf(qpdf),
  119|   124k|    og(og)
  120|   124k|{
  121|   124k|}
_ZN4QPDF7MembersC2ERS_:
  131|  22.0k|    Doc(qpdf, this),
  132|  22.0k|    c(qpdf, this),
  133|  22.0k|    lin(*this),
  134|  22.0k|    objects(*this),
  135|  22.0k|    pages(*this),
  136|  22.0k|    file(std::make_shared<InvalidInputSource>()),
  137|  22.0k|    encp(std::make_shared<EncryptionParameters>())
  138|  22.0k|{
  139|  22.0k|}
_ZN4QPDFC2Ev:
  142|  22.0k|    m(std::make_unique<Members>(*this))
  143|  22.0k|{
  144|  22.0k|    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|  22.0k|    static std::atomic<unsigned long long> unique_id{0};
  148|  22.0k|    m->unique_id = unique_id.fetch_add(1ULL);
  149|  22.0k|}
_ZN4QPDFD2Ev:
  186|  22.0k|{
  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|  22.0k|    m->xref_table.clear();
  200|  1.02M|    for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (200:26): [True: 1.02M, False: 22.0k]
  ------------------
  201|  1.02M|        Disconnect(iter.second.object).disconnect();
  202|  1.02M|    }
  203|  22.0k|}
_ZN4QPDF18processInputSourceENSt3__110shared_ptrI11InputSourceEEPKc:
  235|  22.0k|{
  236|  22.0k|    m->file = source;
  237|  22.0k|    m->objects.parse(password);
  238|  22.0k|}
_ZN4QPDF4warnERK7QPDFExc:
  337|   451k|{
  338|   451k|    m->c.warn(e);
  339|   451k|}
_ZN4QPDF3Doc6Common4warnERK7QPDFExc:
  343|   807k|{
  344|   807k|    if (cf.max_warnings() > 0 && m->warnings.size() >= cf.max_warnings()) {
  ------------------
  |  Branch (344:9): [True: 683k, False: 123k]
  |  Branch (344:34): [True: 26.1k, False: 657k]
  ------------------
  345|  26.1k|        stopOnError("Too many warnings - file is too badly damaged");
  346|  26.1k|    }
  347|   807k|    m->warnings.emplace_back(e);
  348|   807k|    if (!cf.suppress_warnings()) {
  ------------------
  |  Branch (348:9): [True: 780k, False: 26.1k]
  ------------------
  349|   780k|        *cf.log()->getWarn() << "WARNING: " << m->warnings.back().what() << "\n";
  350|   780k|    }
  351|   807k|}
_ZN4QPDF4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEExS9_:
  359|  5.74k|{
  360|  5.74k|    m->c.warn(QPDFExc(error_code, getFilename(), object, offset, message));
  361|  5.74k|}
_ZN4QPDF3Doc6Common4warnE17qpdf_error_code_eRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEExSB_:
  369|  1.19k|{
  370|  1.19k|    warn(QPDFExc(error_code, qpdf.getFilename(), object, offset, message));
  371|  1.19k|}
_ZN4QPDF9getObjectEii:
  410|  38.1k|{
  411|  38.1k|    return getObject({objid, generation});
  412|  38.1k|}
_ZNK4QPDF11getFilenameEv:
  625|  81.3k|{
  626|  81.3k|    return m->file->getName();
  627|  81.3k|}
_ZNK4QPDF13getPDFVersionEv:
  648|  8.57k|{
  649|  8.57k|    return m->pdf_version;
  650|  8.57k|}
_ZN4QPDF17getExtensionLevelEv:
  654|  8.57k|{
  655|  8.57k|    if (Integer ExtensionLevel = getRoot()["/Extensions"]["/ADBE"]["/ExtensionLevel"]) {
  ------------------
  |  Branch (655:17): [True: 33, False: 8.54k]
  ------------------
  656|     33|        return ExtensionLevel.value<int>();
  657|     33|    }
  658|  8.54k|    return 0;
  659|  8.57k|}
_ZN4QPDF10getTrailerEv:
  663|  33.6k|{
  664|  33.6k|    return m->trailer;
  665|  33.6k|}
_ZN4QPDF7getRootEv:
  669|  59.1k|{
  670|  59.1k|    Dictionary Root = m->trailer["/Root"];
  671|  59.1k|    if (!Root) {
  ------------------
  |  Branch (671:9): [True: 4.66k, False: 54.4k]
  ------------------
  672|  4.66k|        throw m->c.damagedPDF("", -1, "unable to find /Root dictionary");
  673|  4.66k|    }
  674|  54.4k|    if (!m->objects.root_checked()) {
  ------------------
  |  Branch (674:9): [True: 10.2k, False: 44.2k]
  ------------------
  675|  10.2k|        m->objects.root_checked(true);
  676|  10.2k|        if (Name(Root["/Type"]) != "/Catalog") {
  ------------------
  |  Branch (676:13): [True: 2.73k, False: 7.49k]
  ------------------
  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|  10.2k|    }
  684|  54.4k|    return Root.oh();
  685|  59.1k|}
_ZN4QPDF3Doc7Objects10xref_tableEv:
  695|  8.57k|{
  696|  8.57k|    util::assertion(m->parsed, "QPDF::getXRefTable called before parsing");
  697|  8.57k|    return m->xref_table;
  698|  8.57k|}
_ZN4QPDF14pipeStreamDataENSt3__110shared_ptrINS_20EncryptionParametersEEENS1_I11InputSourceEERS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  713|  45.4k|{
  714|  45.4k|    std::unique_ptr<Pipeline> to_delete;
  715|  45.4k|    if (encp->encrypted) {
  ------------------
  |  Branch (715:9): [True: 8.43k, False: 37.0k]
  ------------------
  716|  8.43k|        decryptStream(
  717|  8.43k|            encp, file, qpdf_for_warning, pipeline, og, stream_dict, is_root_metadata, to_delete);
  718|  8.43k|    }
  719|       |
  720|  45.4k|    bool attempted_finish = false;
  721|  45.4k|    try {
  722|  45.4k|        auto buf = file->read(length, offset);
  723|  45.4k|        if (buf.size() != length) {
  ------------------
  |  Branch (723:13): [True: 0, False: 45.4k]
  ------------------
  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|  45.4k|        pipeline->write(buf.data(), length);
  731|  45.4k|        attempted_finish = true;
  732|  45.4k|        pipeline->finish();
  733|  45.4k|        return true;
  734|  45.4k|    } 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|  13.3k|    } catch (std::exception& e) {
  739|  13.3k|        if (!suppress_warnings) {
  ------------------
  |  Branch (739:13): [True: 13.3k, False: 0]
  ------------------
  740|  13.3k|            QTC::TC("qpdf", "QPDF decoding error warning");
  741|  13.3k|            qpdf_for_warning.warn(
  742|       |                // line-break
  743|  13.3k|                qpdf_for_warning.m->c.damagedPDF(
  744|  13.3k|                    *file,
  745|  13.3k|                    "",
  746|  13.3k|                    file->getLastOffset(),
  747|  13.3k|                    ("error decoding stream data for object " + og.unparse(' ') + ": " +
  748|  13.3k|                     e.what())));
  749|  13.3k|            if (will_retry) {
  ------------------
  |  Branch (749:17): [True: 12.2k, False: 1.04k]
  ------------------
  750|  12.2k|                qpdf_for_warning.warn(
  751|       |                    // line-break
  752|  12.2k|                    qpdf_for_warning.m->c.damagedPDF(
  753|  12.2k|                        *file,
  754|  12.2k|                        "",
  755|  12.2k|                        file->getLastOffset(),
  756|  12.2k|                        "stream will be re-processed without filtering to avoid data loss"));
  757|  12.2k|            }
  758|  13.3k|        }
  759|  13.3k|    }
  760|  13.2k|    if (!attempted_finish) {
  ------------------
  |  Branch (760:9): [True: 7.14k, False: 6.11k]
  ------------------
  761|  7.14k|        try {
  762|  7.14k|            pipeline->finish();
  763|  7.14k|        } catch (std::exception&) {
  764|       |            // ignore
  765|  4.86k|        }
  766|  7.14k|    }
  767|  13.2k|    return false;
  768|  13.2k|}
_ZN4QPDF14pipeStreamDataE10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
  780|  45.4k|{
  781|  45.4k|    return pipeStreamData(
  782|  45.4k|        m->encp,
  783|  45.4k|        m->file,
  784|  45.4k|        *this,
  785|  45.4k|        og,
  786|  45.4k|        offset,
  787|  45.4k|        length,
  788|  45.4k|        stream_dict,
  789|  45.4k|        is_root_metadata,
  790|  45.4k|        pipeline,
  791|  45.4k|        suppress_warnings,
  792|  45.4k|        will_retry);
  793|  45.4k|}
_ZN4QPDF3Doc6Common11stopOnErrorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  799|  26.1k|{
  800|  26.1k|    throw damagedPDF("", message);
  801|  26.1k|}
_ZN4QPDF3Doc6Common10damagedPDFER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEExSC_:
  807|  84.3k|{
  808|  84.3k|    return {qpdf_e_damaged_pdf, input.getName(), object, offset, message, true};
  809|  84.3k|}
_ZNK4QPDF3Doc6Common10damagedPDFER11InputSourcexRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  815|  58.8k|{
  816|  58.8k|    return damagedPDF(input, m->last_object_description, offset, message);
  817|  58.8k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEExSA_:
  823|   298k|{
  824|   298k|    return {qpdf_e_damaged_pdf, m->file->getName(), object, offset, message, true};
  825|   298k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  831|  78.0k|{
  832|  78.0k|    return damagedPDF(object, m->file->getLastOffset(), message);
  833|  78.0k|}
_ZNK4QPDF3Doc6Common10damagedPDFExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  839|  59.6k|{
  840|  59.6k|    return damagedPDF(m->last_object_description, offset, message);
  841|  59.6k|}
_ZNK4QPDF3Doc6Common10damagedPDFERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  847|  44.1k|{
  848|  44.1k|    return damagedPDF(m->last_object_description, m->file->getLastOffset(), message);
  849|  44.1k|}
_ZN10DisconnectC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  172|  1.02M|        BaseHandle(obj)
  173|  1.02M|    {
  174|  1.02M|    }
_ZN10Disconnect10disconnectEv:
  177|  1.02M|    {
  178|  1.02M|        BaseHandle::disconnect(false);
  179|  1.02M|        if (raw_type_code() != ::ot_null) {
  ------------------
  |  Branch (179:13): [True: 143k, False: 881k]
  ------------------
  180|   143k|            obj->value = QPDF_Destroyed();
  181|   143k|        }
  182|  1.02M|    }

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

_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_:
    9|   430k|    std::runtime_error(createWhat(filename, object, (offset ? offset : -1), message)),
  ------------------
  |  Branch (9:54): [True: 370k, False: 60.1k]
  ------------------
   10|   430k|    error_code(error_code),
   11|   430k|    filename(filename),
   12|   430k|    object(object),
   13|   430k|    offset(offset ? offset : -1),
  ------------------
  |  Branch (13:12): [True: 370k, False: 60.1k]
  ------------------
   14|   430k|    message(message)
   15|   430k|{
   16|   430k|}
_ZN7QPDFExcC2E17qpdf_error_code_eRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_xS9_b:
   25|   401k|    std::runtime_error(
   26|   401k|        createWhat(filename, object, (offset || zero_offset_valid ? offset : -1), message)),
  ------------------
  |  Branch (26:39): [True: 401k, False: 45]
  |  Branch (26:49): [True: 45, False: 0]
  ------------------
   27|   401k|    error_code(error_code),
   28|   401k|    filename(filename),
   29|   401k|    object(object),
   30|   401k|    offset(offset || zero_offset_valid ? offset : -1),
  ------------------
  |  Branch (30:12): [True: 401k, False: 45]
  |  Branch (30:22): [True: 45, False: 0]
  ------------------
   31|   401k|    message(message)
   32|   401k|{
   33|   401k|}
_ZN7QPDFExc10createWhatERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_xS8_:
   41|   832k|{
   42|   832k|    std::string result;
   43|   832k|    if (!filename.empty()) {
  ------------------
  |  Branch (43:9): [True: 772k, False: 59.6k]
  ------------------
   44|   772k|        result += filename;
   45|   772k|    }
   46|   832k|    if (!(object.empty() && offset < 0)) {
  ------------------
  |  Branch (46:11): [True: 172k, False: 660k]
  |  Branch (46:29): [True: 109k, False: 62.1k]
  ------------------
   47|   722k|        if (!filename.empty()) {
  ------------------
  |  Branch (47:13): [True: 662k, False: 59.5k]
  ------------------
   48|   662k|            result += " (";
   49|   662k|        }
   50|   722k|        if (!object.empty()) {
  ------------------
  |  Branch (50:13): [True: 660k, False: 62.1k]
  ------------------
   51|   660k|            result += object;
   52|   660k|            if (offset >= 0) {
  ------------------
  |  Branch (52:17): [True: 600k, False: 59.9k]
  ------------------
   53|   600k|                result += ", ";
   54|   600k|            }
   55|   660k|        }
   56|   722k|        if (offset >= 0) {
  ------------------
  |  Branch (56:13): [True: 662k, False: 59.9k]
  ------------------
   57|   662k|            result += "offset " + std::to_string(offset);
   58|   662k|        }
   59|   722k|        if (!filename.empty()) {
  ------------------
  |  Branch (59:13): [True: 662k, False: 59.5k]
  ------------------
   60|   662k|            result += ")";
   61|   662k|        }
   62|   722k|    }
   63|   832k|    if (!result.empty()) {
  ------------------
  |  Branch (63:9): [True: 831k, False: 131]
  ------------------
   64|   831k|        result += ": ";
   65|   831k|    }
   66|   832k|    result += message;
   67|   832k|    return result;
   68|   832k|}

_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|  27.2k|{
   78|  27.2k|    static auto l = create();
   79|  27.2k|    return l;
   80|  27.2k|}
_ZN10QPDFLogger4warnEPKc:
  102|     24|{
  103|     24|    getWarn(false)->writeCStr(s);
  104|     24|}
_ZN10QPDFLogger7getWarnEb:
  114|   781k|{
  115|   781k|    if (m->p_warn) {
  ------------------
  |  Branch (115:9): [True: 0, False: 781k]
  ------------------
  116|      0|        return m->p_warn;
  117|      0|    }
  118|   781k|    return getError(null_okay);
  119|   781k|}
_ZN10QPDFLogger8getErrorEb:
  135|   786k|{
  136|   786k|    return throwIfNull(m->p_error, null_okay);
  137|   786k|}
_ZN10QPDFLogger11throwIfNullENSt3__110shared_ptrI8PipelineEEb:
  254|   786k|{
  255|   786k|    if (!(null_okay || p)) {
  ------------------
  |  Branch (255:11): [True: 0, False: 786k]
  |  Branch (255:24): [True: 786k, False: 0]
  ------------------
  256|      0|        throw std::logic_error("QPDFLogger: requested a null pipeline without null_okay == true");
  257|      0|    }
  258|   786k|    return p;
  259|   786k|}
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|        }

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

_ZNK4qpdf10BaseHandlecv10QPDFObjGenEv:
   34|  89.1k|{
   35|  89.1k|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (35:12): [True: 89.1k, False: 0]
  ------------------
   36|  89.1k|}
_ZN16QPDFObjectHandle18StreamDataProviderC2Eb:
   46|  22.0k|    supports_retry(supports_retry)
   47|  22.0k|{
   48|  22.0k|}
_ZN16QPDFObjectHandle18StreamDataProviderD2Ev:
   51|  22.0k|{
   52|       |    // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
   53|  22.0k|}
_ZN16QPDFObjectHandle11TokenFilter9handleEOFEv:
  119|  2.47k|{
  120|  2.47k|}
_ZN16QPDFObjectHandle11TokenFilter11setPipelineEP8Pipeline:
  124|  5.27k|{
  125|  5.27k|    pipeline = p;
  126|  5.27k|}
_ZN16QPDFObjectHandle11TokenFilter5writeEPKcm:
  130|  1.93M|{
  131|  1.93M|    if (!pipeline) {
  ------------------
  |  Branch (131:9): [True: 0, False: 1.93M]
  ------------------
  132|      0|        return;
  133|      0|    }
  134|  1.93M|    if (len) {
  ------------------
  |  Branch (134:9): [True: 1.93M, False: 2.47k]
  ------------------
  135|  1.93M|        pipeline->write(data, len);
  136|  1.93M|    }
  137|  1.93M|}
_ZN16QPDFObjectHandle11TokenFilter5writeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  141|   493k|{
  142|   493k|    write(str.c_str(), str.length());
  143|   493k|}
_ZN16QPDFObjectHandle11TokenFilter10writeTokenERKN13QPDFTokenizer5TokenE:
  147|   883k|{
  148|   883k|    std::string const& value = token.getRawValue();
  149|   883k|    write(value.c_str(), value.length());
  150|   883k|}
_ZN4qpdf4Name9normalizeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  227|  18.5M|{
  228|  18.5M|    if (name.empty()) {
  ------------------
  |  Branch (228:9): [True: 0, False: 18.5M]
  ------------------
  229|      0|        return name;
  230|      0|    }
  231|  18.5M|    std::string result;
  232|  18.5M|    result += name.at(0);
  233|  26.9M|    for (size_t i = 1; i < name.length(); ++i) {
  ------------------
  |  Branch (233:24): [True: 8.46M, False: 18.5M]
  ------------------
  234|  8.46M|        char ch = name.at(i);
  235|       |        // Don't use locale/ctype here; follow PDF spec guidelines.
  236|  8.46M|        if (ch == '\0') {
  ------------------
  |  Branch (236:13): [True: 40.3k, False: 8.42M]
  ------------------
  237|       |            // QPDFTokenizer embeds a null character to encode an invalid #.
  238|  40.3k|            result += "#";
  239|  8.42M|        } else if (
  240|  8.42M|            ch < 33 || ch == '#' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (240:13): [True: 1.75M, False: 6.66M]
  |  Branch (240:24): [True: 253, False: 6.66M]
  |  Branch (240:37): [True: 216, False: 6.66M]
  |  Branch (240:50): [True: 235, False: 6.66M]
  |  Branch (240:63): [True: 237, False: 6.66M]
  |  Branch (240:76): [True: 293, False: 6.66M]
  |  Branch (240:89): [True: 300, False: 6.66M]
  ------------------
  241|  6.66M|            ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch > 126) {
  ------------------
  |  Branch (241:13): [True: 252, False: 6.66M]
  |  Branch (241:26): [True: 225, False: 6.66M]
  |  Branch (241:39): [True: 254, False: 6.66M]
  |  Branch (241:52): [True: 262, False: 6.66M]
  |  Branch (241:65): [True: 203, False: 6.66M]
  |  Branch (241:78): [True: 35.3k, False: 6.62M]
  ------------------
  242|  1.79M|            result += util::hex_encode_char(ch);
  243|  6.62M|        } else {
  244|  6.62M|            result += ch;
  245|  6.62M|        }
  246|  8.46M|    }
  247|  18.5M|    return result;
  248|  18.5M|}
_ZNK4qpdf10BaseHandle4copyEb:
  252|  78.1k|{
  253|  78.1k|    switch (resolved_type_code()) {
  ------------------
  |  Branch (253:13): [True: 78.1k, False: 0]
  ------------------
  254|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (254:5): [True: 0, False: 78.1k]
  ------------------
  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: 78.1k]
  ------------------
  258|      0|        return QPDFObject::create<QPDF_Reserved>();
  259|  10.7k|    case ::ot_null:
  ------------------
  |  Branch (259:5): [True: 10.7k, False: 67.4k]
  ------------------
  260|  10.7k|        return QPDFObject::create<QPDF_Null>();
  261|    137|    case ::ot_boolean:
  ------------------
  |  Branch (261:5): [True: 137, False: 78.0k]
  ------------------
  262|    137|        return QPDFObject::create<QPDF_Bool>(std::get<QPDF_Bool>(obj->value).val);
  263|  7.77k|    case ::ot_integer:
  ------------------
  |  Branch (263:5): [True: 7.77k, False: 70.4k]
  ------------------
  264|  7.77k|        return QPDFObject::create<QPDF_Integer>(std::get<QPDF_Integer>(obj->value).val);
  265|  4.41k|    case ::ot_real:
  ------------------
  |  Branch (265:5): [True: 4.41k, False: 73.7k]
  ------------------
  266|  4.41k|        return QPDFObject::create<QPDF_Real>(std::get<QPDF_Real>(obj->value).val);
  267|  1.33k|    case ::ot_string:
  ------------------
  |  Branch (267:5): [True: 1.33k, False: 76.8k]
  ------------------
  268|  1.33k|        return QPDFObject::create<QPDF_String>(std::get<QPDF_String>(obj->value).val);
  269|  10.7k|    case ::ot_name:
  ------------------
  |  Branch (269:5): [True: 10.7k, False: 67.4k]
  ------------------
  270|  10.7k|        return QPDFObject::create<QPDF_Name>(std::get<QPDF_Name>(obj->value).name);
  271|    782|    case ::ot_array:
  ------------------
  |  Branch (271:5): [True: 782, False: 77.4k]
  ------------------
  272|    782|        {
  273|    782|            auto const& a = std::get<QPDF_Array>(obj->value);
  274|    782|            if (shallow) {
  ------------------
  |  Branch (274:17): [True: 0, False: 782]
  ------------------
  275|      0|                return QPDFObject::create<QPDF_Array>(a);
  276|    782|            } else {
  277|    782|                QTC::TC("qpdf", "QPDF_Array copy", a.sp ? 0 : 1);
  ------------------
  |  Branch (277:52): [True: 25, False: 757]
  ------------------
  278|    782|                if (a.sp) {
  ------------------
  |  Branch (278:21): [True: 25, False: 757]
  ------------------
  279|     25|                    QPDF_Array result;
  280|     25|                    result.sp = std::make_unique<QPDF_Array::Sparse>();
  281|     25|                    result.sp->size = a.sp->size;
  282|  1.38k|                    for (auto const& [idx, oh]: a.sp->elements) {
  ------------------
  |  Branch (282:47): [True: 1.38k, False: 25]
  ------------------
  283|  1.38k|                        result.sp->elements[idx] = oh.indirect() ? oh : oh.copy();
  ------------------
  |  Branch (283:52): [True: 201, False: 1.18k]
  ------------------
  284|  1.38k|                    }
  285|     25|                    return QPDFObject::create<QPDF_Array>(std::move(result));
  286|    757|                } else {
  287|    757|                    std::vector<QPDFObjectHandle> result;
  288|    757|                    result.reserve(a.elements.size());
  289|  5.36k|                    for (auto const& element: a.elements) {
  ------------------
  |  Branch (289:45): [True: 5.36k, False: 757]
  ------------------
  290|  5.36k|                        result.emplace_back(
  291|  5.36k|                            element ? (element.indirect() ? element : element.copy()) : element);
  ------------------
  |  Branch (291:29): [True: 5.36k, False: 0]
  |  Branch (291:40): [True: 704, False: 4.66k]
  ------------------
  292|  5.36k|                    }
  293|    757|                    return QPDFObject::create<QPDF_Array>(std::move(result), false);
  294|    757|                }
  295|    782|            }
  296|    782|        }
  297|  42.2k|    case ::ot_dictionary:
  ------------------
  |  Branch (297:5): [True: 42.2k, False: 35.9k]
  ------------------
  298|  42.2k|        {
  299|  42.2k|            auto const& d = std::get<QPDF_Dictionary>(obj->value);
  300|  42.2k|            if (shallow) {
  ------------------
  |  Branch (300:17): [True: 41.3k, False: 881]
  ------------------
  301|  41.3k|                return QPDFObject::create<QPDF_Dictionary>(d.items);
  302|  41.3k|            } else {
  303|    881|                std::map<std::string, QPDFObjectHandle> new_items;
  304|  3.98k|                for (auto const& [key, val]: d.items) {
  ------------------
  |  Branch (304:44): [True: 3.98k, False: 881]
  ------------------
  305|  3.98k|                    new_items[key] = val.indirect() ? val : val.copy();
  ------------------
  |  Branch (305:38): [True: 663, False: 3.31k]
  ------------------
  306|  3.98k|                }
  307|    881|                return QPDFObject::create<QPDF_Dictionary>(new_items);
  308|    881|            }
  309|  42.2k|        }
  310|      0|    case ::ot_stream:
  ------------------
  |  Branch (310:5): [True: 0, False: 78.1k]
  ------------------
  311|      0|        QTC::TC("qpdf", "QPDF_Stream ERR shallow copy stream");
  312|      0|        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: 78.1k]
  ------------------
  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: 78.1k]
  ------------------
  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: 78.1k]
  ------------------
  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: 78.1k]
  ------------------
  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: 78.1k]
  ------------------
  325|      0|        return referenced_object().obj_sp();
  326|  78.1k|    }
  327|      0|    return {}; // unreachable
  328|  78.1k|}
_ZNK4qpdf10BaseHandle7unparseEv:
  474|  19.2M|{
  475|  19.2M|    switch (resolved_type_code()) {
  ------------------
  |  Branch (475:13): [True: 19.2M, False: 0]
  ------------------
  476|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (476:5): [True: 0, False: 19.2M]
  ------------------
  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: 19.2M]
  ------------------
  480|      0|        throw std::logic_error("QPDFObjectHandle: attempting to unparse a reserved object");
  481|      0|        return ""; // does not return
  482|   225k|    case ::ot_null:
  ------------------
  |  Branch (482:5): [True: 225k, False: 18.9M]
  ------------------
  483|   225k|        return "null";
  484|  4.79k|    case ::ot_boolean:
  ------------------
  |  Branch (484:5): [True: 4.79k, False: 19.2M]
  ------------------
  485|  4.79k|        return std::get<QPDF_Bool>(obj->value).val ? "true" : "false";
  ------------------
  |  Branch (485:16): [True: 4.20k, False: 588]
  ------------------
  486|   806k|    case ::ot_integer:
  ------------------
  |  Branch (486:5): [True: 806k, False: 18.4M]
  ------------------
  487|   806k|        return std::to_string(std::get<QPDF_Integer>(obj->value).val);
  488|  69.0k|    case ::ot_real:
  ------------------
  |  Branch (488:5): [True: 69.0k, False: 19.1M]
  ------------------
  489|  69.0k|        return std::get<QPDF_Real>(obj->value).val;
  490|  66.4k|    case ::ot_string:
  ------------------
  |  Branch (490:5): [True: 66.4k, False: 19.1M]
  ------------------
  491|  66.4k|        return std::get<QPDF_String>(obj->value).unparse(false);
  492|  18.0M|    case ::ot_name:
  ------------------
  |  Branch (492:5): [True: 18.0M, False: 1.17M]
  ------------------
  493|  18.0M|        return Name::normalize(std::get<QPDF_Name>(obj->value).name);
  494|      0|    case ::ot_array:
  ------------------
  |  Branch (494:5): [True: 0, False: 19.2M]
  ------------------
  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: 19.2M]
  ------------------
  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: 19.2M]
  ------------------
  531|      0|        return obj->og.unparse(' ') + " R";
  532|      0|    case ::ot_operator:
  ------------------
  |  Branch (532:5): [True: 0, False: 19.2M]
  ------------------
  533|      0|        return std::get<QPDF_Operator>(obj->value).val;
  534|      0|    case ::ot_inlineimage:
  ------------------
  |  Branch (534:5): [True: 0, False: 19.2M]
  ------------------
  535|      0|        return std::get<QPDF_InlineImage>(obj->value).val;
  536|      0|    case ::ot_unresolved:
  ------------------
  |  Branch (536:5): [True: 0, False: 19.2M]
  ------------------
  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: 19.2M]
  ------------------
  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: 19.2M]
  ------------------
  543|      0|        return obj->og.unparse(' ') + " R";
  544|  19.2M|    }
  545|      0|    return {}; // unreachable
  546|  19.2M|}
_ZN4qpdf10BaseHandle10disconnectEb:
  692|  21.2M|{
  693|       |    // QPDF::~QPDF() calls disconnect for indirect objects, so we don't do that here.
  694|  21.2M|    if (only_direct && indirect()) {
  ------------------
  |  Branch (694:9): [True: 20.2M, False: 1.02M]
  |  Branch (694:24): [True: 154k, False: 20.1M]
  ------------------
  695|   154k|        return;
  696|   154k|    }
  697|       |
  698|  21.1M|    switch (raw_type_code()) {
  699|  92.9k|    case ::ot_array:
  ------------------
  |  Branch (699:5): [True: 92.9k, False: 21.0M]
  ------------------
  700|  92.9k|        {
  701|  92.9k|            auto& a = std::get<QPDF_Array>(obj->value);
  702|  92.9k|            if (a.sp) {
  ------------------
  |  Branch (702:17): [True: 804, False: 92.1k]
  ------------------
  703|  15.0M|                for (auto& item: a.sp->elements) {
  ------------------
  |  Branch (703:32): [True: 15.0M, False: 804]
  ------------------
  704|  15.0M|                    item.second.disconnect();
  705|  15.0M|                }
  706|  92.1k|            } else {
  707|  4.47M|                for (auto& oh: a.elements) {
  ------------------
  |  Branch (707:30): [True: 4.47M, False: 92.1k]
  ------------------
  708|  4.47M|                    oh.disconnect();
  709|  4.47M|                }
  710|  92.1k|            }
  711|  92.9k|        }
  712|  92.9k|        break;
  713|   162k|    case ::ot_dictionary:
  ------------------
  |  Branch (713:5): [True: 162k, False: 20.9M]
  ------------------
  714|   727k|        for (auto& iter: std::get<QPDF_Dictionary>(obj->value).items) {
  ------------------
  |  Branch (714:24): [True: 727k, False: 162k]
  ------------------
  715|   727k|            iter.second.disconnect();
  716|   727k|        }
  717|   162k|        break;
  718|  41.3k|    case ::ot_stream:
  ------------------
  |  Branch (718:5): [True: 41.3k, False: 21.0M]
  ------------------
  719|  41.3k|        {
  720|  41.3k|            auto& s = std::get<QPDF_Stream>(obj->value);
  721|  41.3k|            s.m->stream_provider = nullptr;
  722|  41.3k|            s.m->stream_dict.disconnect();
  723|  41.3k|        }
  724|  41.3k|        break;
  725|      0|    case ::ot_uninitialized:
  ------------------
  |  Branch (725:5): [True: 0, False: 21.1M]
  ------------------
  726|      0|        return;
  727|  20.8M|    default:
  ------------------
  |  Branch (727:5): [True: 20.8M, False: 297k]
  ------------------
  728|  20.8M|        break;
  729|  21.1M|    }
  730|  21.1M|    obj->qpdf = nullptr;
  731|  21.1M|    obj->og = QPDFObjGen();
  732|  21.1M|}
_ZNK16QPDFObjectHandle14isSameObjectAsERKS_:
  736|    340|{
  737|    340|    return obj == rhs.obj;
  738|    340|}
_ZNK16QPDFObjectHandle11getTypeCodeEv:
  742|  19.3M|{
  743|  19.3M|    return type_code();
  744|  19.3M|}
_ZNK4qpdf10BaseHandle9type_nameEv:
  748|  5.27k|{
  749|  5.27k|    static constexpr std::array<char const*, 16> tn{
  750|  5.27k|        "uninitialized",
  751|  5.27k|        "reserved",
  752|  5.27k|        "null",
  753|  5.27k|        "boolean",
  754|  5.27k|        "integer",
  755|  5.27k|        "real",
  756|  5.27k|        "string",
  757|  5.27k|        "name",
  758|  5.27k|        "array",
  759|  5.27k|        "dictionary",
  760|  5.27k|        "stream",
  761|  5.27k|        "operator",
  762|  5.27k|        "inline-image",
  763|  5.27k|        "unresolved",
  764|  5.27k|        "destroyed",
  765|  5.27k|        "reference"};
  766|  5.27k|    return tn[type_code()];
  767|  5.27k|}
_ZNK16QPDFObjectHandle6isBoolEv:
  783|  39.8k|{
  784|  39.8k|    return type_code() == ::ot_boolean;
  785|  39.8k|}
_ZNK16QPDFObjectHandle6isNullEv:
  797|  25.9k|{
  798|  25.9k|    return type_code() == ::ot_null;
  799|  25.9k|}
_ZNK16QPDFObjectHandle9isIntegerEv:
  803|   164k|{
  804|   164k|    return type_code() == ::ot_integer;
  805|   164k|}
_ZNK16QPDFObjectHandle6isRealEv:
  809|  23.1k|{
  810|  23.1k|    return type_code() == ::ot_real;
  811|  23.1k|}
_ZNK16QPDFObjectHandle8isNumberEv:
  815|  25.5k|{
  816|  25.5k|    return (isInteger() || isReal());
  ------------------
  |  Branch (816:13): [True: 18.1k, False: 7.34k]
  |  Branch (816:28): [True: 7.09k, False: 253]
  ------------------
  817|  25.5k|}
_ZNK16QPDFObjectHandle6isNameEv:
  845|  61.4k|{
  846|  61.4k|    return type_code() == ::ot_name;
  847|  61.4k|}
_ZNK16QPDFObjectHandle8isStringEv:
  851|  28.2k|{
  852|  28.2k|    return type_code() == ::ot_string;
  853|  28.2k|}
_ZNK16QPDFObjectHandle7isArrayEv:
  869|  37.0k|{
  870|  37.0k|    return type_code() == ::ot_array;
  871|  37.0k|}
_ZNK16QPDFObjectHandle12isDictionaryEv:
  875|  19.7M|{
  876|  19.7M|    return type_code() == ::ot_dictionary;
  877|  19.7M|}
_ZNK16QPDFObjectHandle8isStreamEv:
  881|  19.1M|{
  882|  19.1M|    return type_code() == ::ot_stream;
  883|  19.1M|}
_ZNK16QPDFObjectHandle8isScalarEv:
  893|    950|{
  894|    950|    return isBool() || isInteger() || isName() || isNull() || isReal() || isString();
  ------------------
  |  Branch (894:12): [True: 13, False: 937]
  |  Branch (894:24): [True: 111, False: 826]
  |  Branch (894:39): [True: 236, False: 590]
  |  Branch (894:51): [True: 0, False: 590]
  |  Branch (894:63): [True: 6, False: 584]
  |  Branch (894:75): [True: 10, False: 574]
  ------------------
  895|    950|}
_ZNK16QPDFObjectHandle15isNameAndEqualsERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  899|  66.4k|{
  900|  66.4k|    return Name(*this) == name;
  901|  66.4k|}
_ZNK16QPDFObjectHandle18isDictionaryOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  905|   323k|{
  906|   323k|    return isDictionary() && (type.empty() || Name((*this)["/Type"]) == type) &&
  ------------------
  |  Branch (906:12): [True: 155k, False: 167k]
  |  Branch (906:31): [True: 0, False: 155k]
  |  Branch (906:47): [True: 17.8k, False: 137k]
  ------------------
  907|  17.8k|        (subtype.empty() || Name((*this)["/Subtype"]) == subtype);
  ------------------
  |  Branch (907:10): [True: 17.5k, False: 347]
  |  Branch (907:29): [True: 263, False: 84]
  ------------------
  908|   323k|}
_ZNK16QPDFObjectHandle14isStreamOfTypeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
  912|   876k|{
  913|   876k|    if (auto stream = as_stream()) {
  ------------------
  |  Branch (913:14): [True: 81.4k, False: 794k]
  ------------------
  914|  81.4k|        return stream && (type.empty() || stream.Type() == type) &&
  ------------------
  |  Branch (914:16): [True: 81.4k, False: 0]
  |  Branch (914:27): [True: 0, False: 81.4k]
  |  Branch (914:43): [True: 13.4k, False: 68.0k]
  ------------------
  915|  13.4k|            (subtype.empty() || stream.Subtype() == subtype);
  ------------------
  |  Branch (915:14): [True: 13.4k, False: 0]
  |  Branch (915:33): [True: 0, False: 0]
  ------------------
  916|  81.4k|    }
  917|   794k|    return false;
  918|   876k|}
_ZNK16QPDFObjectHandle12getBoolValueEv:
  924|      1|{
  925|      1|    if (auto boolean = as<QPDF_Bool>()) {
  ------------------
  |  Branch (925:14): [True: 1, False: 0]
  ------------------
  926|      1|        return boolean->val;
  927|      1|    } else {
  928|      0|        typeWarning("boolean", "returning false");
  929|      0|        QTC::TC("qpdf", "QPDFObjectHandle boolean returning false");
  930|      0|        return false;
  931|      0|    }
  932|      1|}
_ZN4qpdf7IntegerC2Ex:
  947|  1.28k|    BaseHandle(QPDFObject::create<QPDF_Integer>(value))
  948|  1.28k|{
  949|  1.28k|}
_ZNK4qpdf7Integer5valueEv:
  959|   114k|{
  960|   114k|    auto* i = as<QPDF_Integer>();
  961|   114k|    if (!i) {
  ------------------
  |  Branch (961:9): [True: 1.05k, False: 113k]
  ------------------
  962|  1.05k|        throw invalid_error("Integer");
  963|  1.05k|    }
  964|   113k|    return i->val;
  965|   114k|}
_ZNK16QPDFObjectHandle11getIntValueEv:
  969|  11.6k|{
  970|  11.6k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (970:20): [True: 11.6k, False: 0]
  ------------------
  971|  11.6k|        return integer;
  972|  11.6k|    } else {
  973|      0|        typeWarning("integer", "returning 0");
  974|      0|        return 0;
  975|      0|    }
  976|  11.6k|}
_ZNK16QPDFObjectHandle13getValueAsIntERx:
  980|  6.77k|{
  981|  6.77k|    if (auto const integer = Integer(*this)) {
  ------------------
  |  Branch (981:20): [True: 6.72k, False: 52]
  ------------------
  982|  6.72k|        value = integer;
  983|  6.72k|        return true;
  984|  6.72k|    }
  985|     52|    return false;
  986|  6.77k|}
_ZNK16QPDFObjectHandle16getIntValueAsIntEv:
  990|  39.4k|{
  991|  39.4k|    try {
  992|  39.4k|        return Integer(*this).value<int>();
  993|  39.4k|    } catch (std::invalid_argument&) {
  994|     23|        typeWarning("integer", "returning 0");
  995|     23|        return 0;
  996|     23|    }
  997|  39.4k|}
_ZNK16QPDFObjectHandle13getValueAsIntERi:
 1001|  1.68k|{
 1002|  1.68k|    if (!isInteger()) {
  ------------------
  |  Branch (1002:9): [True: 58, False: 1.63k]
  ------------------
 1003|     58|        return false;
 1004|     58|    }
 1005|  1.63k|    value = getIntValueAsInt();
 1006|  1.63k|    return true;
 1007|  1.68k|}
_ZNK16QPDFObjectHandle12getUIntValueEv:
 1011|  32.1k|{
 1012|  32.1k|    try {
 1013|  32.1k|        return Integer(*this).value<unsigned long long>();
 1014|  32.1k|    } catch (std::invalid_argument&) {
 1015|    692|        typeWarning("integer", "returning 0");
 1016|    692|        return 0;
 1017|    692|    }
 1018|  32.1k|}
_ZNK16QPDFObjectHandle18getUIntValueAsUIntEv:
 1032|  7.50k|{
 1033|  7.50k|    try {
 1034|  7.50k|        return Integer(*this).value<unsigned int>();
 1035|  7.50k|    } catch (std::invalid_argument&) {
 1036|    342|        typeWarning("integer", "returning 0");
 1037|    342|        return 0;
 1038|    342|    }
 1039|  7.50k|}
_ZNK16QPDFObjectHandle14getValueAsUIntERj:
 1043|  2.07k|{
 1044|  2.07k|    if (!isInteger()) {
  ------------------
  |  Branch (1044:9): [True: 380, False: 1.69k]
  ------------------
 1045|    380|        return false;
 1046|    380|    }
 1047|  1.69k|    value = getUIntValueAsUInt();
 1048|  1.69k|    return true;
 1049|  2.07k|}
_ZN4qpdf4NameC2EONSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 1087|  18.9k|    BaseHandle(QPDFObject::create<QPDF_Name>(std::move(name)))
 1088|  18.9k|{
 1089|  18.9k|}
_ZNK4qpdf4Name5valueEv:
 1093|   185k|{
 1094|   185k|    auto* n = as<QPDF_Name>();
 1095|   185k|    if (!n) {
  ------------------
  |  Branch (1095:9): [True: 0, False: 185k]
  ------------------
 1096|      0|        throw invalid_error("Name");
 1097|      0|    }
 1098|   185k|    return n->name;
 1099|   185k|}
_ZNK16QPDFObjectHandle7getNameEv:
 1103|  20.4k|{
 1104|  20.4k|    if (auto* name = as<QPDF_Name>()) {
  ------------------
  |  Branch (1104:15): [True: 20.4k, False: 0]
  ------------------
 1105|  20.4k|        return name->name;
 1106|  20.4k|    }
 1107|      0|    typeWarning("name", "returning dummy name");
 1108|      0|    return "/QPDFFakeName";
 1109|  20.4k|}
_ZN16QPDFObjectHandle9newStringERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1125|  47.1k|{
 1126|  47.1k|    return {QPDFObject::create<QPDF_String>(str)};
 1127|  47.1k|}
_ZNK4qpdf6String5valueEv:
 1157|  8.11k|{
 1158|  8.11k|    auto* s = as<QPDF_String>();
 1159|  8.11k|    if (!s) {
  ------------------
  |  Branch (1159:9): [True: 0, False: 8.11k]
  ------------------
 1160|      0|        throw invalid_error("String");
 1161|      0|    }
 1162|  8.11k|    return s->val;
 1163|  8.11k|}
_ZNK16QPDFObjectHandle14getStringValueEv:
 1185|  7.46k|{
 1186|  7.46k|    try {
 1187|  7.46k|        return String(obj).value();
 1188|  7.46k|    } catch (std::invalid_argument&) {
 1189|      0|        typeWarning("string", "returning empty string");
 1190|      0|        return {};
 1191|      0|    }
 1192|  7.46k|}
_ZNK16QPDFObjectHandle11isOrHasNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 1289|  18.1k|{
 1290|  18.1k|    if (isNameAndEquals(value)) {
  ------------------
  |  Branch (1290:9): [True: 159, False: 18.0k]
  ------------------
 1291|    159|        return true;
 1292|  18.0k|    } else if (isArray()) {
  ------------------
  |  Branch (1292:16): [True: 5.99k, False: 12.0k]
  ------------------
 1293|  40.0k|        for (auto& item: getArrayAsVector()) {
  ------------------
  |  Branch (1293:24): [True: 40.0k, False: 5.69k]
  ------------------
 1294|  40.0k|            if (item.isNameAndEquals(value)) {
  ------------------
  |  Branch (1294:17): [True: 298, False: 39.7k]
  ------------------
 1295|    298|                return true;
 1296|    298|            }
 1297|  40.0k|        }
 1298|  5.99k|    }
 1299|  17.7k|    return false;
 1300|  18.1k|}
_ZNK16QPDFObjectHandle7unparseEv:
 1586|  47.1k|{
 1587|  47.1k|    if (isIndirect()) {
  ------------------
  |  Branch (1587:9): [True: 17, False: 47.1k]
  ------------------
 1588|     17|        return getObjGen().unparse(' ') + " R";
 1589|  47.1k|    } else {
 1590|  47.1k|        return unparseResolved();
 1591|  47.1k|    }
 1592|  47.1k|}
_ZNK16QPDFObjectHandle15unparseResolvedEv:
 1596|  19.2M|{
 1597|  19.2M|    if (!obj) {
  ------------------
  |  Branch (1597:9): [True: 0, False: 19.2M]
  ------------------
 1598|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 1599|      0|    }
 1600|  19.2M|    return BaseHandle::unparse();
 1601|  19.2M|}
_ZN16QPDFObjectHandle5parseERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES8_:
 1662|     28|{
 1663|     28|    return parse(nullptr, object_str, object_description);
 1664|     28|}
_ZN16QPDFObjectHandle5parseEP4QPDFRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
 1669|     28|{
 1670|     28|    auto input = is::OffsetBuffer("parsed object", object_str);
 1671|     28|    auto result = Parser::parse(input, object_description, context);
 1672|     28|    size_t offset = QIntC::to_size(input.tell());
 1673|     28|    while (offset < object_str.length()) {
  ------------------
  |  Branch (1673:12): [True: 0, False: 28]
  ------------------
 1674|      0|        if (!isspace(object_str.at(offset))) {
  ------------------
  |  Branch (1674:13): [True: 0, False: 0]
  ------------------
 1675|      0|            QTC::TC("qpdf", "QPDFObjectHandle trailing data in parse");
 1676|      0|            throw QPDFExc(
 1677|      0|                qpdf_e_damaged_pdf,
 1678|      0|                "parsed object",
 1679|      0|                object_description,
 1680|      0|                input.getLastOffset(),
 1681|      0|                "trailing data found parsing object from string");
 1682|      0|        }
 1683|      0|        ++offset;
 1684|      0|    }
 1685|     28|    return result;
 1686|     28|}
_ZN16QPDFObjectHandle7newNullEv:
 1895|  8.01k|{
 1896|  8.01k|    return {QPDFObject::create<QPDF_Null>()};
 1897|  8.01k|}
_ZN16QPDFObjectHandle7newRealEdib:
 1907|  31.9k|{
 1908|  31.9k|    return {QPDFObject::create<QPDF_Real>(value, decimal_places, trim_trailing_zeroes)};
 1909|  31.9k|}
_ZN16QPDFObjectHandle8newArrayERKNSt3__16vectorIS_NS0_9allocatorIS_EEEE:
 1931|  7.98k|{
 1932|  7.98k|    return {QPDFObject::create<QPDF_Array>(items)};
 1933|  7.98k|}
_ZN16QPDFObjectHandle8newArrayERKNS_9RectangleE:
 1937|  7.98k|{
 1938|  7.98k|    return newArray({newReal(rect.llx), newReal(rect.lly), newReal(rect.urx), newReal(rect.ury)});
 1939|  7.98k|}
_ZN16QPDFObjectHandle13newDictionaryEv:
 1985|  15.3k|{
 1986|  15.3k|    return newDictionary(std::map<std::string, QPDFObjectHandle>());
 1987|  15.3k|}
_ZN16QPDFObjectHandle13newDictionaryERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES_NS0_4lessIS7_EENS5_INS0_4pairIKS7_S_EEEEEE:
 1991|  15.3k|{
 1992|  15.3k|    return {QPDFObject::create<QPDF_Dictionary>(items)};
 1993|  15.3k|}
_ZNK4qpdf10BaseHandle11descriptionEv:
 2036|  59.6k|{
 2037|  59.6k|    return obj ? obj->getDescription() : ""s;
  ------------------
  |  Branch (2037:12): [True: 59.6k, False: 0]
  ------------------
 2038|  59.6k|}
_ZNK16QPDFObjectHandle20hasObjectDescriptionEv:
 2051|  47.8k|{
 2052|  47.8k|    return obj && obj->hasDescription();
  ------------------
  |  Branch (2052:12): [True: 47.8k, False: 0]
  |  Branch (2052:19): [True: 47.8k, False: 0]
  ------------------
 2053|  47.8k|}
_ZN16QPDFObjectHandle11shallowCopyEv:
 2057|    171|{
 2058|    171|    if (!obj) {
  ------------------
  |  Branch (2058:9): [True: 0, False: 171]
  ------------------
 2059|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2060|      0|    }
 2061|    171|    return {copy()};
 2062|    171|}
_ZN16QPDFObjectHandle17unsafeShallowCopyEv:
 2066|  41.3k|{
 2067|  41.3k|    if (!obj) {
  ------------------
  |  Branch (2067:9): [True: 0, False: 41.3k]
  ------------------
 2068|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2069|      0|    }
 2070|  41.3k|    return {copy(true)};
 2071|  41.3k|}
_ZN16QPDFObjectHandle10makeDirectEjRN10QPDFObjGen3setEb:
 2075|  38.1k|{
 2076|  38.1k|    static uint32_t constexpr max_nesting = 500;
 2077|  38.1k|    if (++level > max_nesting + 1) {
  ------------------
  |  Branch (2077:9): [True: 0, False: 38.1k]
  ------------------
 2078|      0|        throw std::runtime_error("QPDFObjectHandle::makeDirect exceeded maximum nesting level");
 2079|      0|    }
 2080|  38.1k|    assertInitialized();
 2081|       |
 2082|  38.1k|    auto cur_og = getObjGen();
 2083|  38.1k|    if (!visited.add(cur_og)) {
  ------------------
  |  Branch (2083:9): [True: 34, False: 38.0k]
  ------------------
 2084|     34|        throw std::runtime_error("loop detected while converting object from indirect to direct");
 2085|     34|    }
 2086|       |
 2087|  38.0k|    if (isBool() || isInteger() || isName() || isNull() || isReal() || isString()) {
  ------------------
  |  Branch (2087:9): [True: 77, False: 38.0k]
  |  Branch (2087:21): [True: 5.34k, False: 32.6k]
  |  Branch (2087:36): [True: 7.28k, False: 25.3k]
  |  Branch (2087:48): [True: 10.1k, False: 15.1k]
  |  Branch (2087:60): [True: 4.09k, False: 11.0k]
  |  Branch (2087:72): [True: 541, False: 10.5k]
  ------------------
 2088|  27.5k|        obj = copy(true);
 2089|  27.5k|    } else if (auto a = as_array(strict)) {
  ------------------
  |  Branch (2089:21): [True: 3.21k, False: 7.32k]
  ------------------
 2090|  3.21k|        std::vector<QPDFObjectHandle> items;
 2091|  22.6k|        for (auto const& item: a) {
  ------------------
  |  Branch (2091:30): [True: 22.6k, False: 3.21k]
  ------------------
 2092|  22.6k|            items.emplace_back(item);
 2093|  22.6k|            items.back().makeDirect(level, visited, stop_at_streams);
 2094|  22.6k|        }
 2095|  3.21k|        obj = QPDFObject::create<QPDF_Array>(items);
 2096|  7.32k|    } else if (isDictionary()) {
  ------------------
  |  Branch (2096:16): [True: 7.32k, False: 1]
  ------------------
 2097|  7.32k|        std::map<std::string, QPDFObjectHandle> items;
 2098|  20.7k|        for (auto const& [key, value]: as_dictionary(strict)) {
  ------------------
  |  Branch (2098:38): [True: 20.7k, False: 7.32k]
  ------------------
 2099|  20.7k|            if (!value.null()) {
  ------------------
  |  Branch (2099:17): [True: 15.2k, False: 5.45k]
  ------------------
 2100|  15.2k|                items.insert({key, value});
 2101|  15.2k|                items[key].makeDirect(level, visited, stop_at_streams);
 2102|  15.2k|            }
 2103|  20.7k|        }
 2104|  7.32k|        obj = QPDFObject::create<QPDF_Dictionary>(items);
 2105|  7.32k|    } else if (isStream()) {
  ------------------
  |  Branch (2105:16): [True: 1, False: 0]
  ------------------
 2106|      1|        QTC::TC("qpdf", "QPDFObjectHandle copy stream", stop_at_streams ? 0 : 1);
  ------------------
  |  Branch (2106:57): [True: 0, False: 1]
  ------------------
 2107|      1|        if (!stop_at_streams) {
  ------------------
  |  Branch (2107:13): [True: 1, False: 0]
  ------------------
 2108|      1|            throw std::runtime_error("attempt to make a stream into a direct object");
 2109|      1|        }
 2110|      1|    } else if (isReserved()) {
  ------------------
  |  Branch (2110:16): [True: 0, False: 0]
  ------------------
 2111|      0|        throw std::logic_error(
 2112|      0|            "QPDFObjectHandle: attempting to make a reserved object handle direct");
 2113|      0|    } else {
 2114|      0|        throw std::logic_error("QPDFObjectHandle::makeDirectInternal: unknown object type");
 2115|      0|    }
 2116|       |
 2117|  38.0k|    visited.erase(cur_og);
 2118|  38.0k|}
_ZN16QPDFObjectHandle10makeDirectEb:
 2122|    193|{
 2123|    193|    QPDFObjGen::set visited;
 2124|    193|    makeDirect(0, visited, allow_streams);
 2125|    193|}
_ZNK16QPDFObjectHandle17assertInitializedEv:
 2129|  38.1k|{
 2130|  38.1k|    if (!obj) {
  ------------------
  |  Branch (2130:9): [True: 0, False: 38.1k]
  ------------------
 2131|      0|        throw std::logic_error("operation attempted on uninitialized QPDFObjectHandle");
 2132|      0|    }
 2133|  38.1k|}
_ZNK4qpdf10BaseHandle13invalid_errorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2137|  1.05k|{
 2138|  1.05k|    return std::invalid_argument(method + " operation attempted on invalid object");
 2139|  1.05k|}
_ZNK4qpdf10BaseHandle10type_errorEPKc:
 2142|     38|{
 2143|     38|    return std::runtime_error(
 2144|     38|        "operation for "s + expected_type + " attempted on object of type " + type_name());
 2145|     38|}
_ZNK4qpdf10BaseHandle10type_errorEPKcRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 2149|  5.23k|{
 2150|  5.23k|    return {
 2151|  5.23k|        qpdf_e_object,
 2152|  5.23k|        "",
 2153|  5.23k|        description(),
 2154|  5.23k|        0,
 2155|  5.23k|        "operation for "s + expected_type + " attempted on object of type " + type_name() + ": " +
 2156|  5.23k|            message};
 2157|  5.23k|}
_ZNK16QPDFObjectHandle11typeWarningEPKcRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 2161|  5.23k|{
 2162|  5.23k|    if (!obj) {
  ------------------
  |  Branch (2162:9): [True: 0, False: 5.23k]
  ------------------
 2163|      0|        throw std::logic_error("attempted to dereference an uninitialized QPDFObjectHandle");
 2164|      0|    }
 2165|  5.23k|    warn(type_error(expected_type, message));
 2166|  5.23k|}
_ZNK16QPDFObjectHandle13objectWarningERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
 2176|     34|{
 2177|     34|    warn({qpdf_e_object, "", description(), 0, warning});
 2178|     34|}
_ZNK16QPDFObjectHandle10assertTypeEPKcb:
 2182|     38|{
 2183|     38|    if (!istype) {
  ------------------
  |  Branch (2183:9): [True: 38, False: 0]
  ------------------
 2184|     38|        throw type_error(type_name);
 2185|     38|    }
 2186|     38|}
_ZNK4qpdf10BaseHandle4warnEO7QPDFExc:
 2338|  59.6k|{
 2339|  59.6k|    if (!qpdf()) {
  ------------------
  |  Branch (2339:9): [True: 197, False: 59.4k]
  ------------------
 2340|    197|        throw std::move(e);
 2341|    197|    }
 2342|  59.4k|    qpdf()->warn(std::move(e));
 2343|  59.4k|}
_ZNK4qpdf10BaseHandle4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
 2347|  59.4k|{
 2348|  59.4k|    if (qpdf()) {
  ------------------
  |  Branch (2348:9): [True: 54.3k, False: 5.09k]
  ------------------
 2349|  54.3k|        warn({qpdf_e_damaged_pdf, "", description(), 0, warning});
 2350|  54.3k|    } else {
 2351|  5.09k|        *QPDFLogger::defaultLogger()->getError() << warning << "\n";
 2352|  5.09k|    }
 2353|  59.4k|}
_ZNK16QPDFObjectHandle9getObjGenEv:
 2522|  39.6M|{
 2523|  39.6M|    return obj ? obj->getObjGen() : QPDFObjGen();
  ------------------
  |  Branch (2523:12): [True: 39.6M, False: 0]
  ------------------
 2524|  39.6M|}
_ZNK16QPDFObjectHandle11getObjectIDEv:
 2528|  19.1M|{
 2529|  19.1M|    return getObjGen().getObj();
 2530|  19.1M|}
_ZNK16QPDFObjectHandle10isIndirectEv:
 2540|  69.1k|{
 2541|  69.1k|    return getObjectID() != 0;
 2542|  69.1k|}
_ZNK16QPDFObjectHandle13getOwningQPDFEv:
 2547|  98.9k|{
 2548|  98.9k|    return obj ? obj->getQPDF() : nullptr;
  ------------------
  |  Branch (2548:12): [True: 98.9k, False: 0]
  ------------------
 2549|  98.9k|}
_ZN16QPDFObjectHandle15setParsedOffsetEx:
 2562|     22|{
 2563|     22|    if (obj) {
  ------------------
  |  Branch (2563:9): [True: 22, False: 0]
  ------------------
 2564|     22|        obj->setParsedOffset(offset);
 2565|     22|    }
 2566|     22|}

_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEP4QPDF:
   53|     28|{
   54|     28|    qpdf::Tokenizer tokenizer;
   55|     28|    if (auto result = Parser(
  ------------------
  |  Branch (55:14): [True: 28, False: 0]
  ------------------
   56|     28|                          input,
   57|     28|                          make_description(input.getName(), object_description),
   58|     28|                          object_description,
   59|     28|                          tokenizer,
   60|     28|                          nullptr,
   61|     28|                          context,
   62|     28|                          false)
   63|     28|                          .parse()) {
   64|     28|        return result;
   65|     28|    }
   66|      0|    return {QPDFObject::create<QPDF_Null>()};
   67|     28|}
_ZN4qpdf4impl6Parser5parseER11InputSourceRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEERNS_9TokenizerEPN16QPDFObjectHandle15StringDecrypterER4QPDFb:
  129|   142k|{
  130|   142k|    return Parser(
  131|   142k|               input,
  132|   142k|               make_description(input.getName(), object_description),
  133|   142k|               object_description,
  134|   142k|               tokenizer,
  135|   142k|               decrypter,
  136|   142k|               &context,
  137|   142k|               true,
  138|   142k|               0,
  139|   142k|               0,
  140|   142k|               sanity_checks)
  141|   142k|        .parse();
  142|   142k|}
_ZN4qpdf4impl6Parser5parseERNS_2is12OffsetBufferEiiRNS_9TokenizerER4QPDF:
  147|  33.7k|{
  148|  33.7k|    return Parser(
  149|  33.7k|               input,
  150|  33.7k|               std::make_shared<QPDFObject::Description>(
  151|  33.7k|                   QPDFObject::ObjStreamDescr(stream_id, obj_id)),
  152|  33.7k|               "",
  153|  33.7k|               tokenizer,
  154|  33.7k|               nullptr,
  155|  33.7k|               &context,
  156|  33.7k|               true,
  157|  33.7k|               stream_id,
  158|  33.7k|               obj_id)
  159|  33.7k|        .parse();
  160|  33.7k|}
_ZN4qpdf4impl6Parser5parseEb:
  164|   176k|{
  165|   176k|    try {
  166|   176k|        return parse_first(content_stream);
  167|   176k|    } catch (Error&) {
  168|  9.38k|        return {};
  169|  9.38k|    } catch (QPDFExc& e) {
  170|  2.84k|        throw e;
  171|  2.84k|    } catch (std::logic_error& e) {
  172|      1|        throw e;
  173|  1.30k|    } catch (std::exception& e) {
  174|  1.30k|        warn("treating object as null because of error during parsing: "s + e.what());
  175|  1.30k|        return {};
  176|  1.30k|    }
  177|   176k|}
_ZN4qpdf4impl6Parser11parse_firstEb:
  181|   176k|{
  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|   176k|    QPDF::Doc::ParseGuard pg(context_);
  188|   176k|    start_ = input_.tell();
  189|   176k|    if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (189:9): [True: 1.72k, False: 174k]
  ------------------
  190|  1.72k|        warn(tokenizer_.getErrorMessage());
  191|  1.72k|    }
  192|       |
  193|   176k|    switch (tokenizer_.getType()) {
  194|    396|    case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (194:5): [True: 396, False: 175k]
  ------------------
  195|    396|        if (content_stream) {
  ------------------
  |  Branch (195:13): [True: 0, False: 396]
  ------------------
  196|       |            // In content stream mode, leave object uninitialized to indicate EOF
  197|      0|            empty_ = true;
  198|      0|            return {};
  199|      0|        }
  200|    396|        warn("unexpected EOF");
  201|    396|        return {};
  202|       |
  203|  1.64k|    case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (203:5): [True: 1.64k, False: 174k]
  ------------------
  204|  1.64k|        return {};
  205|       |
  206|    230|    case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (206:5): [True: 230, False: 175k]
  ------------------
  207|    324|    case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (207:5): [True: 94, False: 175k]
  ------------------
  208|    324|        warn("treating unexpected brace token as null");
  209|    324|        return {};
  210|       |
  211|    421|    case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (211:5): [True: 421, False: 175k]
  ------------------
  212|    421|        warn("treating unexpected array close token as null");
  213|    421|        return {};
  214|       |
  215|    373|    case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (215:5): [True: 373, False: 175k]
  ------------------
  216|    373|        warn("unexpected dictionary close token");
  217|    373|        return {};
  218|       |
  219|  9.15k|    case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (219:5): [True: 9.15k, False: 166k]
  ------------------
  220|   151k|    case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (220:5): [True: 141k, False: 34.0k]
  ------------------
  221|   151k|        stack_.clear();
  222|   151k|        stack_.emplace_back(
  223|   151k|            input_,
  224|   151k|            (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array : st_dictionary_key);
  ------------------
  |  Branch (224:13): [True: 9.15k, False: 141k]
  ------------------
  225|   151k|        frame_ = &stack_.back();
  226|   151k|        return parse_remainder(content_stream);
  227|       |
  228|    352|    case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (228:5): [True: 352, False: 175k]
  ------------------
  229|    352|        return with_description<QPDF_Bool>(tokenizer_.getValue() == "true");
  230|       |
  231|    152|    case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (231:5): [True: 152, False: 175k]
  ------------------
  232|    152|        return {QPDFObject::create<QPDF_Null>()};
  233|       |
  234|  10.2k|    case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (234:5): [True: 10.2k, False: 165k]
  ------------------
  235|  10.2k|        return with_description<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  236|       |
  237|    756|    case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (237:5): [True: 756, False: 175k]
  ------------------
  238|    756|        return with_description<QPDF_Real>(tokenizer_.getValue());
  239|       |
  240|  1.53k|    case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (240:5): [True: 1.53k, False: 174k]
  ------------------
  241|  1.53k|        return with_description<QPDF_Name>(tokenizer_.getValue());
  242|       |
  243|  7.96k|    case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (243:5): [True: 7.96k, False: 168k]
  ------------------
  244|  7.96k|        {
  245|  7.96k|            auto const& value = tokenizer_.getValue();
  246|  7.96k|            if (content_stream) {
  ------------------
  |  Branch (246:17): [True: 0, False: 7.96k]
  ------------------
  247|      0|                return with_description<QPDF_Operator>(value);
  248|  7.96k|            } else if (value == "endobj") {
  ------------------
  |  Branch (248:24): [True: 191, False: 7.77k]
  ------------------
  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|    191|                empty_ = true;
  254|    191|                input_.seek(input_.getLastOffset(), SEEK_SET);
  255|    191|                if (!content_stream) {
  ------------------
  |  Branch (255:21): [True: 191, False: 0]
  ------------------
  256|    191|                    warn("empty object treated as null");
  257|    191|                }
  258|    191|                return {};
  259|  7.77k|            } else {
  260|  7.77k|                warn("unknown token while reading object; treating as string");
  261|  7.77k|                return with_description<QPDF_String>(value);
  262|  7.77k|            }
  263|  7.96k|        }
  264|       |
  265|    675|    case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (265:5): [True: 675, False: 175k]
  ------------------
  266|    675|        if (decrypter_) {
  ------------------
  |  Branch (266:13): [True: 280, False: 395]
  ------------------
  267|    280|            std::string s{tokenizer_.getValue()};
  268|    280|            decrypter_->decryptString(s);
  269|    280|            return with_description<QPDF_String>(s);
  270|    395|        } else {
  271|    395|            return with_description<QPDF_String>(tokenizer_.getValue());
  272|    395|        }
  273|       |
  274|      0|    default:
  ------------------
  |  Branch (274:5): [True: 0, False: 176k]
  ------------------
  275|      0|        warn("treating unknown token type as null while reading object");
  276|      0|        return {};
  277|   176k|    }
  278|   176k|}
_ZN4qpdf4impl6Parser15parse_remainderEb:
  282|   151k|{
  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|   151k|    bad_count_ = 0;
  289|   151k|    bool b_contents = false;
  290|       |
  291|  28.9M|    while (true) {
  ------------------
  |  Branch (291:12): [True: 28.9M, Folded]
  ------------------
  292|  28.9M|        if (!tokenizer_.nextToken(input_, object_description_)) {
  ------------------
  |  Branch (292:13): [True: 37.2k, False: 28.9M]
  ------------------
  293|  37.2k|            warn(tokenizer_.getErrorMessage());
  294|  37.2k|        }
  295|  28.9M|        ++good_count_; // optimistically
  296|       |
  297|  28.9M|        if (int_count_ != 0) {
  ------------------
  |  Branch (297:13): [True: 2.52M, False: 26.4M]
  ------------------
  298|       |            // Special handling of indirect references. Treat integer tokens as part of an indirect
  299|       |            // reference until proven otherwise.
  300|  2.52M|            if (tokenizer_.getType() == QPDFTokenizer::tt_integer) {
  ------------------
  |  Branch (300:17): [True: 1.86M, False: 659k]
  ------------------
  301|  1.86M|                if (++int_count_ > 2) {
  ------------------
  |  Branch (301:21): [True: 1.38M, False: 475k]
  ------------------
  302|       |                    // Process the oldest buffered integer.
  303|  1.38M|                    add_int(int_count_);
  304|  1.38M|                }
  305|  1.86M|                last_offset_buffer_[int_count_ % 2] = input_.getLastOffset();
  306|  1.86M|                int_buffer_[int_count_ % 2] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  307|  1.86M|                continue;
  308|       |
  309|  1.86M|            } else if (
  310|   659k|                int_count_ >= 2 && tokenizer_.getType() == QPDFTokenizer::tt_word &&
  ------------------
  |  Branch (310:17): [True: 475k, False: 184k]
  |  Branch (310:36): [True: 427k, False: 47.9k]
  ------------------
  311|   427k|                tokenizer_.getValue() == "R") {
  ------------------
  |  Branch (311:17): [True: 403k, False: 24.4k]
  ------------------
  312|   403k|                if (!context_) {
  ------------------
  |  Branch (312:21): [True: 0, False: 403k]
  ------------------
  313|      0|                    throw std::logic_error(
  314|      0|                        "Parser::parse called without context on an object with indirect "
  315|      0|                        "references");
  316|      0|                }
  317|   403k|                auto id = QIntC::to_int(int_buffer_[(int_count_ - 1) % 2]);
  318|   403k|                auto gen = QIntC::to_int(int_buffer_[(int_count_) % 2]);
  319|   403k|                if (!(id < 1 || gen < 0 || gen >= 65535)) {
  ------------------
  |  Branch (319:23): [True: 2.00k, False: 401k]
  |  Branch (319:33): [True: 289, False: 401k]
  |  Branch (319:44): [True: 344, False: 400k]
  ------------------
  320|   400k|                    add(ParseGuard::getObject(context_, id, gen, parse_pdf_));
  321|   400k|                } else {
  322|  2.63k|                    add_bad_null(
  323|  2.63k|                        "treating bad indirect reference (" + std::to_string(id) + " " +
  324|  2.63k|                        std::to_string(gen) + " R) as null");
  325|  2.63k|                }
  326|   403k|                int_count_ = 0;
  327|   403k|                continue;
  328|       |
  329|   403k|            } else if (int_count_ > 0) {
  ------------------
  |  Branch (329:24): [True: 256k, False: 0]
  ------------------
  330|       |                // Process the buffered integers before processing the current token.
  331|   256k|                if (int_count_ > 1) {
  ------------------
  |  Branch (331:21): [True: 72.4k, False: 184k]
  ------------------
  332|  72.4k|                    add_int(int_count_ - 1);
  333|  72.4k|                }
  334|   256k|                add_int(int_count_);
  335|   256k|                int_count_ = 0;
  336|   256k|            }
  337|  2.52M|        }
  338|       |
  339|  26.7M|        switch (tokenizer_.getType()) {
  340|  7.03k|        case QPDFTokenizer::tt_eof:
  ------------------
  |  Branch (340:9): [True: 7.03k, False: 26.6M]
  ------------------
  341|  7.03k|            warn("parse error while reading object");
  342|  7.03k|            if (content_stream) {
  ------------------
  |  Branch (342:17): [True: 0, False: 7.03k]
  ------------------
  343|       |                // In content stream mode, leave object uninitialized to indicate EOF
  344|      0|                return {};
  345|      0|            }
  346|  7.03k|            warn("unexpected EOF");
  347|  7.03k|            return {};
  348|       |
  349|  29.4k|        case QPDFTokenizer::tt_bad:
  ------------------
  |  Branch (349:9): [True: 29.4k, False: 26.6M]
  ------------------
  350|  29.4k|            check_too_many_bad_tokens();
  351|  29.4k|            add_null();
  352|  29.4k|            continue;
  353|       |
  354|  2.78k|        case QPDFTokenizer::tt_brace_open:
  ------------------
  |  Branch (354:9): [True: 2.78k, False: 26.7M]
  ------------------
  355|  3.95k|        case QPDFTokenizer::tt_brace_close:
  ------------------
  |  Branch (355:9): [True: 1.16k, False: 26.7M]
  ------------------
  356|  3.95k|            add_bad_null("treating unexpected brace token as null");
  357|  3.95k|            continue;
  358|       |
  359|   107k|        case QPDFTokenizer::tt_array_close:
  ------------------
  |  Branch (359:9): [True: 107k, False: 26.5M]
  ------------------
  360|   107k|            if (frame_->state == st_array) {
  ------------------
  |  Branch (360:17): [True: 105k, False: 1.92k]
  ------------------
  361|   105k|                auto object = frame_->null_count > 100
  ------------------
  |  Branch (361:31): [True: 915, False: 104k]
  ------------------
  362|   105k|                    ? QPDFObject::create<QPDF_Array>(std::move(frame_->olist), true)
  363|   105k|                    : QPDFObject::create<QPDF_Array>(std::move(frame_->olist));
  364|   105k|                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|   105k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (369:21): [True: 2.25k, False: 103k]
  ------------------
  370|  2.25k|                    return object;
  371|  2.25k|                }
  372|   103k|                stack_.pop_back();
  373|   103k|                frame_ = &stack_.back();
  374|   103k|                add(std::move(object));
  375|   103k|            } else {
  376|  1.92k|                if (sanity_checks_) {
  ------------------
  |  Branch (376:21): [True: 1.17k, False: 747]
  ------------------
  377|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  378|       |                    // unusable.
  379|  1.17k|                    warn("unexpected array close token; giving up on reading object");
  380|  1.17k|                    return {};
  381|  1.17k|                }
  382|    747|                add_bad_null("treating unexpected array close token as null");
  383|    747|            }
  384|   103k|            continue;
  385|       |
  386|   185k|        case QPDFTokenizer::tt_dict_close:
  ------------------
  |  Branch (386:9): [True: 185k, False: 26.5M]
  ------------------
  387|   185k|            if (frame_->state <= st_dictionary_value) {
  ------------------
  |  Branch (387:17): [True: 183k, False: 1.70k]
  ------------------
  388|       |                // Attempt to recover more or less gracefully from invalid dictionaries.
  389|   183k|                auto& dict = frame_->dict;
  390|       |
  391|   183k|                if (frame_->state == st_dictionary_value) {
  ------------------
  |  Branch (391:21): [True: 12.0k, False: 171k]
  ------------------
  392|  12.0k|                    warn(
  393|  12.0k|                        frame_->offset,
  394|  12.0k|                        "dictionary ended prematurely; using null as value for last key");
  395|  12.0k|                    dict[frame_->key] = QPDFObject::create<QPDF_Null>();
  396|  12.0k|                }
  397|   183k|                if (!frame_->olist.empty()) {
  ------------------
  |  Branch (397:21): [True: 47.0k, False: 136k]
  ------------------
  398|  47.0k|                    if (sanity_checks_) {
  ------------------
  |  Branch (398:25): [True: 42.9k, False: 4.15k]
  ------------------
  399|  42.9k|                        warn(
  400|  42.9k|                            frame_->offset,
  401|  42.9k|                            "expected dictionary keys but found non-name objects; ignoring");
  402|  42.9k|                    } else {
  403|  4.15k|                        fix_missing_keys();
  404|  4.15k|                    }
  405|  47.0k|                }
  406|       |
  407|   183k|                if (!frame_->contents_string.empty() && dict.contains("/Type") &&
  ------------------
  |  Branch (407:21): [True: 410, False: 182k]
  |  Branch (407:21): [True: 22, False: 183k]
  |  Branch (407:57): [True: 136, False: 274]
  ------------------
  408|    136|                    dict["/Type"].isNameAndEquals("/Sig") && dict.contains("/ByteRange") &&
  ------------------
  |  Branch (408:21): [True: 68, False: 68]
  |  Branch (408:62): [True: 32, False: 36]
  ------------------
  409|     32|                    dict.contains("/Contents") && dict["/Contents"].isString()) {
  ------------------
  |  Branch (409:21): [True: 22, False: 10]
  |  Branch (409:51): [True: 22, False: 0]
  ------------------
  410|     22|                    dict["/Contents"] = QPDFObjectHandle::newString(frame_->contents_string);
  411|     22|                    dict["/Contents"].setParsedOffset(frame_->contents_offset);
  412|     22|                }
  413|   183k|                auto object = QPDFObject::create<QPDF_Dictionary>(std::move(dict));
  414|   183k|                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|   183k|                if (stack_.size() <= 1) {
  ------------------
  |  Branch (419:21): [True: 125k, False: 58.3k]
  ------------------
  420|   125k|                    return object;
  421|   125k|                }
  422|  58.3k|                stack_.pop_back();
  423|  58.3k|                frame_ = &stack_.back();
  424|  58.3k|                add(std::move(object));
  425|  58.3k|            } else {
  426|  1.70k|                if (sanity_checks_) {
  ------------------
  |  Branch (426:21): [True: 1.10k, False: 596]
  ------------------
  427|       |                    // During sanity checks, assume nesting of containers is corrupt and object is
  428|       |                    // unusable.
  429|  1.10k|                    warn("unexpected dictionary close token; giving up on reading object");
  430|  1.10k|                    return {};
  431|  1.10k|                }
  432|    596|                add_bad_null("unexpected dictionary close token");
  433|    596|            }
  434|  58.8k|            continue;
  435|       |
  436|   152k|        case QPDFTokenizer::tt_array_open:
  ------------------
  |  Branch (436:9): [True: 152k, False: 26.5M]
  ------------------
  437|   276k|        case QPDFTokenizer::tt_dict_open:
  ------------------
  |  Branch (437:9): [True: 124k, False: 26.5M]
  ------------------
  438|   276k|            if (stack_.size() > max_nesting) {
  ------------------
  |  Branch (438:17): [True: 84, False: 276k]
  ------------------
  439|     84|                limits_error(
  440|     84|                    "parser-max-nesting", "ignoring excessively deeply nested data structure");
  441|     84|            }
  442|   276k|            b_contents = false;
  443|   276k|            stack_.emplace_back(
  444|   276k|                input_,
  445|   276k|                (tokenizer_.getType() == QPDFTokenizer::tt_array_open) ? st_array
  ------------------
  |  Branch (445:17): [True: 152k, False: 124k]
  ------------------
  446|   276k|                                                                       : st_dictionary_key);
  447|   276k|            frame_ = &stack_.back();
  448|   276k|            continue;
  449|       |
  450|  11.7k|        case QPDFTokenizer::tt_bool:
  ------------------
  |  Branch (450:9): [True: 11.7k, False: 26.6M]
  ------------------
  451|  11.7k|            add_scalar<QPDF_Bool>(tokenizer_.getValue() == "true");
  452|  11.7k|            continue;
  453|       |
  454|   252k|        case QPDFTokenizer::tt_null:
  ------------------
  |  Branch (454:9): [True: 252k, False: 26.4M]
  ------------------
  455|   252k|            add_null();
  456|   252k|            continue;
  457|       |
  458|   660k|        case QPDFTokenizer::tt_integer:
  ------------------
  |  Branch (458:9): [True: 660k, False: 26.0M]
  ------------------
  459|   660k|            if (!content_stream) {
  ------------------
  |  Branch (459:17): [True: 660k, False: 0]
  ------------------
  460|       |                // Buffer token in case it is part of an indirect reference.
  461|   660k|                last_offset_buffer_[1] = input_.getLastOffset();
  462|   660k|                int_buffer_[1] = QUtil::string_to_ll(tokenizer_.getValue().c_str());
  463|   660k|                int_count_ = 1;
  464|   660k|            } else {
  465|      0|                add_scalar<QPDF_Integer>(QUtil::string_to_ll(tokenizer_.getValue().c_str()));
  466|      0|            }
  467|   660k|            continue;
  468|       |
  469|  79.9k|        case QPDFTokenizer::tt_real:
  ------------------
  |  Branch (469:9): [True: 79.9k, False: 26.6M]
  ------------------
  470|  79.9k|            add_scalar<QPDF_Real>(tokenizer_.getValue());
  471|  79.9k|            continue;
  472|       |
  473|  24.8M|        case QPDFTokenizer::tt_name:
  ------------------
  |  Branch (473:9): [True: 24.8M, False: 1.89M]
  ------------------
  474|  24.8M|            if (frame_->state == st_dictionary_key) {
  ------------------
  |  Branch (474:17): [True: 878k, False: 23.9M]
  ------------------
  475|   878k|                frame_->key = tokenizer_.getValue();
  476|   878k|                frame_->state = st_dictionary_value;
  477|   878k|                b_contents = decrypter_ && frame_->key == "/Contents";
  ------------------
  |  Branch (477:30): [True: 81.5k, False: 797k]
  |  Branch (477:44): [True: 2.47k, False: 79.0k]
  ------------------
  478|   878k|                continue;
  479|  23.9M|            } else {
  480|  23.9M|                add_scalar<QPDF_Name>(tokenizer_.getValue());
  481|  23.9M|            }
  482|  23.9M|            continue;
  483|       |
  484|  23.9M|        case QPDFTokenizer::tt_word:
  ------------------
  |  Branch (484:9): [True: 193k, False: 26.5M]
  ------------------
  485|   193k|            if (content_stream) {
  ------------------
  |  Branch (485:17): [True: 0, False: 193k]
  ------------------
  486|      0|                add_scalar<QPDF_Operator>(tokenizer_.getValue());
  487|      0|                continue;
  488|      0|            }
  489|       |
  490|   193k|            if (sanity_checks_) {
  ------------------
  |  Branch (490:17): [True: 182k, False: 11.7k]
  ------------------
  491|   182k|                if (tokenizer_.getValue() == "endobj" || tokenizer_.getValue() == "endstream") {
  ------------------
  |  Branch (491:21): [True: 1.62k, False: 180k]
  |  Branch (491:58): [True: 599, False: 179k]
  ------------------
  492|       |                    // During sanity checks, assume an unexpected endobj or endstream indicates that
  493|       |                    // we are parsing past the end of the object.
  494|  2.22k|                    warn(
  495|  2.22k|                        "unexpected 'endobj' or 'endstream' while reading object; giving up on "
  496|  2.22k|                        "reading object");
  497|  2.22k|                    return {};
  498|  2.22k|                }
  499|       |
  500|   179k|                add_bad_null("unknown token while reading object; treating as null");
  501|   179k|                continue;
  502|   182k|            }
  503|       |
  504|  11.7k|            warn("unknown token while reading object; treating as string");
  505|  11.7k|            check_too_many_bad_tokens();
  506|  11.7k|            add_scalar<QPDF_String>(tokenizer_.getValue());
  507|       |
  508|  11.7k|            continue;
  509|       |
  510|  82.0k|        case QPDFTokenizer::tt_string:
  ------------------
  |  Branch (510:9): [True: 82.0k, False: 26.6M]
  ------------------
  511|  82.0k|            {
  512|  82.0k|                auto const& val = tokenizer_.getValue();
  513|  82.0k|                if (decrypter_) {
  ------------------
  |  Branch (513:21): [True: 19.1k, False: 62.9k]
  ------------------
  514|  19.1k|                    if (b_contents) {
  ------------------
  |  Branch (514:25): [True: 1.73k, False: 17.4k]
  ------------------
  515|  1.73k|                        frame_->contents_string = val;
  516|  1.73k|                        frame_->contents_offset = input_.getLastOffset();
  517|  1.73k|                        b_contents = false;
  518|  1.73k|                    }
  519|  19.1k|                    std::string s{val};
  520|  19.1k|                    decrypter_->decryptString(s);
  521|  19.1k|                    add_scalar<QPDF_String>(s);
  522|  62.9k|                } else {
  523|  62.9k|                    add_scalar<QPDF_String>(val);
  524|  62.9k|                }
  525|  82.0k|            }
  526|  82.0k|            continue;
  527|       |
  528|      0|        default:
  ------------------
  |  Branch (528:9): [True: 0, False: 26.7M]
  ------------------
  529|      0|            add_bad_null("treating unknown token type as null while reading object");
  530|  26.7M|        }
  531|  26.7M|    }
  532|   151k|}
_ZN4qpdf4impl6Parser3addEONSt3__110shared_ptrI10QPDFObjectEE:
  536|  26.3M|{
  537|  26.3M|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (537:9): [True: 25.5M, False: 821k]
  ------------------
  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|  25.5M|        frame_->olist.emplace_back(std::move(obj));
  541|  25.5M|    } else {
  542|   821k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, std::move(obj)); !res.second) {
  ------------------
  |  Branch (542:84): [True: 9.89k, False: 811k]
  ------------------
  543|  9.89k|            warn_duplicate_key();
  544|  9.89k|        }
  545|   821k|        frame_->state = st_dictionary_key;
  546|   821k|    }
  547|  26.3M|}
_ZN4qpdf4impl6Parser8add_nullEv:
  551|   460k|{
  552|   460k|    const static ObjectPtr null_obj = QPDFObject::create<QPDF_Null>();
  553|       |
  554|   460k|    if (frame_->state != st_dictionary_value) {
  ------------------
  |  Branch (554:9): [True: 427k, False: 33.0k]
  ------------------
  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|   427k|        frame_->olist.emplace_back(null_obj);
  558|   427k|    } else {
  559|  33.0k|        if (auto res = frame_->dict.insert_or_assign(frame_->key, null_obj); !res.second) {
  ------------------
  |  Branch (559:78): [True: 3.17k, False: 29.9k]
  ------------------
  560|  3.17k|            warn_duplicate_key();
  561|  3.17k|        }
  562|  33.0k|        frame_->state = st_dictionary_key;
  563|  33.0k|    }
  564|   460k|    ++frame_->null_count;
  565|   460k|}
_ZN4qpdf4impl6Parser12add_bad_nullERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  569|   187k|{
  570|   187k|    warn(msg);
  571|   187k|    check_too_many_bad_tokens();
  572|   187k|    add_null();
  573|   187k|}
_ZN4qpdf4impl6Parser7add_intEi:
  577|  1.71M|{
  578|  1.71M|    auto obj = QPDFObject::create<QPDF_Integer>(int_buffer_[count % 2]);
  579|  1.71M|    obj->setDescription(context_, description_, last_offset_buffer_[count % 2]);
  580|  1.71M|    add(std::move(obj));
  581|  1.71M|}
_ZN4qpdf4impl6Parser15set_descriptionERNSt3__110shared_ptrI10QPDFObjectEEx:
  610|   288k|{
  611|   288k|    if (obj) {
  ------------------
  |  Branch (611:9): [True: 288k, False: 0]
  ------------------
  612|   288k|        obj->setDescription(context_, description_, parsed_offset);
  613|   288k|    }
  614|   288k|}
_ZN4qpdf4impl6Parser16fix_missing_keysEv:
  618|  4.15k|{
  619|  4.15k|    std::set<std::string> names;
  620|  17.0k|    for (auto& obj: frame_->olist) {
  ------------------
  |  Branch (620:19): [True: 17.0k, False: 4.15k]
  ------------------
  621|  17.0k|        if (obj.raw_type_code() == ::ot_name) {
  ------------------
  |  Branch (621:13): [True: 383, False: 16.7k]
  ------------------
  622|    383|            names.insert(obj.getName());
  623|    383|        }
  624|  17.0k|    }
  625|  4.15k|    int next_fake_key = 1;
  626|  17.0k|    for (auto const& item: frame_->olist) {
  ------------------
  |  Branch (626:26): [True: 17.0k, False: 4.15k]
  ------------------
  627|  17.0k|        while (true) {
  ------------------
  |  Branch (627:16): [True: 17.0k, Folded]
  ------------------
  628|  17.0k|            const std::string key = "/QPDFFake" + std::to_string(next_fake_key++);
  629|  17.0k|            const bool found_fake = !frame_->dict.contains(key) && !names.contains(key);
  ------------------
  |  Branch (629:37): [True: 17.0k, False: 22]
  |  Branch (629:68): [True: 17.0k, False: 4]
  ------------------
  630|  17.0k|            QTC::TC("qpdf", "QPDFParser found fake", (found_fake ? 0 : 1));
  ------------------
  |  Branch (630:55): [True: 17.0k, False: 26]
  ------------------
  631|  17.0k|            if (found_fake) {
  ------------------
  |  Branch (631:17): [True: 17.0k, False: 26]
  ------------------
  632|  17.0k|                warn(
  633|  17.0k|                    frame_->offset,
  634|  17.0k|                    "expected dictionary key but found non-name object; inserting key " + key);
  635|  17.0k|                frame_->dict[key] = item;
  636|  17.0k|                break;
  637|  17.0k|            }
  638|  17.0k|        }
  639|  17.0k|    }
  640|  4.15k|}
_ZN4qpdf4impl6Parser25check_too_many_bad_tokensEv:
  644|   240k|{
  645|   240k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (645:52): [True: 180k, False: 60.2k]
  |  Branch (645:66): [True: 56.0k, False: 4.21k]
  ------------------
  646|   240k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (646:9): [True: 317, False: 240k]
  |  Branch (646:42): [True: 0, False: 240k]
  ------------------
  647|    317|        if (bad_count_) {
  ------------------
  |  Branch (647:13): [True: 233, False: 84]
  ------------------
  648|    233|            limits_error(
  649|    233|                "parser-max-container-size-damaged",
  650|    233|                "encountered errors while parsing an array or dictionary with more than " +
  651|    233|                    std::to_string(limit) + " elements; giving up on reading object");
  652|    233|        }
  653|    317|        limits_error(
  654|    317|            "parser-max-container-size",
  655|    317|            "encountered an array or dictionary with more than " + std::to_string(limit) +
  656|    317|                " elements during xref recovery; giving up on reading object");
  657|    317|    }
  658|   240k|    if (max_bad_count_ && --max_bad_count_ == 0) {
  ------------------
  |  Branch (658:9): [True: 240k, False: 317]
  |  Branch (658:27): [True: 2.19k, False: 238k]
  ------------------
  659|  2.19k|        limits_error(
  660|  2.19k|            "parser-max-errors", "too many errors during parsing; treating object as null");
  661|  2.19k|    }
  662|   240k|    if (good_count_ > 4) {
  ------------------
  |  Branch (662:9): [True: 87.9k, False: 152k]
  ------------------
  663|  87.9k|        good_count_ = 0;
  664|  87.9k|        bad_count_ = 1;
  665|  87.9k|        return;
  666|  87.9k|    }
  667|   152k|    if (++bad_count_ > 5 ||
  ------------------
  |  Branch (667:9): [True: 7.28k, False: 145k]
  ------------------
  668|   145k|        (frame_->state != st_array && std::cmp_less(max_bad_count_, frame_->olist.size()))) {
  ------------------
  |  Branch (668:10): [True: 97.3k, False: 47.9k]
  |  Branch (668:39): [True: 2.14k, False: 95.2k]
  ------------------
  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|  6.91k|        warn("too many errors; giving up on reading object");
  672|  6.91k|        throw Error();
  673|  6.91k|    }
  674|   145k|    good_count_ = 0;
  675|   145k|}
_ZN4qpdf4impl6Parser12limits_errorERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_:
  679|  2.59k|{
  680|  2.59k|    Limits::error();
  681|  2.59k|    warn("limits error("s + limit + "): " + msg);
  682|  2.59k|    throw Error();
  683|  2.59k|}
_ZNK4qpdf4impl6Parser4warnERK7QPDFExc:
  687|   361k|{
  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|   361k|    if (context_) {
  ------------------
  |  Branch (691:9): [True: 361k, False: 0]
  ------------------
  692|   361k|        context_->warn(e);
  693|   361k|    } else {
  694|      0|        throw e;
  695|      0|    }
  696|   361k|}
_ZN4qpdf4impl6Parser18warn_duplicate_keyEv:
  700|  13.0k|{
  701|  13.0k|    warn(
  702|  13.0k|        frame_->offset,
  703|  13.0k|        "dictionary has duplicated key " + frame_->key +
  704|  13.0k|            "; last occurrence overrides earlier ones");
  705|  13.0k|    check_too_many_bad_tokens();
  706|  13.0k|}
_ZNK4qpdf4impl6Parser4warnExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  710|   361k|{
  711|   361k|    if (stream_id_) {
  ------------------
  |  Branch (711:9): [True: 24.3k, False: 337k]
  ------------------
  712|  24.3k|        std::string descr = "object "s + std::to_string(obj_id_) + " 0";
  713|  24.3k|        std::string name = context_->getFilename() + " object stream " + std::to_string(stream_id_);
  714|  24.3k|        warn(QPDFExc(qpdf_e_damaged_pdf, name, descr, offset, msg));
  715|   337k|    } else {
  716|   337k|        warn(QPDFExc(qpdf_e_damaged_pdf, input_.getName(), object_description_, offset, msg));
  717|   337k|    }
  718|   361k|}
_ZNK4qpdf4impl6Parser4warnERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  722|   276k|{
  723|   276k|    warn(input_.getLastOffset(), msg);
  724|   276k|}
_ZN4QPDF3Doc10ParseGuardC2EPS_:
   26|   176k|        objects(qpdf ? &qpdf->m->objects : nullptr)
  ------------------
  |  Branch (26:17): [True: 176k, False: 28]
  ------------------
   27|   176k|    {
   28|   176k|        if (objects) {
  ------------------
  |  Branch (28:13): [True: 176k, False: 28]
  ------------------
   29|   176k|            objects->inParse(true);
   30|   176k|        }
   31|   176k|    }
_ZN4QPDF3Doc10ParseGuardD2Ev:
   40|   176k|    {
   41|   176k|        if (objects) {
  ------------------
  |  Branch (41:13): [True: 176k, False: 28]
  ------------------
   42|   176k|            objects->inParse(false);
   43|   176k|        }
   44|   176k|    }
_ZN4QPDF3Doc10ParseGuard9getObjectEPS_iib:
   35|   400k|    {
   36|   400k|        return qpdf->m->objects.getObjectForParser(id, gen, parse_pdf);
   37|   400k|    }
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_BoolJbEEE16QPDFObjectHandleDpOT0_:
  602|    352|{
  603|    352|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    352|    obj->setDescription(context_, description_, start_);
  605|    352|    return {obj};
  606|    352|}
_ZN4qpdf4impl6Parser16with_descriptionI12QPDF_IntegerJxEEE16QPDFObjectHandleDpOT0_:
  602|  9.89k|{
  603|  9.89k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  9.89k|    obj->setDescription(context_, description_, start_);
  605|  9.89k|    return {obj};
  606|  9.89k|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|    756|{
  603|    756|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|    756|    obj->setDescription(context_, description_, start_);
  605|    756|    return {obj};
  606|    756|}
_ZN4qpdf4impl6Parser16with_descriptionI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  1.53k|{
  603|  1.53k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  1.53k|    obj->setDescription(context_, description_, start_);
  605|  1.53k|    return {obj};
  606|  1.53k|}
_ZN4qpdf4impl6Parser16with_descriptionI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEE16QPDFObjectHandleDpOT0_:
  602|  8.03k|{
  603|  8.03k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  604|  8.03k|    obj->setDescription(context_, description_, start_);
  605|  8.03k|    return {obj};
  606|  8.03k|}
_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|  11.7k|{
  587|  11.7k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 3.27k, False: 8.47k]
  |  Branch (587:66): [True: 5.92k, False: 2.55k]
  ------------------
  588|  11.7k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 35, False: 11.7k]
  |  Branch (588:42): [True: 0, False: 11.7k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     35|        max_bad_count_ = 1;
  592|     35|        check_too_many_bad_tokens(); // always throws Error()
  593|     35|    }
  594|  11.7k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  11.7k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  11.7k|    add(std::move(obj));
  597|  11.7k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_RealJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  79.9k|{
  587|  79.9k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 10.9k, False: 69.0k]
  |  Branch (587:66): [True: 61.3k, False: 7.63k]
  ------------------
  588|  79.9k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 38, False: 79.8k]
  |  Branch (588:42): [True: 0, False: 79.8k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     38|        max_bad_count_ = 1;
  592|     38|        check_too_many_bad_tokens(); // always throws Error()
  593|     38|    }
  594|  79.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  79.9k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  79.9k|    add(std::move(obj));
  597|  79.9k|}
_ZN4qpdf4impl6Parser10add_scalarI9QPDF_NameJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  23.9M|{
  587|  23.9M|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 1.26M, False: 22.6M]
  |  Branch (587:66): [True: 581k, False: 22.0M]
  ------------------
  588|  23.9M|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 166, False: 23.9M]
  |  Branch (588:42): [True: 0, False: 23.9M]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|    166|        max_bad_count_ = 1;
  592|    166|        check_too_many_bad_tokens(); // always throws Error()
  593|    166|    }
  594|  23.9M|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  23.9M|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  23.9M|    add(std::move(obj));
  597|  23.9M|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  74.3k|{
  587|  74.3k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 53.5k, False: 20.7k]
  |  Branch (587:66): [True: 17.8k, False: 2.90k]
  ------------------
  588|  74.3k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 59, False: 74.3k]
  |  Branch (588:42): [True: 0, False: 74.3k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|     59|        max_bad_count_ = 1;
  592|     59|        check_too_many_bad_tokens(); // always throws Error()
  593|     59|    }
  594|  74.3k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  74.3k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  74.3k|    add(std::move(obj));
  597|  74.3k|}
_ZN4qpdf4impl6Parser10add_scalarI11QPDF_StringJRNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEEEEEvDpOT0_:
  586|  18.9k|{
  587|  18.9k|    auto limit = Limits::parser_max_container_size(bad_count_ || sanity_checks_);
  ------------------
  |  Branch (587:52): [True: 15.1k, False: 3.76k]
  |  Branch (587:66): [True: 3.69k, False: 73]
  ------------------
  588|  18.9k|    if (frame_->olist.size() >= limit || frame_->dict.size() >= limit) {
  ------------------
  |  Branch (588:9): [True: 6, False: 18.9k]
  |  Branch (588:42): [True: 0, False: 18.9k]
  ------------------
  589|       |        // Stop adding scalars. We are going to abort when the close token or a bad token is
  590|       |        // encountered.
  591|      6|        max_bad_count_ = 1;
  592|      6|        check_too_many_bad_tokens(); // always throws Error()
  593|      6|    }
  594|  18.9k|    auto obj = QPDFObject::create<T>(std::forward<Args>(args)...);
  595|  18.9k|    obj->setDescription(context_, description_, input_.getLastOffset());
  596|  18.9k|    add(std::move(obj));
  597|  18.9k|}

_ZN16QPDFStreamFilter14setDecodeParmsE16QPDFObjectHandle:
    7|  11.8k|{
    8|  11.8k|    return decode_parms.null();
    9|  11.8k|}
_ZN16QPDFStreamFilter24isSpecializedCompressionEv:
   13|     21|{
   14|     21|    return false;
   15|     21|}
_ZN16QPDFStreamFilter18isLossyCompressionEv:
   19|  8.11k|{
   20|  8.11k|    return false;
   21|  8.11k|}

_ZN4qpdf9Tokenizer5resetEv:
   85|  37.9M|{
   86|  37.9M|    state = st_before_token;
   87|  37.9M|    type = tt::tt_bad;
   88|  37.9M|    val.clear();
   89|  37.9M|    raw_val.clear();
   90|  37.9M|    error_message = "";
   91|  37.9M|    before_token = true;
   92|  37.9M|    in_token = false;
   93|  37.9M|    char_to_unread = '\0';
   94|  37.9M|    inline_image_bytes = 0;
   95|  37.9M|    string_depth = 0;
   96|  37.9M|    bad = false;
   97|  37.9M|}
_ZN13QPDFTokenizer5TokenC2ENS_12token_type_eERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  100|  4.41k|    type(type),
  101|  4.41k|    value(value),
  102|  4.41k|    raw_value(value)
  103|  4.41k|{
  104|  4.41k|    if (type == tt_string) {
  ------------------
  |  Branch (104:9): [True: 0, False: 4.41k]
  ------------------
  105|      0|        raw_value = QPDFObjectHandle::newString(value).unparse();
  106|  4.41k|    } else if (type == tt_name) {
  ------------------
  |  Branch (106:16): [True: 0, False: 4.41k]
  ------------------
  107|      0|        raw_value = QPDFObjectHandle::newName(value).unparse();
  108|      0|    }
  109|  4.41k|}
_ZN13QPDFTokenizerC2Ev:
  112|  2.79k|    m(std::make_unique<qpdf::Tokenizer>())
  113|  2.79k|{
  114|  2.79k|}
_ZN13QPDFTokenizerD2Ev:
  116|  2.79k|QPDFTokenizer::~QPDFTokenizer() = default;
_ZN4qpdf9TokenizerC2Ev:
  119|  69.4k|{
  120|  69.4k|    reset();
  121|  69.4k|}
_ZN13QPDFTokenizer8allowEOFEv:
  125|  2.79k|{
  126|  2.79k|    m->allowEOF();
  127|  2.79k|}
_ZN4qpdf9Tokenizer8allowEOFEv:
  131|  24.8k|{
  132|  24.8k|    allow_eof = true;
  133|  24.8k|}
_ZN13QPDFTokenizer16includeIgnorableEv:
  137|  2.79k|{
  138|  2.79k|    m->includeIgnorable();
  139|  2.79k|}
_ZN4qpdf9Tokenizer16includeIgnorableEv:
  143|  2.79k|{
  144|  2.79k|    include_ignorable = true;
  145|  2.79k|}
_ZN4qpdf9Tokenizer7isSpaceEc:
  149|  51.9M|{
  150|  51.9M|    return (ch == '\0' || util::is_space(ch));
  ------------------
  |  Branch (150:13): [True: 10.9M, False: 40.9M]
  |  Branch (150:27): [True: 7.36M, False: 33.6M]
  ------------------
  151|  51.9M|}
_ZN4qpdf9Tokenizer11isDelimiterEc:
  155|   126M|{
  156|   126M|    return is_delimiter(ch);
  157|   126M|}
_ZN4qpdf9Tokenizer16presentCharacterEc:
  167|  18.2k|{
  168|  18.2k|    handleCharacter(ch);
  169|       |
  170|  18.2k|    if (in_token) {
  ------------------
  |  Branch (170:9): [True: 0, False: 18.2k]
  ------------------
  171|      0|        raw_val += ch;
  172|      0|    }
  173|  18.2k|}
_ZN4qpdf9Tokenizer15handleCharacterEc:
  177|   315M|{
  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|   315M|    switch (state) {
  182|      0|    case st_top:
  ------------------
  |  Branch (182:5): [True: 0, False: 315M]
  ------------------
  183|      0|        inTop(ch);
  184|      0|        return;
  185|       |
  186|  5.73M|    case st_in_space:
  ------------------
  |  Branch (186:5): [True: 5.73M, False: 309M]
  ------------------
  187|  5.73M|        inSpace(ch);
  188|  5.73M|        return;
  189|       |
  190|  15.8M|    case st_in_comment:
  ------------------
  |  Branch (190:5): [True: 15.8M, False: 299M]
  ------------------
  191|  15.8M|        inComment(ch);
  192|  15.8M|        return;
  193|       |
  194|   463k|    case st_lt:
  ------------------
  |  Branch (194:5): [True: 463k, False: 314M]
  ------------------
  195|   463k|        inLt(ch);
  196|   463k|        return;
  197|       |
  198|   276k|    case st_gt:
  ------------------
  |  Branch (198:5): [True: 276k, False: 315M]
  ------------------
  199|   276k|        inGt(ch);
  200|   276k|        return;
  201|       |
  202|   103M|    case st_in_string:
  ------------------
  |  Branch (202:5): [True: 103M, False: 212M]
  ------------------
  203|   103M|        inString(ch);
  204|   103M|        return;
  205|       |
  206|  80.5M|    case st_name:
  ------------------
  |  Branch (206:5): [True: 80.5M, False: 234M]
  ------------------
  207|  80.5M|        inName(ch);
  208|  80.5M|        return;
  209|       |
  210|  18.1M|    case st_number:
  ------------------
  |  Branch (210:5): [True: 18.1M, False: 297M]
  ------------------
  211|  18.1M|        inNumber(ch);
  212|  18.1M|        return;
  213|       |
  214|   518k|    case st_real:
  ------------------
  |  Branch (214:5): [True: 518k, False: 314M]
  ------------------
  215|   518k|        inReal(ch);
  216|   518k|        return;
  217|       |
  218|   317k|    case st_string_after_cr:
  ------------------
  |  Branch (218:5): [True: 317k, False: 315M]
  ------------------
  219|   317k|        inStringAfterCR(ch);
  220|   317k|        return;
  221|       |
  222|  82.6k|    case st_string_escape:
  ------------------
  |  Branch (222:5): [True: 82.6k, False: 315M]
  ------------------
  223|  82.6k|        inStringEscape(ch);
  224|  82.6k|        return;
  225|       |
  226|  63.6k|    case st_char_code:
  ------------------
  |  Branch (226:5): [True: 63.6k, False: 315M]
  ------------------
  227|  63.6k|        inCharCode(ch);
  228|  63.6k|        return;
  229|       |
  230|  41.5M|    case st_literal:
  ------------------
  |  Branch (230:5): [True: 41.5M, False: 273M]
  ------------------
  231|  41.5M|        inLiteral(ch);
  232|  41.5M|        return;
  233|       |
  234|  1.73M|    case st_inline_image:
  ------------------
  |  Branch (234:5): [True: 1.73M, False: 313M]
  ------------------
  235|  1.73M|        inInlineImage(ch);
  236|  1.73M|        return;
  237|       |
  238|   282k|    case st_in_hexstring:
  ------------------
  |  Branch (238:5): [True: 282k, False: 315M]
  ------------------
  239|   282k|        inHexstring(ch);
  240|   282k|        return;
  241|       |
  242|   160k|    case st_in_hexstring_2nd:
  ------------------
  |  Branch (242:5): [True: 160k, False: 315M]
  ------------------
  243|   160k|        inHexstring2nd(ch);
  244|   160k|        return;
  245|       |
  246|   239k|    case st_name_hex1:
  ------------------
  |  Branch (246:5): [True: 239k, False: 315M]
  ------------------
  247|   239k|        inNameHex1(ch);
  248|   239k|        return;
  249|       |
  250|  21.1k|    case st_name_hex2:
  ------------------
  |  Branch (250:5): [True: 21.1k, False: 315M]
  ------------------
  251|  21.1k|        inNameHex2(ch);
  252|  21.1k|        return;
  253|       |
  254|  58.5k|    case st_sign:
  ------------------
  |  Branch (254:5): [True: 58.5k, False: 315M]
  ------------------
  255|  58.5k|        inSign(ch);
  256|  58.5k|        return;
  257|       |
  258|  19.2k|    case st_decimal:
  ------------------
  |  Branch (258:5): [True: 19.2k, False: 315M]
  ------------------
  259|  19.2k|        inDecimal(ch);
  260|  19.2k|        return;
  261|       |
  262|  46.0M|    case (st_before_token):
  ------------------
  |  Branch (262:5): [True: 46.0M, False: 269M]
  ------------------
  263|  46.0M|        inBeforeToken(ch);
  264|  46.0M|        return;
  265|       |
  266|      0|    case (st_token_ready):
  ------------------
  |  Branch (266:5): [True: 0, False: 315M]
  ------------------
  267|      0|        inTokenReady(ch);
  268|      0|        return;
  269|       |
  270|      0|    default:
  ------------------
  |  Branch (270:5): [True: 0, False: 315M]
  ------------------
  271|      0|        throw std::logic_error("INTERNAL ERROR: invalid state while reading token");
  272|   315M|    }
  273|   315M|}
_ZN4qpdf9Tokenizer13inBeforeTokenEc:
  284|  46.0M|{
  285|       |    // Note: we specifically do not use ctype here.  It is locale-dependent.
  286|  46.0M|    if (isSpace(ch)) {
  ------------------
  |  Branch (286:9): [True: 13.0M, False: 33.0M]
  ------------------
  287|  13.0M|        before_token = !include_ignorable;
  288|  13.0M|        in_token = include_ignorable;
  289|  13.0M|        if (include_ignorable) {
  ------------------
  |  Branch (289:13): [True: 561k, False: 12.4M]
  ------------------
  290|   561k|            state = st_in_space;
  291|   561k|        }
  292|  33.0M|    } else if (ch == '%') {
  ------------------
  |  Branch (292:16): [True: 32.3k, False: 32.9M]
  ------------------
  293|  32.3k|        before_token = !include_ignorable;
  294|  32.3k|        in_token = include_ignorable;
  295|  32.3k|        state = st_in_comment;
  296|  32.9M|    } else {
  297|  32.9M|        before_token = false;
  298|  32.9M|        in_token = true;
  299|  32.9M|        inTop(ch);
  300|  32.9M|    }
  301|  46.0M|}
_ZN4qpdf9Tokenizer5inTopEc:
  305|  32.9M|{
  306|  32.9M|    switch (ch) {
  307|   125k|    case '(':
  ------------------
  |  Branch (307:5): [True: 125k, False: 32.8M]
  ------------------
  308|   125k|        string_depth = 1;
  309|   125k|        state = st_in_string;
  310|   125k|        return;
  311|       |
  312|   463k|    case '<':
  ------------------
  |  Branch (312:5): [True: 463k, False: 32.5M]
  ------------------
  313|   463k|        state = st_lt;
  314|   463k|        return;
  315|       |
  316|   276k|    case '>':
  ------------------
  |  Branch (316:5): [True: 276k, False: 32.7M]
  ------------------
  317|   276k|        state = st_gt;
  318|   276k|        return;
  319|       |
  320|   176k|    case (')'):
  ------------------
  |  Branch (320:5): [True: 176k, False: 32.8M]
  ------------------
  321|   176k|        type = tt::tt_bad;
  322|   176k|        QTC::TC("qpdf", "QPDFTokenizer bad )");
  323|   176k|        error_message = "unexpected )";
  324|   176k|        state = st_token_ready;
  325|   176k|        return;
  326|       |
  327|   180k|    case '[':
  ------------------
  |  Branch (327:5): [True: 180k, False: 32.7M]
  ------------------
  328|   180k|        type = tt::tt_array_open;
  329|   180k|        state = st_token_ready;
  330|   180k|        return;
  331|       |
  332|   133k|    case ']':
  ------------------
  |  Branch (332:5): [True: 133k, False: 32.8M]
  ------------------
  333|   133k|        type = tt::tt_array_close;
  334|   133k|        state = st_token_ready;
  335|   133k|        return;
  336|       |
  337|  25.2k|    case '{':
  ------------------
  |  Branch (337:5): [True: 25.2k, False: 32.9M]
  ------------------
  338|  25.2k|        type = tt::tt_brace_open;
  339|  25.2k|        state = st_token_ready;
  340|  25.2k|        return;
  341|       |
  342|  13.2k|    case '}':
  ------------------
  |  Branch (342:5): [True: 13.2k, False: 32.9M]
  ------------------
  343|  13.2k|        type = tt::tt_brace_close;
  344|  13.2k|        state = st_token_ready;
  345|  13.2k|        return;
  346|       |
  347|  25.2M|    case '/':
  ------------------
  |  Branch (347:5): [True: 25.2M, False: 7.76M]
  ------------------
  348|  25.2M|        state = st_name;
  349|  25.2M|        val += ch;
  350|  25.2M|        return;
  351|       |
  352|   975k|    case '0':
  ------------------
  |  Branch (352:5): [True: 975k, False: 32.0M]
  ------------------
  353|  1.44M|    case '1':
  ------------------
  |  Branch (353:5): [True: 473k, False: 32.5M]
  ------------------
  354|  1.68M|    case '2':
  ------------------
  |  Branch (354:5): [True: 233k, False: 32.7M]
  ------------------
  355|  1.84M|    case '3':
  ------------------
  |  Branch (355:5): [True: 165k, False: 32.8M]
  ------------------
  356|  2.02M|    case '4':
  ------------------
  |  Branch (356:5): [True: 180k, False: 32.7M]
  ------------------
  357|  2.26M|    case '5':
  ------------------
  |  Branch (357:5): [True: 237k, False: 32.7M]
  ------------------
  358|  2.68M|    case '6':
  ------------------
  |  Branch (358:5): [True: 418k, False: 32.5M]
  ------------------
  359|  3.55M|    case '7':
  ------------------
  |  Branch (359:5): [True: 873k, False: 32.1M]
  ------------------
  360|  3.67M|    case '8':
  ------------------
  |  Branch (360:5): [True: 112k, False: 32.8M]
  ------------------
  361|  3.72M|    case '9':
  ------------------
  |  Branch (361:5): [True: 50.4k, False: 32.9M]
  ------------------
  362|  3.72M|        state = st_number;
  363|  3.72M|        return;
  364|       |
  365|  4.60k|    case '+':
  ------------------
  |  Branch (365:5): [True: 4.60k, False: 32.9M]
  ------------------
  366|  58.5k|    case '-':
  ------------------
  |  Branch (366:5): [True: 53.9k, False: 32.9M]
  ------------------
  367|  58.5k|        state = st_sign;
  368|  58.5k|        return;
  369|       |
  370|  18.3k|    case '.':
  ------------------
  |  Branch (370:5): [True: 18.3k, False: 32.9M]
  ------------------
  371|  18.3k|        state = st_decimal;
  372|  18.3k|        return;
  373|       |
  374|  2.57M|    default:
  ------------------
  |  Branch (374:5): [True: 2.57M, False: 30.4M]
  ------------------
  375|  2.57M|        state = st_literal;
  376|  2.57M|        return;
  377|  32.9M|    }
  378|  32.9M|}
_ZN4qpdf9Tokenizer7inSpaceEc:
  382|  5.73M|{
  383|       |    // We only enter this state if include_ignorable is true.
  384|  5.73M|    if (!isSpace(ch)) {
  ------------------
  |  Branch (384:9): [True: 560k, False: 5.17M]
  ------------------
  385|   560k|        type = tt::tt_space;
  386|   560k|        in_token = false;
  387|   560k|        char_to_unread = ch;
  388|   560k|        state = st_token_ready;
  389|   560k|    }
  390|  5.73M|}
_ZN4qpdf9Tokenizer9inCommentEc:
  394|  15.8M|{
  395|  15.8M|    if ((ch == '\r') || (ch == '\n')) {
  ------------------
  |  Branch (395:9): [True: 9.88k, False: 15.8M]
  |  Branch (395:25): [True: 21.2k, False: 15.7M]
  ------------------
  396|  31.1k|        if (include_ignorable) {
  ------------------
  |  Branch (396:13): [True: 4.35k, False: 26.7k]
  ------------------
  397|  4.35k|            type = tt::tt_comment;
  398|  4.35k|            in_token = false;
  399|  4.35k|            char_to_unread = ch;
  400|  4.35k|            state = st_token_ready;
  401|  26.7k|        } else {
  402|  26.7k|            state = st_before_token;
  403|  26.7k|        }
  404|  31.1k|    }
  405|  15.8M|}
_ZN4qpdf9Tokenizer8inStringEc:
  409|   103M|{
  410|   103M|    switch (ch) {
  411|  82.7k|    case '\\':
  ------------------
  |  Branch (411:5): [True: 82.7k, False: 103M]
  ------------------
  412|  82.7k|        state = st_string_escape;
  413|  82.7k|        return;
  414|       |
  415|   118k|    case '(':
  ------------------
  |  Branch (415:5): [True: 118k, False: 103M]
  ------------------
  416|   118k|        val += ch;
  417|   118k|        ++string_depth;
  418|   118k|        return;
  419|       |
  420|   196k|    case ')':
  ------------------
  |  Branch (420:5): [True: 196k, False: 103M]
  ------------------
  421|   196k|        if (--string_depth == 0) {
  ------------------
  |  Branch (421:13): [True: 116k, False: 79.8k]
  ------------------
  422|   116k|            type = tt::tt_string;
  423|   116k|            state = st_token_ready;
  424|   116k|            return;
  425|   116k|        }
  426|       |
  427|  79.8k|        val += ch;
  428|  79.8k|        return;
  429|       |
  430|   316k|    case '\r':
  ------------------
  |  Branch (430:5): [True: 316k, False: 103M]
  ------------------
  431|       |        // CR by itself is converted to LF
  432|   316k|        val += '\n';
  433|   316k|        state = st_string_after_cr;
  434|   316k|        return;
  435|       |
  436|   431k|    case '\n':
  ------------------
  |  Branch (436:5): [True: 431k, False: 103M]
  ------------------
  437|   431k|        val += ch;
  438|   431k|        return;
  439|       |
  440|   102M|    default:
  ------------------
  |  Branch (440:5): [True: 102M, False: 1.14M]
  ------------------
  441|   102M|        val += ch;
  442|   102M|        return;
  443|   103M|    }
  444|   103M|}
_ZN4qpdf9Tokenizer6inNameEc:
  448|  80.8M|{
  449|  80.8M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (449:9): [True: 25.1M, False: 55.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|  25.1M|        type = bad ? tt::tt_bad : tt::tt_name;
  ------------------
  |  Branch (456:16): [True: 597, False: 25.1M]
  ------------------
  457|  25.1M|        in_token = false;
  458|  25.1M|        char_to_unread = ch;
  459|  25.1M|        state = st_token_ready;
  460|  55.6M|    } else if (ch == '#') {
  ------------------
  |  Branch (460:16): [True: 239k, False: 55.3M]
  ------------------
  461|   239k|        char_code = 0;
  462|   239k|        state = st_name_hex1;
  463|  55.3M|    } else {
  464|  55.3M|        val += ch;
  465|  55.3M|    }
  466|  80.8M|}
_ZN4qpdf9Tokenizer10inNameHex1Ec:
  470|   239k|{
  471|   239k|    hex_char = ch;
  472|       |
  473|   239k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (473:48): [True: 21.1k, False: 218k]
  ------------------
  474|  21.1k|        char_code = int(hval) << 4;
  475|  21.1k|        state = st_name_hex2;
  476|   218k|    } else {
  477|   218k|        QTC::TC("qpdf", "QPDFTokenizer bad name 1");
  478|   218k|        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|   218k|        val += '\0';
  481|   218k|        state = st_name;
  482|   218k|        inName(ch);
  483|   218k|    }
  484|   239k|}
_ZN4qpdf9Tokenizer10inNameHex2Ec:
  488|  21.1k|{
  489|  21.1k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (489:48): [True: 8.21k, False: 12.9k]
  ------------------
  490|  8.21k|        char_code |= int(hval);
  491|  12.9k|    } else {
  492|  12.9k|        QTC::TC("qpdf", "QPDFTokenizer bad name 2");
  493|  12.9k|        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|  12.9k|        val += '\0';
  496|  12.9k|        val += hex_char;
  497|  12.9k|        state = st_name;
  498|  12.9k|        inName(ch);
  499|  12.9k|        return;
  500|  12.9k|    }
  501|  8.21k|    if (char_code == 0) {
  ------------------
  |  Branch (501:9): [True: 1.09k, False: 7.11k]
  ------------------
  502|  1.09k|        QTC::TC("qpdf", "QPDFTokenizer null in name");
  503|  1.09k|        error_message = "null character not allowed in name token";
  504|  1.09k|        val += "#00";
  505|  1.09k|        state = st_name;
  506|  1.09k|        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|  58.5k|{
  516|  58.5k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (516:9): [True: 48.9k, False: 9.55k]
  ------------------
  517|  48.9k|        state = st_number;
  518|  48.9k|    } else if (ch == '.') {
  ------------------
  |  Branch (518:16): [True: 858, False: 8.69k]
  ------------------
  519|    858|        state = st_decimal;
  520|  8.69k|    } else {
  521|  8.69k|        state = st_literal;
  522|  8.69k|        inLiteral(ch);
  523|  8.69k|    }
  524|  58.5k|}
_ZN4qpdf9Tokenizer9inDecimalEc:
  528|  19.2k|{
  529|  19.2k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (529:9): [True: 8.89k, False: 10.3k]
  ------------------
  530|  8.89k|        state = st_real;
  531|  10.3k|    } else {
  532|  10.3k|        state = st_literal;
  533|  10.3k|        inLiteral(ch);
  534|  10.3k|    }
  535|  19.2k|}
_ZN4qpdf9Tokenizer8inNumberEc:
  539|  18.1M|{
  540|  18.1M|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (540:9): [True: 14.4M, False: 3.72M]
  ------------------
  541|  14.4M|    } else if (ch == '.') {
  ------------------
  |  Branch (541:16): [True: 153k, False: 3.57M]
  ------------------
  542|   153k|        state = st_real;
  543|  3.57M|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (543:16): [True: 3.47M, False: 94.2k]
  ------------------
  544|  3.47M|        type = tt::tt_integer;
  545|  3.47M|        state = st_token_ready;
  546|  3.47M|        in_token = false;
  547|  3.47M|        char_to_unread = ch;
  548|  3.47M|    } else {
  549|  94.2k|        state = st_literal;
  550|  94.2k|    }
  551|  18.1M|}
_ZN4qpdf9Tokenizer6inRealEc:
  555|   518k|{
  556|   518k|    if (util::is_digit(ch)) {
  ------------------
  |  Branch (556:9): [True: 356k, False: 162k]
  ------------------
  557|   356k|    } else if (isDelimiter(ch)) {
  ------------------
  |  Branch (557:16): [True: 127k, False: 34.3k]
  ------------------
  558|   127k|        type = tt::tt_real;
  559|   127k|        state = st_token_ready;
  560|   127k|        in_token = false;
  561|   127k|        char_to_unread = ch;
  562|   127k|    } else {
  563|  34.3k|        state = st_literal;
  564|  34.3k|    }
  565|   518k|}
_ZN4qpdf9Tokenizer14inStringEscapeEc:
  568|  82.6k|{
  569|  82.6k|    state = st_in_string;
  570|  82.6k|    switch (ch) {
  571|  5.76k|    case '0':
  ------------------
  |  Branch (571:5): [True: 5.76k, False: 76.9k]
  ------------------
  572|  6.55k|    case '1':
  ------------------
  |  Branch (572:5): [True: 795, False: 81.8k]
  ------------------
  573|  23.1k|    case '2':
  ------------------
  |  Branch (573:5): [True: 16.6k, False: 66.0k]
  ------------------
  574|  30.8k|    case '3':
  ------------------
  |  Branch (574:5): [True: 7.72k, False: 74.9k]
  ------------------
  575|  31.2k|    case '4':
  ------------------
  |  Branch (575:5): [True: 403, False: 82.2k]
  ------------------
  576|  33.7k|    case '5':
  ------------------
  |  Branch (576:5): [True: 2.49k, False: 80.1k]
  ------------------
  577|  34.1k|    case '6':
  ------------------
  |  Branch (577:5): [True: 312, False: 82.3k]
  ------------------
  578|  34.3k|    case '7':
  ------------------
  |  Branch (578:5): [True: 295, False: 82.3k]
  ------------------
  579|  34.3k|        state = st_char_code;
  580|  34.3k|        char_code = 0;
  581|  34.3k|        digit_count = 0;
  582|  34.3k|        inCharCode(ch);
  583|  34.3k|        return;
  584|       |
  585|    952|    case 'n':
  ------------------
  |  Branch (585:5): [True: 952, False: 81.7k]
  ------------------
  586|    952|        val += '\n';
  587|    952|        return;
  588|       |
  589|  2.45k|    case 'r':
  ------------------
  |  Branch (589:5): [True: 2.45k, False: 80.2k]
  ------------------
  590|  2.45k|        val += '\r';
  591|  2.45k|        return;
  592|       |
  593|  4.64k|    case 't':
  ------------------
  |  Branch (593:5): [True: 4.64k, False: 78.0k]
  ------------------
  594|  4.64k|        val += '\t';
  595|  4.64k|        return;
  596|       |
  597|    505|    case 'b':
  ------------------
  |  Branch (597:5): [True: 505, False: 82.1k]
  ------------------
  598|    505|        val += '\b';
  599|    505|        return;
  600|       |
  601|  5.44k|    case 'f':
  ------------------
  |  Branch (601:5): [True: 5.44k, False: 77.2k]
  ------------------
  602|  5.44k|        val += '\f';
  603|  5.44k|        return;
  604|       |
  605|    372|    case '\n':
  ------------------
  |  Branch (605:5): [True: 372, False: 82.3k]
  ------------------
  606|    372|        return;
  607|       |
  608|    439|    case '\r':
  ------------------
  |  Branch (608:5): [True: 439, False: 82.2k]
  ------------------
  609|    439|        state = st_string_after_cr;
  610|    439|        return;
  611|       |
  612|  33.4k|    default:
  ------------------
  |  Branch (612:5): [True: 33.4k, False: 49.2k]
  ------------------
  613|       |        // PDF spec says backslash is ignored before anything else
  614|  33.4k|        val += ch;
  615|  33.4k|        return;
  616|  82.6k|    }
  617|  82.6k|}
_ZN4qpdf9Tokenizer15inStringAfterCREc:
  621|   317k|{
  622|   317k|    state = st_in_string;
  623|   317k|    if (ch != '\n') {
  ------------------
  |  Branch (623:9): [True: 279k, False: 38.1k]
  ------------------
  624|   279k|        inString(ch);
  625|   279k|    }
  626|   317k|}
_ZN4qpdf9Tokenizer4inLtEc:
  630|   463k|{
  631|   463k|    if (ch == '<') {
  ------------------
  |  Branch (631:9): [True: 401k, False: 61.8k]
  ------------------
  632|   401k|        type = tt::tt_dict_open;
  633|   401k|        state = st_token_ready;
  634|   401k|        return;
  635|   401k|    }
  636|       |
  637|  61.8k|    state = st_in_hexstring;
  638|  61.8k|    inHexstring(ch);
  639|  61.8k|}
_ZN4qpdf9Tokenizer4inGtEc:
  643|   276k|{
  644|   276k|    if (ch == '>') {
  ------------------
  |  Branch (644:9): [True: 246k, False: 29.6k]
  ------------------
  645|   246k|        type = tt::tt_dict_close;
  646|   246k|        state = st_token_ready;
  647|   246k|    } else {
  648|  29.6k|        type = tt::tt_bad;
  649|  29.6k|        QTC::TC("qpdf", "QPDFTokenizer bad >");
  650|  29.6k|        error_message = "unexpected >";
  651|  29.6k|        in_token = false;
  652|  29.6k|        char_to_unread = ch;
  653|  29.6k|        state = st_token_ready;
  654|  29.6k|    }
  655|   276k|}
_ZN4qpdf9Tokenizer9inLiteralEc:
  659|  41.5M|{
  660|  41.5M|    if (isDelimiter(ch)) {
  ------------------
  |  Branch (660:9): [True: 2.55M, False: 38.9M]
  ------------------
  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|  2.55M|        in_token = false;
  667|  2.55M|        char_to_unread = ch;
  668|  2.55M|        state = st_token_ready;
  669|  2.55M|        type = (raw_val == "true") || (raw_val == "false")
  ------------------
  |  Branch (669:16): [True: 10.0k, False: 2.54M]
  |  Branch (669:39): [True: 2.59k, False: 2.54M]
  ------------------
  670|  2.55M|            ? tt::tt_bool
  671|  2.55M|            : (raw_val == "null" ? tt::tt_null : tt::tt_word);
  ------------------
  |  Branch (671:16): [True: 253k, False: 2.28M]
  ------------------
  672|  2.55M|    }
  673|  41.5M|}
_ZN4qpdf9Tokenizer11inHexstringEc:
  677|   344k|{
  678|   344k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (678:48): [True: 155k, False: 188k]
  ------------------
  679|   155k|        char_code = int(hval) << 4;
  680|   155k|        state = st_in_hexstring_2nd;
  681|       |
  682|   188k|    } else if (ch == '>') {
  ------------------
  |  Branch (682:16): [True: 10.2k, False: 178k]
  ------------------
  683|  10.2k|        type = tt::tt_string;
  684|  10.2k|        state = st_token_ready;
  685|       |
  686|   178k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (686:16): [True: 138k, False: 39.8k]
  ------------------
  687|       |        // ignore
  688|       |
  689|   138k|    } else {
  690|  39.8k|        type = tt::tt_bad;
  691|  39.8k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring character");
  692|  39.8k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  693|  39.8k|        state = st_token_ready;
  694|  39.8k|    }
  695|   344k|}
_ZN4qpdf9Tokenizer14inHexstring2ndEc:
  699|   160k|{
  700|   160k|    if (char hval = util::hex_decode_char(ch); hval < '\20') {
  ------------------
  |  Branch (700:48): [True: 143k, False: 17.0k]
  ------------------
  701|   143k|        val += char(char_code) | hval;
  702|   143k|        state = st_in_hexstring;
  703|       |
  704|   143k|    } else if (ch == '>') {
  ------------------
  |  Branch (704:16): [True: 5.58k, False: 11.5k]
  ------------------
  705|       |        // PDF spec says odd hexstrings have implicit trailing 0.
  706|  5.58k|        val += char(char_code);
  707|  5.58k|        type = tt::tt_string;
  708|  5.58k|        state = st_token_ready;
  709|       |
  710|  11.5k|    } else if (isSpace(ch)) {
  ------------------
  |  Branch (710:16): [True: 5.90k, False: 5.60k]
  ------------------
  711|       |        // ignore
  712|       |
  713|  5.90k|    } else {
  714|  5.60k|        type = tt::tt_bad;
  715|  5.60k|        QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character");
  716|  5.60k|        error_message = std::string("invalid character (") + ch + ") in hexstring";
  717|  5.60k|        state = st_token_ready;
  718|  5.60k|    }
  719|   160k|}
_ZN4qpdf9Tokenizer10inCharCodeEc:
  723|  98.0k|{
  724|  98.0k|    bool handled = false;
  725|  98.0k|    if (('0' <= ch) && (ch <= '7')) {
  ------------------
  |  Branch (725:9): [True: 94.8k, False: 3.14k]
  |  Branch (725:24): [True: 92.1k, False: 2.77k]
  ------------------
  726|  92.1k|        char_code = 8 * char_code + (int(ch) - int('0'));
  727|  92.1k|        if (++(digit_count) < 3) {
  ------------------
  |  Branch (727:13): [True: 63.7k, False: 28.3k]
  ------------------
  728|  63.7k|            return;
  729|  63.7k|        }
  730|  28.3k|        handled = true;
  731|  28.3k|    }
  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|  34.2k|    val += char(char_code % 256);
  735|  34.2k|    state = st_in_string;
  736|  34.2k|    if (!handled) {
  ------------------
  |  Branch (736:9): [True: 5.91k, False: 28.3k]
  ------------------
  737|  5.91k|        inString(ch);
  738|  5.91k|    }
  739|  34.2k|}
_ZN4qpdf9Tokenizer13inInlineImageEc:
  743|  1.73M|{
  744|  1.73M|    if ((raw_val.length() + 1) == inline_image_bytes) {
  ------------------
  |  Branch (744:9): [True: 4.33k, False: 1.72M]
  ------------------
  745|  4.33k|        QTC::TC("qpdf", "QPDFTokenizer found EI by byte count");
  746|  4.33k|        type = tt::tt_inline_image;
  747|  4.33k|        inline_image_bytes = 0;
  748|  4.33k|        state = st_token_ready;
  749|  4.33k|    }
  750|  1.73M|}
_ZN4qpdf9Tokenizer10presentEOFEv:
  760|  46.1k|{
  761|  46.1k|    switch (state) {
  762|  2.29k|    case st_name:
  ------------------
  |  Branch (762:5): [True: 2.29k, False: 43.8k]
  ------------------
  763|  2.60k|    case st_name_hex1:
  ------------------
  |  Branch (763:5): [True: 314, False: 45.8k]
  ------------------
  764|  2.67k|    case st_name_hex2:
  ------------------
  |  Branch (764:5): [True: 70, False: 46.1k]
  ------------------
  765|  7.99k|    case st_number:
  ------------------
  |  Branch (765:5): [True: 5.32k, False: 40.8k]
  ------------------
  766|  8.34k|    case st_real:
  ------------------
  |  Branch (766:5): [True: 346, False: 45.8k]
  ------------------
  767|  8.64k|    case st_sign:
  ------------------
  |  Branch (767:5): [True: 303, False: 45.8k]
  ------------------
  768|  8.74k|    case st_decimal:
  ------------------
  |  Branch (768:5): [True: 98, False: 46.0k]
  ------------------
  769|  18.2k|    case st_literal:
  ------------------
  |  Branch (769:5): [True: 9.46k, False: 36.7k]
  ------------------
  770|  18.2k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token");
  771|       |        // Push any delimiter to the state machine to finish off the final token.
  772|  18.2k|        presentCharacter('\f');
  773|  18.2k|        in_token = true;
  774|  18.2k|        break;
  775|       |
  776|      0|    case st_top:
  ------------------
  |  Branch (776:5): [True: 0, False: 46.1k]
  ------------------
  777|  21.2k|    case st_before_token:
  ------------------
  |  Branch (777:5): [True: 21.2k, False: 24.9k]
  ------------------
  778|  21.2k|        type = tt::tt_eof;
  779|  21.2k|        break;
  780|       |
  781|  1.16k|    case st_in_space:
  ------------------
  |  Branch (781:5): [True: 1.16k, False: 45.0k]
  ------------------
  782|  1.16k|        type = include_ignorable ? tt::tt_space : tt::tt_eof;
  ------------------
  |  Branch (782:16): [True: 1.16k, False: 0]
  ------------------
  783|  1.16k|        break;
  784|       |
  785|  1.22k|    case st_in_comment:
  ------------------
  |  Branch (785:5): [True: 1.22k, False: 44.9k]
  ------------------
  786|  1.22k|        type = include_ignorable ? tt::tt_comment : tt::tt_bad;
  ------------------
  |  Branch (786:16): [True: 49, False: 1.18k]
  ------------------
  787|  1.22k|        break;
  788|       |
  789|      0|    case st_token_ready:
  ------------------
  |  Branch (789:5): [True: 0, False: 46.1k]
  ------------------
  790|      0|        break;
  791|       |
  792|  4.34k|    default:
  ------------------
  |  Branch (792:5): [True: 4.34k, False: 41.8k]
  ------------------
  793|  4.34k|        QTC::TC("qpdf", "QPDFTokenizer EOF reading token");
  794|  4.34k|        type = tt::tt_bad;
  795|  4.34k|        error_message = "EOF while reading token";
  796|  46.1k|    }
  797|  46.1k|    state = st_token_ready;
  798|  46.1k|}
_ZN13QPDFTokenizer17expectInlineImageER11InputSource:
  808|  4.41k|{
  809|  4.41k|    m->expectInlineImage(input);
  810|  4.41k|}
_ZN4qpdf9Tokenizer17expectInlineImageER11InputSource:
  814|  4.41k|{
  815|  4.41k|    if (state == st_token_ready) {
  ------------------
  |  Branch (815:9): [True: 0, False: 4.41k]
  ------------------
  816|      0|        reset();
  817|  4.41k|    } else if (state != st_before_token) {
  ------------------
  |  Branch (817:16): [True: 0, False: 4.41k]
  ------------------
  818|      0|        throw std::logic_error(
  819|      0|            "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state");
  820|      0|    }
  821|  4.41k|    findEI(input);
  822|  4.41k|    before_token = false;
  823|  4.41k|    in_token = true;
  824|  4.41k|    state = st_inline_image;
  825|  4.41k|}
_ZN4qpdf9Tokenizer6findEIER11InputSource:
  829|  4.41k|{
  830|  4.41k|    qpdf_offset_t last_offset = input.getLastOffset();
  831|  4.41k|    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|  4.41k|    bool okay = false;
  841|  4.41k|    bool first_try = true;
  842|  23.8k|    while (!okay) {
  ------------------
  |  Branch (842:12): [True: 23.2k, False: 585]
  ------------------
  843|  23.2k|        QPDFWordTokenFinder f(input, "EI");
  844|  23.2k|        if (!input.findFirst("EI", input.tell(), 0, f)) {
  ------------------
  |  Branch (844:13): [True: 3.83k, False: 19.3k]
  ------------------
  845|  3.83k|            break;
  846|  3.83k|        }
  847|  19.3k|        inline_image_bytes = QIntC::to_size(input.tell() - pos - 2);
  848|       |
  849|  19.3k|        Tokenizer check;
  850|  19.3k|        bool found_bad = false;
  851|       |        // Look at the next 10 tokens or up to EOF. The next inline image's image data would look
  852|       |        // like bad tokens, but there will always be at least 10 tokens between one inline image's
  853|       |        // EI and the next valid one's ID since width, height, bits per pixel, and color space are
  854|       |        // all required as well as a BI and ID. If we get 10 good tokens in a row or hit EOF, we can
  855|       |        // be pretty sure we've found the actual EI.
  856|  53.8k|        for (int i = 0; i < 10; ++i) {
  ------------------
  |  Branch (856:25): [True: 53.2k, False: 585]
  ------------------
  857|  53.2k|            check.nextToken(input, "checker");
  858|  53.2k|            auto typ = check.getType();
  859|  53.2k|            if (typ == tt::tt_eof) {
  ------------------
  |  Branch (859:17): [True: 0, False: 53.2k]
  ------------------
  860|      0|                okay = true;
  861|  53.2k|            } else if (typ == tt::tt_bad) {
  ------------------
  |  Branch (861:24): [True: 10.9k, False: 42.2k]
  ------------------
  862|  10.9k|                found_bad = true;
  863|  42.2k|            } else if (typ == tt::tt_word) {
  ------------------
  |  Branch (863:24): [True: 19.9k, False: 22.3k]
  ------------------
  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|  19.9k|                bool found_alpha = false;
  870|  19.9k|                bool found_non_printable = false;
  871|  19.9k|                bool found_other = false;
  872|  37.5k|                for (char ch: check.getValue()) {
  ------------------
  |  Branch (872:29): [True: 37.5k, False: 12.7k]
  ------------------
  873|  37.5k|                    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch == '*')) {
  ------------------
  |  Branch (873:26): [True: 1.58k, False: 35.9k]
  |  Branch (873:39): [True: 1.19k, False: 382]
  |  Branch (873:54): [True: 18.5k, False: 17.8k]
  |  Branch (873:67): [True: 17.9k, False: 521]
  |  Branch (873:81): [True: 424, False: 17.9k]
  ------------------
  874|       |                        // Treat '*' as alpha since there are valid PDF operators that contain *
  875|       |                        // along with alphabetic characters.
  876|  19.6k|                        found_alpha = true;
  877|  19.6k|                    } else if (static_cast<signed char>(ch) < 32 && !isSpace(ch)) {
  ------------------
  |  Branch (877:32): [True: 7.12k, False: 10.7k]
  |  Branch (877:69): [True: 7.12k, False: 0]
  ------------------
  878|       |                        // Compare ch as a signed char so characters outside of 7-bit will be < 0.
  879|  7.12k|                        found_non_printable = true;
  880|  7.12k|                        break;
  881|  10.7k|                    } else {
  882|  10.7k|                        found_other = true;
  883|  10.7k|                    }
  884|  37.5k|                }
  885|  19.9k|                if (found_non_printable || (found_alpha && found_other)) {
  ------------------
  |  Branch (885:21): [True: 7.12k, False: 12.7k]
  |  Branch (885:45): [True: 9.04k, False: 3.74k]
  |  Branch (885:60): [True: 695, False: 8.34k]
  ------------------
  886|  7.82k|                    found_bad = true;
  887|  7.82k|                }
  888|  19.9k|            }
  889|  53.2k|            if (okay || found_bad) {
  ------------------
  |  Branch (889:17): [True: 0, False: 53.2k]
  |  Branch (889:25): [True: 18.8k, False: 34.4k]
  ------------------
  890|  18.8k|                break;
  891|  18.8k|            }
  892|  53.2k|        }
  893|  19.3k|        if (!found_bad) {
  ------------------
  |  Branch (893:13): [True: 585, False: 18.8k]
  ------------------
  894|    585|            okay = true;
  895|    585|        }
  896|  19.3k|        if (!okay) {
  ------------------
  |  Branch (896:13): [True: 18.8k, False: 585]
  ------------------
  897|  18.8k|            first_try = false;
  898|  18.8k|        }
  899|  19.3k|    }
  900|  4.41k|    if (okay && (!first_try)) {
  ------------------
  |  Branch (900:9): [True: 585, False: 3.83k]
  |  Branch (900:17): [True: 93, False: 492]
  ------------------
  901|     93|        QTC::TC("qpdf", "QPDFTokenizer found EI after more than one try");
  902|     93|    }
  903|       |
  904|       |    input.seek(pos, SEEK_SET);
  905|  4.41k|    input.setLastOffset(last_offset);
  906|  4.41k|}
_ZN4qpdf9Tokenizer8getTokenERN13QPDFTokenizer5TokenERbRc:
  916|  4.34M|{
  917|  4.34M|    bool ready = (state == st_token_ready);
  918|  4.34M|    unread_char = !in_token && !before_token;
  ------------------
  |  Branch (918:19): [True: 3.57M, False: 769k]
  |  Branch (918:32): [True: 3.56M, False: 12.7k]
  ------------------
  919|  4.34M|    ch = char_to_unread;
  920|  4.34M|    if (ready) {
  ------------------
  |  Branch (920:9): [True: 4.34M, False: 0]
  ------------------
  921|  4.34M|        token = (!(type == tt::tt_name || type == tt::tt_string))
  ------------------
  |  Branch (921:20): [True: 362k, False: 3.98M]
  |  Branch (921:43): [True: 49.0k, False: 3.93M]
  ------------------
  922|  4.34M|            ? Token(type, raw_val, raw_val, error_message)
  923|  4.34M|            : Token(type, val, raw_val, error_message);
  924|       |
  925|  4.34M|        reset();
  926|  4.34M|    }
  927|  4.34M|    return ready;
  928|  4.34M|}
_ZN13QPDFTokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEbm:
  945|  1.63M|{
  946|  1.63M|    return m->readToken(input, context, allow_bad, max_len);
  947|  1.63M|}
_ZN4qpdf9Tokenizer9readTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEbm:
  958|  4.34M|{
  959|  4.34M|    nextToken(input, context, max_len);
  960|       |
  961|  4.34M|    Token token;
  962|  4.34M|    bool unread_char;
  963|  4.34M|    char char_to_unread;
  964|  4.34M|    getToken(token, unread_char, char_to_unread);
  965|       |
  966|  4.34M|    if (token.getType() == tt::tt_bad) {
  ------------------
  |  Branch (966:9): [True: 456k, False: 3.89M]
  ------------------
  967|   456k|        if (allow_bad) {
  ------------------
  |  Branch (967:13): [True: 456k, False: 0]
  ------------------
  968|   456k|            QTC::TC("qpdf", "QPDFTokenizer allowing bad token");
  969|   456k|        } 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|   456k|    }
  978|  4.34M|    return token;
  979|  4.34M|}
_ZN4qpdf9Tokenizer9nextTokenER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEm:
  983|  33.5M|{
  984|  33.5M|    if (state != st_inline_image) {
  ------------------
  |  Branch (984:9): [True: 33.5M, False: 4.41k]
  ------------------
  985|  33.5M|        reset();
  986|  33.5M|    }
  987|  33.5M|    qpdf_offset_t offset = input.fastTell();
  988|       |
  989|   348M|    while (state != st_token_ready) {
  ------------------
  |  Branch (989:12): [True: 315M, False: 33.5M]
  ------------------
  990|   315M|        char ch;
  991|   315M|        if (!input.fastRead(ch)) {
  ------------------
  |  Branch (991:13): [True: 46.1k, False: 315M]
  ------------------
  992|  46.1k|            presentEOF();
  993|       |
  994|  46.1k|            if ((type == tt::tt_eof) && (!allow_eof)) {
  ------------------
  |  Branch (994:17): [True: 21.2k, False: 24.9k]
  |  Branch (994:41): [True: 1.62k, False: 19.6k]
  ------------------
  995|       |                // Nothing in the qpdf library calls readToken without allowEOF anymore, so this
  996|       |                // case is not exercised.
  997|  1.62k|                type = tt::tt_bad;
  998|  1.62k|                error_message = "unexpected EOF";
  999|  1.62k|                offset = input.getLastOffset();
 1000|  1.62k|            }
 1001|   315M|        } else {
 1002|   315M|            handleCharacter(ch);
 1003|   315M|            if (before_token) {
  ------------------
  |  Branch (1003:17): [True: 26.1M, False: 289M]
  ------------------
 1004|  26.1M|                ++offset;
 1005|  26.1M|            }
 1006|   315M|            if (in_token) {
  ------------------
  |  Branch (1006:17): [True: 257M, False: 58.0M]
  ------------------
 1007|   257M|                raw_val += ch;
 1008|   257M|            }
 1009|   315M|            if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) {
  ------------------
  |  Branch (1009:17): [True: 14.8M, False: 300M]
  |  Branch (1009:28): [True: 244k, False: 14.5M]
  |  Branch (1009:61): [True: 243k, False: 640]
  ------------------
 1010|       |                // terminate this token now
 1011|   243k|                QTC::TC("qpdf", "QPDFTokenizer block long token");
 1012|   243k|                type = tt::tt_bad;
 1013|   243k|                state = st_token_ready;
 1014|   243k|                error_message = "exceeded allowable length while reading token";
 1015|   243k|            }
 1016|   315M|        }
 1017|   315M|    }
 1018|       |
 1019|  33.5M|    input.fastUnread(!in_token && !before_token);
  ------------------
  |  Branch (1019:22): [True: 31.9M, False: 1.62M]
  |  Branch (1019:35): [True: 31.9M, False: 22.4k]
  ------------------
 1020|       |
 1021|  33.5M|    if (type != tt::tt_eof) {
  ------------------
  |  Branch (1021:9): [True: 33.5M, False: 19.6k]
  ------------------
 1022|  33.5M|        input.setLastOffset(offset);
 1023|  33.5M|    }
 1024|       |
 1025|  33.5M|    return error_message.empty();
 1026|  33.5M|}
QPDFTokenizer.cc:_ZL12is_delimiterc:
   25|   126M|{
   26|   126M|    return (
   27|   126M|        ch == ' ' || ch == '\n' || ch == '/' || ch == '(' || ch == ')' || ch == '{' || ch == '}' ||
  ------------------
  |  Branch (27:9): [True: 4.55M, False: 121M]
  |  Branch (27:22): [True: 697k, False: 120M]
  |  Branch (27:36): [True: 24.3M, False: 96.4M]
  |  Branch (27:49): [True: 77.1k, False: 96.3M]
  |  Branch (27:62): [True: 30.2k, False: 96.3M]
  |  Branch (27:75): [True: 54.3k, False: 96.2M]
  |  Branch (27:88): [True: 17.2k, False: 96.2M]
  ------------------
   28|  96.2M|        ch == '<' || ch == '>' || ch == '[' || ch == ']' || ch == '%' || ch == '\t' || ch == '\r' ||
  ------------------
  |  Branch (28:9): [True: 121k, False: 96.1M]
  |  Branch (28:22): [True: 145k, False: 96.0M]
  |  Branch (28:35): [True: 127k, False: 95.8M]
  |  Branch (28:48): [True: 99.3k, False: 95.7M]
  |  Branch (28:61): [True: 34.1k, False: 95.7M]
  |  Branch (28:74): [True: 36.5k, False: 95.7M]
  |  Branch (28:88): [True: 352k, False: 95.3M]
  ------------------
   29|  95.3M|        ch == '\v' || ch == '\f' || ch == 0);
  ------------------
  |  Branch (29:9): [True: 32.0k, False: 95.3M]
  |  Branch (29:23): [True: 104k, False: 95.2M]
  |  Branch (29:37): [True: 498k, False: 94.7M]
  ------------------
   30|   126M|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderC2ER11InputSourceRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   38|  23.2k|            is(is),
   39|  23.2k|            str(str)
   40|  23.2k|        {
   41|  23.2k|        }
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinder5checkEv:
   53|  25.1k|{
   54|       |    // Find a word token matching the given string, preceded by a delimiter, and followed by a
   55|       |    // delimiter or EOF.
   56|  25.1k|    Tokenizer tokenizer;
   57|  25.1k|    tokenizer.nextToken(is, "finder", str.size() + 2);
   58|  25.1k|    qpdf_offset_t pos = is.tell();
   59|  25.1k|    if (tokenizer.getType() != tt::tt_word || tokenizer.getValue() != str) {
  ------------------
  |  Branch (59:9): [True: 3.88k, False: 21.2k]
  |  Branch (59:47): [True: 1.83k, False: 19.3k]
  ------------------
   60|  5.71k|        QTC::TC("qpdf", "QPDFTokenizer finder found wrong word");
   61|  5.71k|        return false;
   62|  5.71k|    }
   63|  19.3k|    qpdf_offset_t token_start = is.getLastOffset();
   64|  19.3k|    char next;
   65|  19.3k|    bool next_okay = false;
   66|  19.3k|    if (is.read(&next, 1) == 0) {
  ------------------
  |  Branch (66:9): [True: 3, False: 19.3k]
  ------------------
   67|      3|        QTC::TC("qpdf", "QPDFTokenizer inline image at EOF");
   68|      3|        next_okay = true;
   69|  19.3k|    } else {
   70|  19.3k|        next_okay = is_delimiter(next);
   71|  19.3k|    }
   72|  19.3k|    is.seek(pos, SEEK_SET);
   73|  19.3k|    if (!next_okay) {
  ------------------
  |  Branch (73:9): [True: 0, False: 19.3k]
  ------------------
   74|      0|        return false;
   75|      0|    }
   76|  19.3k|    if (token_start == 0) {
  ------------------
  |  Branch (76:9): [True: 0, False: 19.3k]
  ------------------
   77|       |        // Can't actually happen...we never start the search at the beginning of the input.
   78|      0|        return false;
   79|      0|    }
   80|  19.3k|    return true;
   81|  19.3k|}
QPDFTokenizer.cc:_ZN12_GLOBAL__N_119QPDFWordTokenFinderD2Ev:
   42|  23.2k|        ~QPDFWordTokenFinder() override = default;

_ZN10QPDFWriterC2ER4QPDF:
  491|  8.57k|    m(std::make_shared<Members>(*this, pdf))
  492|  8.57k|{
  493|  8.57k|}
_ZN10QPDFWriter17setOutputPipelineEP8Pipeline:
  558|  8.57k|{
  559|  8.57k|    m->filename = "custom pipeline";
  560|  8.57k|    m->pipeline_stack.initialize(p);
  561|  8.57k|}
_ZN4qpdf6Writer6Config16compress_streamsEb:
  604|  8.57k|{
  605|  8.57k|    if (pclm_) {
  ------------------
  |  Branch (605:9): [True: 0, False: 8.57k]
  ------------------
  606|      0|        usage("compress_streams cannot be set when pclm is set");
  607|      0|        return *this;
  608|      0|    }
  609|  8.57k|    compress_streams_set_ = true;
  610|  8.57k|    compress_streams_ = val;
  611|  8.57k|    return *this;
  612|  8.57k|}
_ZN10QPDFWriter14setDecodeLevelE26qpdf_stream_decode_level_e:
  616|  8.57k|{
  617|  8.57k|    m->cfg.decode_level(val);
  618|  8.57k|}
_ZN4qpdf6Writer6Config12decode_levelE26qpdf_stream_decode_level_e:
  622|  8.57k|{
  623|  8.57k|    if (pclm_) {
  ------------------
  |  Branch (623:9): [True: 0, False: 8.57k]
  ------------------
  624|      0|        usage("stream_decode_level cannot be set when pclm is set");
  625|      0|        return *this;
  626|      0|    }
  627|  8.57k|    decode_level_set_ = true;
  628|  8.57k|    decode_level_ = val;
  629|  8.57k|    return *this;
  630|  8.57k|}
_ZN10QPDFWriter10setQDFModeEb:
  646|  8.57k|{
  647|  8.57k|    m->cfg.qdf(val);
  648|  8.57k|}
_ZN4qpdf6Writer6Config3qdfEb:
  652|  8.57k|{
  653|  8.57k|    if (pclm_ || linearize_) {
  ------------------
  |  Branch (653:9): [True: 0, False: 8.57k]
  |  Branch (653:18): [True: 0, False: 8.57k]
  ------------------
  654|      0|        usage("qdf cannot be set when linearize or pclm are set");
  655|      0|    }
  656|  8.57k|    if (preserve_encryption_) {
  ------------------
  |  Branch (656:9): [True: 8.57k, False: 0]
  ------------------
  657|  8.57k|        usage("preserve_encryption cannot be set when qdf is set");
  658|  8.57k|    }
  659|  8.57k|    qdf_ = val;
  660|  8.57k|    if (val) {
  ------------------
  |  Branch (660:9): [True: 8.57k, False: 0]
  ------------------
  661|  8.57k|        if (!normalize_content_set_) {
  ------------------
  |  Branch (661:13): [True: 8.57k, False: 0]
  ------------------
  662|  8.57k|            normalize_content(true);
  663|  8.57k|        }
  664|  8.57k|        if (!compress_streams_set_) {
  ------------------
  |  Branch (664:13): [True: 8.57k, False: 0]
  ------------------
  665|  8.57k|            compress_streams(false);
  666|  8.57k|        }
  667|  8.57k|        if (!decode_level_set_) {
  ------------------
  |  Branch (667:13): [True: 0, False: 8.57k]
  ------------------
  668|      0|            decode_level(qpdf_dl_generalized);
  669|      0|        }
  670|  8.57k|        preserve_encryption_ = false;
  671|       |        // Generate indirect stream lengths for qdf mode since fix-qdf uses them for storing
  672|       |        // recomputed stream length data. Certain streams such as object streams, xref streams, and
  673|       |        // hint streams always get direct stream lengths.
  674|  8.57k|        direct_stream_lengths_ = false;
  675|  8.57k|    }
  676|  8.57k|    return *this;
  677|  8.57k|}
_ZN4qpdf4impl6Writer20setMinimumPDFVersionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEi:
  699|  9.07k|{
  700|  9.07k|    bool set_version = false;
  701|  9.07k|    bool set_extension_level = false;
  702|  9.07k|    if (min_pdf_version.empty()) {
  ------------------
  |  Branch (702:9): [True: 8.55k, False: 521]
  ------------------
  703|  8.55k|        set_version = true;
  704|  8.55k|        set_extension_level = true;
  705|  8.55k|    } else {
  706|    521|        int old_major = 0;
  707|    521|        int old_minor = 0;
  708|    521|        int min_major = 0;
  709|    521|        int min_minor = 0;
  710|    521|        parseVersion(version, old_major, old_minor);
  711|    521|        parseVersion(min_pdf_version, min_major, min_minor);
  712|    521|        int compare = compareVersions(old_major, old_minor, min_major, min_minor);
  713|    521|        if (compare > 0) {
  ------------------
  |  Branch (713:13): [True: 126, False: 395]
  ------------------
  714|    126|            QTC::TC("qpdf", "QPDFWriter increasing minimum version", extension_level == 0 ? 0 : 1);
  ------------------
  |  Branch (714:70): [True: 126, False: 0]
  ------------------
  715|    126|            set_version = true;
  716|    126|            set_extension_level = true;
  717|    395|        } else if (compare == 0) {
  ------------------
  |  Branch (717:20): [True: 6, False: 389]
  ------------------
  718|      6|            if (extension_level > min_extension_level) {
  ------------------
  |  Branch (718:17): [True: 1, False: 5]
  ------------------
  719|      1|                set_extension_level = true;
  720|      1|            }
  721|      6|        }
  722|    521|    }
  723|       |
  724|  9.07k|    if (set_version) {
  ------------------
  |  Branch (724:9): [True: 8.68k, False: 395]
  ------------------
  725|  8.68k|        min_pdf_version = version;
  726|  8.68k|    }
  727|  9.07k|    if (set_extension_level) {
  ------------------
  |  Branch (727:9): [True: 8.68k, False: 394]
  ------------------
  728|  8.68k|        min_extension_level = extension_level;
  729|  8.68k|    }
  730|  9.07k|}
_ZN10QPDFWriter18setDeterministicIDEb:
  773|  8.57k|{
  774|  8.57k|    m->cfg.deterministic_id(val);
  775|  8.57k|}
_ZNK4qpdf4impl6Writer12parseVersionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_:
 1176|  1.02k|{
 1177|  1.02k|    major = QUtil::string_to_int(version.c_str());
 1178|  1.02k|    minor = 0;
 1179|  1.02k|    size_t p = version.find('.');
 1180|  1.02k|    if ((p != std::string::npos) && (version.length() > p)) {
  ------------------
  |  Branch (1180:9): [True: 1.02k, False: 0]
  |  Branch (1180:37): [True: 1.02k, False: 0]
  ------------------
 1181|  1.02k|        minor = QUtil::string_to_int(version.substr(p + 1).c_str());
 1182|  1.02k|    }
 1183|  1.02k|    std::string tmp = std::to_string(major) + "." + std::to_string(minor);
 1184|  1.02k|    if (tmp != version) {
  ------------------
  |  Branch (1184:9): [True: 27, False: 1.00k]
  ------------------
 1185|       |        // The version number in the input is probably invalid. This happens with some files that
 1186|       |        // are designed to exercise bugs, such as files in the fuzzer corpus. Unfortunately
 1187|       |        // QPDFWriter doesn't have a way to give a warning, so we just ignore this case.
 1188|     27|    }
 1189|  1.02k|}
_ZNK4qpdf4impl6Writer15compareVersionsEiiii:
 1193|    508|{
 1194|    508|    if (major1 < major2) {
  ------------------
  |  Branch (1194:9): [True: 4, False: 504]
  ------------------
 1195|      4|        return -1;
 1196|      4|    }
 1197|    504|    if (major1 > major2) {
  ------------------
  |  Branch (1197:9): [True: 35, False: 469]
  ------------------
 1198|     35|        return 1;
 1199|     35|    }
 1200|    469|    if (minor1 < minor2) {
  ------------------
  |  Branch (1200:9): [True: 372, False: 97]
  ------------------
 1201|    372|        return -1;
 1202|    372|    }
 1203|     97|    return minor1 > minor2 ? 1 : 0;
  ------------------
  |  Branch (1203:12): [True: 91, False: 6]
  ------------------
 1204|    469|}
_ZN4qpdf4impl6Writer10setDataKeyEi:
 1225|  86.8k|{
 1226|  86.8k|    if (encryption) {
  ------------------
  |  Branch (1226:9): [True: 0, False: 86.8k]
  ------------------
 1227|      0|        cur_data_key = QPDF::compute_data_key(
 1228|      0|            encryption_key,
 1229|      0|            objid,
 1230|      0|            0,
 1231|      0|            cfg.encrypt_use_aes(),
 1232|      0|            encryption->getV(),
 1233|      0|            encryption->getR());
 1234|      0|    }
 1235|  86.8k|}
_ZN4qpdf4impl6Writer11bytesNeededEx:
 1239|  1.41k|{
 1240|  1.41k|    unsigned int bytes = 0;
 1241|  3.18k|    while (n) {
  ------------------
  |  Branch (1241:12): [True: 1.77k, False: 1.41k]
  ------------------
 1242|  1.77k|        ++bytes;
 1243|  1.77k|        n >>= 8;
 1244|  1.77k|    }
 1245|  1.41k|    return bytes;
 1246|  1.41k|}
_ZN4qpdf4impl6Writer11writeBinaryEyj:
 1250|   127k|{
 1251|   127k|    if (bytes > sizeof(unsigned long long)) {
  ------------------
  |  Branch (1251:9): [True: 0, False: 127k]
  ------------------
 1252|      0|        throw std::logic_error("QPDFWriter::writeBinary called with too many bytes");
 1253|      0|    }
 1254|   127k|    unsigned char data[sizeof(unsigned long long)];
 1255|   303k|    for (unsigned int i = 0; i < bytes; ++i) {
  ------------------
  |  Branch (1255:30): [True: 176k, False: 127k]
  ------------------
 1256|   176k|        data[bytes - i - 1] = static_cast<unsigned char>(val & 0xff);
 1257|   176k|        val >>= 8;
 1258|   176k|    }
 1259|   127k|    pipeline->write(data, bytes);
 1260|   127k|}
_ZN4qpdf4impl6Writer5writeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
 1264|  40.5M|{
 1265|  40.5M|    pipeline->write(str);
 1266|  40.5M|    return *this;
 1267|  40.5M|}
_ZN4qpdf4impl6Writer10write_nameERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
 1285|   337k|{
 1286|   337k|    pipeline->write(Name::normalize(str));
 1287|   337k|    return *this;
 1288|   337k|}
_ZN4qpdf4impl6Writer12write_stringERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1292|  16.7k|{
 1293|  16.7k|    pipeline->write(QPDF_String(str).unparse(force_binary));
 1294|  16.7k|    return *this;
 1295|  16.7k|}
_ZN4qpdf4impl6Writer21adjustAESStreamLengthERm:
 1319|  27.3k|{
 1320|  27.3k|    if (encryption && !cur_data_key.empty() && cfg.encrypt_use_aes()) {
  ------------------
  |  Branch (1320:9): [True: 0, False: 27.3k]
  |  Branch (1320:23): [True: 0, False: 0]
  |  Branch (1320:48): [True: 0, False: 0]
  ------------------
 1321|       |        // Stream length will be padded with 1 to 16 bytes to end up as a multiple of 16.  It will
 1322|       |        // also be prepended by 16 bits of random data.
 1323|      0|        length += 32 - (length & 0xf);
 1324|      0|    }
 1325|  27.3k|}
_ZN4qpdf4impl6Writer15write_encryptedENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
 1329|  27.2k|{
 1330|  27.2k|    if (!(encryption && !cur_data_key.empty())) {
  ------------------
  |  Branch (1330:11): [True: 0, False: 27.2k]
  |  Branch (1330:25): [True: 0, False: 0]
  ------------------
 1331|  27.2k|        write(str);
 1332|  27.2k|    } else if (cfg.encrypt_use_aes()) {
  ------------------
  |  Branch (1332:16): [True: 0, False: 0]
  ------------------
 1333|      0|        write(pl::pipe<Pl_AES_PDF>(str, true, cur_data_key));
 1334|      0|    } else {
 1335|      0|        write(pl::pipe<Pl_RC4>(str, cur_data_key));
 1336|      0|    }
 1337|       |
 1338|  27.2k|    return *this;
 1339|  27.2k|}
_ZN4qpdf4impl6Writer26computeDeterministicIDDataEv:
 1343|  8.38k|{
 1344|  8.38k|    if (!id2.empty()) {
  ------------------
  |  Branch (1344:9): [True: 0, False: 8.38k]
  ------------------
 1345|       |        // Can't happen in the code
 1346|      0|        throw std::logic_error(
 1347|      0|            "Deterministic ID computation enabled after ID generation has already occurred.");
 1348|      0|    }
 1349|  8.38k|    qpdf_assert_debug(deterministic_id_data.empty());
  ------------------
  |  |   11|  8.38k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (1349:5): [True: 8.38k, False: 0]
  ------------------
 1350|  8.38k|    deterministic_id_data = pipeline_stack.hex_digest();
 1351|  8.38k|}
_ZN4qpdf4impl6Writer10openObjectEi:
 1355|   111k|{
 1356|   111k|    if (objid == 0) {
  ------------------
  |  Branch (1356:9): [True: 0, False: 111k]
  ------------------
 1357|      0|        objid = next_objid++;
 1358|      0|    }
 1359|   111k|    new_obj[objid].xref = QPDFXRefEntry(pipeline->getCount());
 1360|   111k|    write(objid).write(" 0 obj\n");
 1361|   111k|    return objid;
 1362|   111k|}
_ZN4qpdf4impl6Writer11closeObjectEi:
 1366|   111k|{
 1367|       |    // Write a newline before endobj as it makes the file easier to repair.
 1368|   111k|    write("\nendobj\n").write_qdf("\n");
 1369|   111k|    auto& no = new_obj[objid];
 1370|   111k|    no.length = pipeline->getCount() - no.xref.getOffset();
 1371|   111k|}
_ZN4qpdf4impl6Writer29assignCompressedObjectNumbersE10QPDFObjGen:
 1375|  3.25k|{
 1376|  3.25k|    int objid = og.getObj();
 1377|  3.25k|    if (og.getGen() != 0 || !object_stream_to_objects.contains(objid)) {
  ------------------
  |  Branch (1377:9): [True: 0, False: 3.25k]
  |  Branch (1377:29): [True: 0, False: 3.25k]
  ------------------
 1378|       |        // This is not an object stream.
 1379|      0|        return;
 1380|      0|    }
 1381|       |
 1382|       |    // Reserve numbers for the objects that belong to this object stream.
 1383|  18.6k|    for (auto const& iter: object_stream_to_objects[objid]) {
  ------------------
  |  Branch (1383:26): [True: 18.6k, False: 3.25k]
  ------------------
 1384|  18.6k|        obj[iter].renumber = next_objid++;
 1385|  18.6k|    }
 1386|  3.25k|}
_ZN4qpdf4impl6Writer7enqueueERK16QPDFObjectHandle:
 1390|   173M|{
 1391|   173M|    if (object.indirect()) {
  ------------------
  |  Branch (1391:9): [True: 789k, False: 173M]
  ------------------
 1392|   789k|        util::assertion(
 1393|       |            // This owner check can only be done for indirect objects. It is possible for a direct
 1394|       |            // object to have an owning QPDF that is from another file if a direct QPDFObjectHandle
 1395|       |            // from one file was insert into another file without copying. Doing that is safe even
 1396|       |            // if the original QPDF gets destroyed, which just disconnects the QPDFObjectHandle from
 1397|       |            // its owner.
 1398|   789k|            object.qpdf() == &qpdf,
 1399|   789k|            "QPDFObjectHandle from different QPDF found while writing.  "
 1400|   789k|            "Use QPDF::copyForeignObject to add objects from another file." //
 1401|   789k|        );
 1402|       |
 1403|   789k|        if (cfg.qdf() && object.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (1403:13): [True: 789k, False: 0]
  |  Branch (1403:13): [True: 553, False: 789k]
  |  Branch (1403:26): [True: 553, False: 789k]
  ------------------
 1404|       |            // As a special case, do not output any extraneous XRef streams in QDF mode. Doing so
 1405|       |            // will confuse fix-qdf, which expects to see only one XRef stream at the end of the
 1406|       |            // file. This case can occur when creating a QDF from a file with object streams when
 1407|       |            // preserving unreferenced objects since the old cross reference streams are not
 1408|       |            // actually referenced by object number.
 1409|    553|            return;
 1410|    553|        }
 1411|       |
 1412|   789k|        QPDFObjGen og = object.getObjGen();
 1413|   789k|        auto& o = obj[og];
 1414|       |
 1415|   789k|        if (o.renumber == 0) {
  ------------------
  |  Branch (1415:13): [True: 90.7k, False: 698k]
  ------------------
 1416|  90.7k|            if (o.object_stream > 0) {
  ------------------
  |  Branch (1416:17): [True: 3.64k, False: 87.0k]
  ------------------
 1417|       |                // This is in an object stream.  Don't process it here.  Instead, enqueue the object
 1418|       |                // stream.  Object streams always have generation 0.
 1419|       |                // Detect loops by storing invalid object ID -1, which will get overwritten later.
 1420|  3.64k|                o.renumber = -1;
 1421|  3.64k|                enqueue(qpdf.getObject(o.object_stream, 0));
 1422|  87.0k|            } else {
 1423|  87.0k|                object_queue.emplace_back(object);
 1424|  87.0k|                o.renumber = next_objid++;
 1425|       |
 1426|  87.0k|                if (og.getGen() == 0 && object_stream_to_objects.contains(og.getObj())) {
  ------------------
  |  Branch (1426:21): [True: 85.9k, False: 1.16k]
  |  Branch (1426:21): [True: 3.25k, False: 83.8k]
  |  Branch (1426:41): [True: 3.25k, False: 82.6k]
  ------------------
 1427|       |                    // For linearized files, uncompressed objects go at end, and we take care of
 1428|       |                    // assigning numbers to them elsewhere.
 1429|  3.25k|                    if (!cfg.linearize()) {
  ------------------
  |  Branch (1429:25): [True: 3.25k, False: 0]
  ------------------
 1430|  3.25k|                        assignCompressedObjectNumbers(og);
 1431|  3.25k|                    }
 1432|  83.8k|                } else if (!cfg.direct_stream_lengths() && object.isStream()) {
  ------------------
  |  Branch (1432:28): [True: 83.8k, False: 0]
  |  Branch (1432:60): [True: 24.1k, False: 59.6k]
  ------------------
 1433|       |                    // reserve next object ID for length
 1434|  24.1k|                    ++next_objid;
 1435|  24.1k|                }
 1436|  87.0k|            }
 1437|  90.7k|        }
 1438|   789k|        return;
 1439|   789k|    }
 1440|       |
 1441|   173M|    if (cfg.linearize()) {
  ------------------
  |  Branch (1441:9): [True: 0, False: 173M]
  ------------------
 1442|      0|        return;
 1443|      0|    }
 1444|       |
 1445|   173M|    if (Array array = object) {
  ------------------
  |  Branch (1445:15): [True: 456k, False: 172M]
  ------------------
 1446|   151M|        for (auto& item: array) {
  ------------------
  |  Branch (1446:24): [True: 151M, False: 456k]
  ------------------
 1447|   151M|            enqueue(item);
 1448|   151M|        }
 1449|   456k|        return;
 1450|   456k|    }
 1451|       |
 1452|   172M|    for (auto const& item: Dictionary(object)) {
  ------------------
  |  Branch (1452:26): [True: 3.19M, False: 172M]
  ------------------
 1453|  3.19M|        if (!item.second.null()) {
  ------------------
  |  Branch (1453:13): [True: 2.58M, False: 607k]
  ------------------
 1454|  2.58M|            enqueue(item.second);
 1455|  2.58M|        }
 1456|  3.19M|    }
 1457|   172M|}
_ZN4qpdf4impl6Writer12unparseChildERK16QPDFObjectHandlemi:
 1461|  19.3M|{
 1462|  19.3M|    if (!cfg.linearize()) {
  ------------------
  |  Branch (1462:9): [True: 19.3M, False: 0]
  ------------------
 1463|  19.3M|        enqueue(child);
 1464|  19.3M|    }
 1465|  19.3M|    if (child.indirect()) {
  ------------------
  |  Branch (1465:9): [True: 145k, False: 19.2M]
  ------------------
 1466|   145k|        write(obj[child].renumber).write(" 0 R");
 1467|  19.2M|    } else {
 1468|  19.2M|        unparseObject(child, level, flags);
 1469|  19.2M|    }
 1470|  19.3M|}
_ZN4qpdf4impl6Writer12writeTrailerENS1_9trailer_eEibxi:
 1475|  8.38k|{
 1476|  8.38k|    auto trailer = trimmed_trailer();
 1477|  8.38k|    if (xref_stream) {
  ------------------
  |  Branch (1477:9): [True: 470, False: 7.91k]
  ------------------
 1478|    470|        cur_data_key.clear();
 1479|  7.91k|    } else {
 1480|  7.91k|        write("trailer <<");
 1481|  7.91k|    }
 1482|  8.38k|    write_qdf("\n");
 1483|  8.38k|    if (which == t_lin_second) {
  ------------------
  |  Branch (1483:9): [True: 0, False: 8.38k]
  ------------------
 1484|      0|        write(" /Size ").write(size);
 1485|  8.38k|    } else {
 1486|  17.4k|        for (auto const& [key, value]: trailer) {
  ------------------
  |  Branch (1486:38): [True: 17.4k, False: 8.38k]
  ------------------
 1487|  17.4k|            if (value.null()) {
  ------------------
  |  Branch (1487:17): [True: 3.35k, False: 14.0k]
  ------------------
 1488|  3.35k|                continue;
 1489|  3.35k|            }
 1490|  14.0k|            write_qdf("  ").write_no_qdf(" ").write_name(key).write(" ");
 1491|  14.0k|            if (key == "/Size") {
  ------------------
  |  Branch (1491:17): [True: 2.10k, False: 11.9k]
  ------------------
 1492|  2.10k|                write(size);
 1493|  2.10k|                if (which == t_lin_first) {
  ------------------
  |  Branch (1493:21): [True: 0, False: 2.10k]
  ------------------
 1494|      0|                    write(" /Prev ");
 1495|      0|                    qpdf_offset_t pos = pipeline->getCount();
 1496|      0|                    write(prev).write(QIntC::to_size(pos - pipeline->getCount() + 21), ' ');
 1497|      0|                }
 1498|  11.9k|            } else {
 1499|  11.9k|                unparseChild(value, 1, 0);
 1500|  11.9k|            }
 1501|  14.0k|            write_qdf("\n");
 1502|  14.0k|        }
 1503|  8.38k|    }
 1504|       |
 1505|       |    // Write ID
 1506|  8.38k|    write_qdf(" ").write(" /ID [");
 1507|  8.38k|    if (linearization_pass == 1) {
  ------------------
  |  Branch (1507:9): [True: 0, False: 8.38k]
  ------------------
 1508|      0|        std::string original_id1 = getOriginalID1();
 1509|      0|        if (original_id1.empty()) {
  ------------------
  |  Branch (1509:13): [True: 0, False: 0]
  ------------------
 1510|      0|            write("<00000000000000000000000000000000>");
 1511|      0|        } else {
 1512|       |            // Write a string of zeroes equal in length to the representation of the original ID.
 1513|       |            // While writing the original ID would have the same number of bytes, it would cause a
 1514|       |            // change to the deterministic ID generated by older versions of the software that
 1515|       |            // hard-coded the length of the ID to 16 bytes.
 1516|      0|            size_t len = QPDF_String(original_id1).unparse(true).length() - 2;
 1517|      0|            write("<").write(len, '0').write(">");
 1518|      0|        }
 1519|      0|        write("<00000000000000000000000000000000>");
 1520|  8.38k|    } else {
 1521|  8.38k|        if (linearization_pass == 0 && cfg.deterministic_id()) {
  ------------------
  |  Branch (1521:13): [True: 8.38k, False: 0]
  |  Branch (1521:40): [True: 8.38k, False: 0]
  ------------------
 1522|  8.38k|            computeDeterministicIDData();
 1523|  8.38k|        }
 1524|  8.38k|        generateID(encryption.get());
 1525|  8.38k|        write_string(id1, true).write_string(id2, true);
 1526|  8.38k|    }
 1527|  8.38k|    write("]");
 1528|       |
 1529|  8.38k|    if (which != t_lin_second) {
  ------------------
  |  Branch (1529:9): [True: 8.38k, False: 0]
  ------------------
 1530|       |        // Write reference to encryption dictionary
 1531|  8.38k|        if (encryption) {
  ------------------
  |  Branch (1531:13): [True: 0, False: 8.38k]
  ------------------
 1532|      0|            write(" /Encrypt ").write(encryption_dict_objid).write(" 0 R");
 1533|      0|        }
 1534|  8.38k|    }
 1535|       |
 1536|  8.38k|    write_qdf("\n>>").write_no_qdf(" >>");
 1537|  8.38k|}
_ZN4qpdf4impl6Writer18will_filter_streamE16QPDFObjectHandlePNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1549|  24.1k|{
 1550|  24.1k|    const bool is_root_metadata = stream.isRootMetadata();
 1551|  24.1k|    bool filter = false;
 1552|  24.1k|    auto decode_level = cfg.decode_level();
 1553|  24.1k|    int encode_flags = 0;
 1554|  24.1k|    Dictionary stream_dict = stream.getDict();
 1555|       |
 1556|  24.1k|    if (stream.getFilterOnWrite()) {
  ------------------
  |  Branch (1556:9): [True: 24.1k, False: 0]
  ------------------
 1557|  24.1k|        filter = stream.isDataModified() || cfg.compress_streams() || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (1557:18): [True: 0, False: 24.1k]
  |  Branch (1557:45): [True: 0, False: 24.1k]
  |  Branch (1557:71): [True: 24.1k, False: 0]
  ------------------
 1558|  24.1k|        if (cfg.compress_streams()) {
  ------------------
  |  Branch (1558:13): [True: 0, False: 24.1k]
  ------------------
 1559|       |            // Don't filter if the stream is already compressed with FlateDecode. This way we don't
 1560|       |            // make it worse if the original file used a better Flate algorithm, and we don't spend
 1561|       |            // time and CPU cycles uncompressing and recompressing stuff. This can be overridden
 1562|       |            // with setRecompressFlate(true).
 1563|      0|            Name Filter = stream_dict["/Filter"];
 1564|      0|            if (Filter && !cfg.recompress_flate() && !stream.isDataModified() &&
  ------------------
  |  Branch (1564:17): [True: 0, False: 0]
  |  Branch (1564:27): [True: 0, False: 0]
  |  Branch (1564:54): [True: 0, False: 0]
  ------------------
 1565|      0|                (Filter == "/FlateDecode" || Filter == "/Fl")) {
  ------------------
  |  Branch (1565:18): [True: 0, False: 0]
  |  Branch (1565:46): [True: 0, False: 0]
  ------------------
 1566|      0|                filter = false;
 1567|      0|            }
 1568|      0|        }
 1569|  24.1k|        if (is_root_metadata && (!encryption || !encryption->getEncryptMetadata())) {
  ------------------
  |  Branch (1569:13): [True: 119, False: 24.0k]
  |  Branch (1569:34): [True: 119, False: 0]
  |  Branch (1569:49): [True: 0, False: 0]
  ------------------
 1570|    119|            filter = true;
 1571|    119|            decode_level = qpdf_dl_all;
 1572|  24.0k|        } else if (cfg.normalize_content() && normalized_streams.contains(stream)) {
  ------------------
  |  Branch (1572:20): [True: 24.0k, False: 0]
  |  Branch (1572:20): [True: 2.84k, False: 21.1k]
  |  Branch (1572:47): [True: 2.84k, False: 21.1k]
  ------------------
 1573|  2.84k|            encode_flags = qpdf_ef_normalize;
 1574|  2.84k|            filter = true;
 1575|  21.1k|        } else if (filter && cfg.compress_streams()) {
  ------------------
  |  Branch (1575:20): [True: 21.1k, False: 0]
  |  Branch (1575:30): [True: 0, False: 21.1k]
  ------------------
 1576|      0|            encode_flags = qpdf_ef_compress;
 1577|      0|        }
 1578|  24.1k|    }
 1579|       |
 1580|       |    // Disable compression for empty streams to improve compatibility
 1581|  24.1k|    if (Integer(stream_dict["/Length"]) == 0) {
  ------------------
  |  Branch (1581:9): [True: 58, False: 24.0k]
  ------------------
 1582|     58|        filter = true;
 1583|     58|        encode_flags = 0;
 1584|     58|    }
 1585|       |
 1586|  37.5k|    for (bool first_attempt: {true, false}) {
  ------------------
  |  Branch (1586:28): [True: 37.5k, False: 0]
  ------------------
 1587|  37.5k|        auto pp_stream_data =
 1588|  37.5k|            stream_data ? pipeline_stack.activate(*stream_data) : pipeline_stack.activate(true);
  ------------------
  |  Branch (1588:13): [True: 37.5k, False: 0]
  ------------------
 1589|       |
 1590|  37.5k|        try {
 1591|  37.5k|            if (stream.pipeStreamData(
  ------------------
  |  Branch (1591:17): [True: 10.7k, False: 26.8k]
  ------------------
 1592|  37.5k|                    pipeline,
 1593|  37.5k|                    filter ? encode_flags : 0,
  ------------------
  |  Branch (1593:21): [True: 24.1k, False: 13.4k]
  ------------------
 1594|  37.5k|                    filter ? decode_level : qpdf_dl_none,
  ------------------
  |  Branch (1594:21): [True: 24.1k, False: 13.4k]
  ------------------
 1595|  37.5k|                    false,
 1596|  37.5k|                    first_attempt)) {
 1597|  10.7k|                return {true, encode_flags & qpdf_ef_compress, is_root_metadata};
 1598|  10.7k|            }
 1599|  26.8k|            if (!filter) {
  ------------------
  |  Branch (1599:17): [True: 13.3k, False: 13.4k]
  ------------------
 1600|  13.3k|                break;
 1601|  13.3k|            }
 1602|  26.8k|        } catch (std::runtime_error& e) {
 1603|     44|            if (!(filter && first_attempt)) {
  ------------------
  |  Branch (1603:19): [True: 27, False: 17]
  |  Branch (1603:29): [True: 27, False: 0]
  ------------------
 1604|     17|                throw std::runtime_error(
 1605|     17|                    "error while getting stream data for " + stream.unparse() + ": " + e.what());
 1606|     17|            }
 1607|     27|            stream.warn("error while getting stream data: "s + e.what());
 1608|     27|            stream.warn("qpdf will attempt to write the damaged stream unchanged");
 1609|     27|        }
 1610|       |        // Try again
 1611|  13.4k|        filter = false;
 1612|  13.4k|        stream.setFilterOnWrite(false);
 1613|  13.4k|        if (stream_data) {
  ------------------
  |  Branch (1613:13): [True: 13.4k, False: 0]
  ------------------
 1614|  13.4k|            stream_data->clear();
 1615|  13.4k|        }
 1616|  13.4k|    }
 1617|  13.3k|    return {false, false, is_root_metadata};
 1618|  24.1k|}
_ZN4qpdf4impl6Writer13unparseObjectE16QPDFObjectHandlemimb:
 1623|  19.3M|{
 1624|  19.3M|    QPDFObjGen old_og = object.getObjGen();
 1625|  19.3M|    int child_flags = flags & ~f_stream;
 1626|       |    // For non-qdf, "indent" and "indent_large" are a single space between tokens. For qdf, they
 1627|       |    // include the preceding newline.
 1628|  19.3M|    std::string indent_large = " ";
 1629|  19.3M|    if (cfg.qdf()) {
  ------------------
  |  Branch (1629:9): [True: 19.3M, False: 0]
  ------------------
 1630|  19.3M|        indent_large.append(2 * (level + 1), ' ');
 1631|  19.3M|        indent_large[0] = '\n';
 1632|  19.3M|    }
 1633|  19.3M|    std::string_view indent{indent_large.data(), cfg.qdf() ? indent_large.size() - 2 : 1};
  ------------------
  |  Branch (1633:50): [True: 19.3M, False: 0]
  ------------------
 1634|       |
 1635|  19.3M|    if (auto const tc = object.getTypeCode(); tc == ::ot_array) {
  ------------------
  |  Branch (1635:47): [True: 55.8k, False: 19.2M]
  ------------------
 1636|       |        // Note: PDF spec 1.4 implementation note 121 states that Acrobat requires a space after the
 1637|       |        // [ in the /H key of the linearization parameter dictionary.  We'll do this unconditionally
 1638|       |        // for all arrays because it looks nicer and doesn't make the files that much bigger.
 1639|  55.8k|        write("[");
 1640|  19.0M|        for (auto const& item: object.as_array()) {
  ------------------
  |  Branch (1640:30): [True: 19.0M, False: 55.8k]
  ------------------
 1641|  19.0M|            write(indent_large);
 1642|  19.0M|            unparseChild(item, level + 1, child_flags);
 1643|  19.0M|        }
 1644|  55.8k|        write(indent).write("]");
 1645|  19.2M|    } else if (tc == ::ot_dictionary) {
  ------------------
  |  Branch (1645:16): [True: 101k, False: 19.1M]
  ------------------
 1646|       |        // Handle special cases for specific dictionaries.
 1647|       |
 1648|   101k|        if (old_og == root_og) {
  ------------------
  |  Branch (1648:13): [True: 7.99k, False: 93.2k]
  ------------------
 1649|       |            // Extensions dictionaries.
 1650|       |
 1651|       |            // We have one of several cases:
 1652|       |            //
 1653|       |            // * We need ADBE
 1654|       |            //    - We already have Extensions
 1655|       |            //       - If it has the right ADBE, preserve it
 1656|       |            //       - Otherwise, replace ADBE
 1657|       |            //    - We don't have Extensions: create one from scratch
 1658|       |            // * We don't want ADBE
 1659|       |            //    - We already have Extensions
 1660|       |            //       - If it only has ADBE, remove it
 1661|       |            //       - If it has other things, keep those and remove ADBE
 1662|       |            //    - We have no extensions: no action required
 1663|       |            //
 1664|       |            // Before writing, we guarantee that /Extensions, if present, is direct through the ADBE
 1665|       |            // dictionary, so we can modify in place.
 1666|       |
 1667|  7.99k|            auto extensions = object.getKey("/Extensions");
 1668|  7.99k|            const bool has_extensions = extensions.isDictionary();
 1669|  7.99k|            const bool need_extensions_adbe = final_extension_level > 0;
 1670|       |
 1671|  7.99k|            if (has_extensions || need_extensions_adbe) {
  ------------------
  |  Branch (1671:17): [True: 296, False: 7.70k]
  |  Branch (1671:35): [True: 0, False: 7.70k]
  ------------------
 1672|       |                // Make a shallow copy of this object so we can modify it safely without affecting
 1673|       |                // the original. This code has logic to skip certain keys in agreement with
 1674|       |                // prepareFileForWrite and with skip_stream_parameters so that replacing them
 1675|       |                // doesn't leave unreferenced objects in the output. We can use unsafeShallowCopy
 1676|       |                // here because all we are doing is removing or replacing top-level keys.
 1677|    296|                object = object.unsafeShallowCopy();
 1678|    296|                if (!has_extensions) {
  ------------------
  |  Branch (1678:21): [True: 0, False: 296]
  ------------------
 1679|      0|                    extensions = QPDFObjectHandle();
 1680|      0|                }
 1681|       |
 1682|    296|                const bool have_extensions_adbe = extensions && extensions.hasKey("/ADBE");
  ------------------
  |  Branch (1682:51): [True: 296, False: 0]
  |  Branch (1682:65): [True: 195, False: 101]
  ------------------
 1683|    296|                const bool have_extensions_other =
 1684|    296|                    extensions && extensions.getKeys().size() > (have_extensions_adbe ? 1u : 0u);
  ------------------
  |  Branch (1684:21): [True: 296, False: 0]
  |  Branch (1684:35): [True: 108, False: 188]
  |  Branch (1684:66): [True: 195, False: 101]
  ------------------
 1685|       |
 1686|    296|                if (need_extensions_adbe) {
  ------------------
  |  Branch (1686:21): [True: 33, False: 263]
  ------------------
 1687|     33|                    if (!(have_extensions_other || have_extensions_adbe)) {
  ------------------
  |  Branch (1687:27): [True: 1, False: 32]
  |  Branch (1687:52): [True: 32, False: 0]
  ------------------
 1688|       |                        // We need Extensions and don't have it.  Create it here.
 1689|      0|                        QTC::TC("qpdf", "QPDFWriter create Extensions", cfg.qdf() ? 0 : 1);
  ------------------
  |  Branch (1689:73): [True: 0, False: 0]
  ------------------
 1690|      0|                        extensions = object.replaceKeyAndGetNew(
 1691|      0|                            "/Extensions", QPDFObjectHandle::newDictionary());
 1692|      0|                    }
 1693|    263|                } else if (!have_extensions_other) {
  ------------------
  |  Branch (1693:28): [True: 156, False: 107]
  ------------------
 1694|       |                    // We have Extensions dictionary and don't want one.
 1695|    156|                    if (have_extensions_adbe) {
  ------------------
  |  Branch (1695:25): [True: 153, False: 3]
  ------------------
 1696|    153|                        QTC::TC("qpdf", "QPDFWriter remove existing Extensions");
 1697|    153|                        object.removeKey("/Extensions");
 1698|    153|                        extensions = QPDFObjectHandle(); // uninitialized
 1699|    153|                    }
 1700|    156|                }
 1701|       |
 1702|    296|                if (extensions) {
  ------------------
  |  Branch (1702:21): [True: 143, False: 153]
  ------------------
 1703|    143|                    QTC::TC("qpdf", "QPDFWriter preserve Extensions");
 1704|    143|                    QPDFObjectHandle adbe = extensions.getKey("/ADBE");
 1705|    143|                    if (adbe.isDictionary() &&
  ------------------
  |  Branch (1705:25): [True: 42, False: 101]
  |  Branch (1705:25): [True: 5, False: 138]
  ------------------
 1706|     42|                        adbe.getKey("/BaseVersion").isNameAndEquals("/" + final_pdf_version) &&
  ------------------
  |  Branch (1706:25): [True: 27, False: 15]
  ------------------
 1707|     27|                        adbe.getKey("/ExtensionLevel").isInteger() &&
  ------------------
  |  Branch (1707:25): [True: 26, False: 1]
  ------------------
 1708|     26|                        (adbe.getKey("/ExtensionLevel").getIntValue() == final_extension_level)) {
  ------------------
  |  Branch (1708:25): [True: 5, False: 21]
  ------------------
 1709|    138|                    } else {
 1710|    138|                        if (need_extensions_adbe) {
  ------------------
  |  Branch (1710:29): [True: 28, False: 110]
  ------------------
 1711|     28|                            extensions.replaceKey(
 1712|     28|                                "/ADBE",
 1713|     28|                                QPDFObjectHandle::parse(
 1714|     28|                                    "<< /BaseVersion /" + final_pdf_version + " /ExtensionLevel " +
 1715|     28|                                    std::to_string(final_extension_level) + " >>"));
 1716|    110|                        } else {
 1717|    110|                            extensions.removeKey("/ADBE");
 1718|    110|                        }
 1719|    138|                    }
 1720|    143|                }
 1721|    296|            }
 1722|  7.99k|        }
 1723|       |
 1724|       |        // Stream dictionaries.
 1725|       |
 1726|   101k|        if (flags & f_stream) {
  ------------------
  |  Branch (1726:13): [True: 24.1k, False: 77.0k]
  ------------------
 1727|       |            // Suppress /Length since we will write it manually
 1728|       |
 1729|       |            // Make a shallow copy of this object so we can modify it safely without affecting the
 1730|       |            // original. This code has logic to skip certain keys in agreement with
 1731|       |            // prepareFileForWrite and with skip_stream_parameters so that replacing them doesn't
 1732|       |            // leave unreferenced objects in the output. We can use unsafeShallowCopy here because
 1733|       |            // all we are doing is removing or replacing top-level keys.
 1734|  24.1k|            object = object.unsafeShallowCopy();
 1735|       |
 1736|  24.1k|            object.removeKey("/Length");
 1737|       |
 1738|       |            // If /DecodeParms is an empty list, remove it.
 1739|  24.1k|            if (object.getKey("/DecodeParms").empty()) {
  ------------------
  |  Branch (1739:17): [True: 23.5k, False: 577]
  ------------------
 1740|  23.5k|                object.removeKey("/DecodeParms");
 1741|  23.5k|            }
 1742|       |
 1743|  24.1k|            if (flags & f_filtered) {
  ------------------
  |  Branch (1743:17): [True: 10.7k, False: 13.3k]
  ------------------
 1744|       |                // We will supply our own filter and decode parameters.
 1745|  10.7k|                object.removeKey("/Filter");
 1746|  10.7k|                object.removeKey("/DecodeParms");
 1747|  13.3k|            } else {
 1748|       |                // Make sure, no matter what else we have, that we don't have /Crypt in the output
 1749|       |                // filters.
 1750|  13.3k|                QPDFObjectHandle filter = object.getKey("/Filter");
 1751|  13.3k|                QPDFObjectHandle decode_parms = object.getKey("/DecodeParms");
 1752|  13.3k|                if (filter.isOrHasName("/Crypt")) {
  ------------------
  |  Branch (1752:21): [True: 271, False: 13.1k]
  ------------------
 1753|    271|                    if (filter.isName()) {
  ------------------
  |  Branch (1753:25): [True: 64, False: 207]
  ------------------
 1754|     64|                        object.removeKey("/Filter");
 1755|     64|                        object.removeKey("/DecodeParms");
 1756|    207|                    } else {
 1757|    207|                        int idx = 0;
 1758|  8.07k|                        for (auto const& item: filter.as_array()) {
  ------------------
  |  Branch (1758:46): [True: 8.07k, False: 0]
  ------------------
 1759|  8.07k|                            if (item.isNameAndEquals("/Crypt")) {
  ------------------
  |  Branch (1759:33): [True: 207, False: 7.86k]
  ------------------
 1760|       |                                // If filter is an array, then the code in QPDF_Stream has already
 1761|       |                                // verified that DecodeParms and Filters are arrays of the same
 1762|       |                                // length, but if they weren't for some reason, eraseItem does type
 1763|       |                                // and bounds checking. Fuzzing tells us that this can actually
 1764|       |                                // happen.
 1765|    207|                                filter.eraseItem(idx);
 1766|    207|                                decode_parms.eraseItem(idx);
 1767|    207|                                break;
 1768|    207|                            }
 1769|  7.86k|                            ++idx;
 1770|  7.86k|                        }
 1771|    207|                    }
 1772|    271|                }
 1773|  13.3k|            }
 1774|  24.1k|        }
 1775|       |
 1776|   101k|        write("<<");
 1777|       |
 1778|   436k|        for (auto const& [key, value]: object.as_dictionary()) {
  ------------------
  |  Branch (1778:38): [True: 436k, False: 101k]
  ------------------
 1779|   436k|            if (!value.null()) {
  ------------------
  |  Branch (1779:17): [True: 323k, False: 113k]
  ------------------
 1780|   323k|                write(indent_large).write_name(key).write(" ");
 1781|   323k|                if (key == "/Contents" && object.isDictionaryOfType("/Sig") &&
  ------------------
  |  Branch (1781:21): [True: 3.15k, False: 320k]
  |  Branch (1781:21): [True: 15, False: 323k]
  |  Branch (1781:43): [True: 29, False: 3.12k]
  ------------------
 1782|     29|                    object.hasKey("/ByteRange")) {
  ------------------
  |  Branch (1782:21): [True: 15, False: 14]
  ------------------
 1783|     15|                    QTC::TC("qpdf", "QPDFWriter no encryption sig contents");
 1784|     15|                    unparseChild(value, level + 1, child_flags | f_hex_string | f_no_encryption);
 1785|   323k|                } else {
 1786|   323k|                    unparseChild(value, level + 1, child_flags);
 1787|   323k|                }
 1788|   323k|            }
 1789|   436k|        }
 1790|       |
 1791|   101k|        if (flags & f_stream) {
  ------------------
  |  Branch (1791:13): [True: 24.0k, False: 77.1k]
  ------------------
 1792|  24.0k|            write(indent_large).write("/Length ");
 1793|       |
 1794|  24.0k|            if (cfg.direct_stream_lengths()) {
  ------------------
  |  Branch (1794:17): [True: 0, False: 24.0k]
  ------------------
 1795|      0|                write(stream_length);
 1796|  24.0k|            } else {
 1797|  24.0k|                write(cur_stream_length_id).write(" 0 R");
 1798|  24.0k|            }
 1799|  24.0k|            if (compress && (flags & f_filtered)) {
  ------------------
  |  Branch (1799:17): [True: 0, False: 24.0k]
  |  Branch (1799:29): [True: 0, False: 0]
  ------------------
 1800|      0|                write(indent_large).write("/Filter /FlateDecode");
 1801|      0|            }
 1802|  24.0k|        }
 1803|       |
 1804|   101k|        write(indent).write(">>");
 1805|  19.1M|    } else if (tc == ::ot_stream) {
  ------------------
  |  Branch (1805:16): [True: 24.1k, False: 19.1M]
  ------------------
 1806|       |        // Write stream data to a buffer.
 1807|  24.1k|        if (!cfg.direct_stream_lengths()) {
  ------------------
  |  Branch (1807:13): [True: 24.1k, False: 0]
  ------------------
 1808|  24.1k|            cur_stream_length_id = obj[old_og].renumber + 1;
 1809|  24.1k|        }
 1810|       |
 1811|  24.1k|        flags |= f_stream;
 1812|  24.1k|        std::string stream_data;
 1813|  24.1k|        auto [filter, compress_stream, is_root_metadata] = will_filter_stream(object, &stream_data);
 1814|  24.1k|        if (filter) {
  ------------------
  |  Branch (1814:13): [True: 10.7k, False: 13.4k]
  ------------------
 1815|  10.7k|            flags |= f_filtered;
 1816|  10.7k|        }
 1817|  24.1k|        QPDFObjectHandle stream_dict = object.getDict();
 1818|       |
 1819|  24.1k|        cur_stream_length = stream_data.size();
 1820|  24.1k|        if (is_root_metadata && encryption && !encryption->getEncryptMetadata()) {
  ------------------
  |  Branch (1820:13): [True: 119, False: 24.0k]
  |  Branch (1820:33): [True: 0, False: 119]
  |  Branch (1820:47): [True: 0, False: 0]
  ------------------
 1821|       |            // Don't encrypt stream data for the metadata stream
 1822|      0|            cur_data_key.clear();
 1823|      0|        }
 1824|  24.1k|        adjustAESStreamLength(cur_stream_length);
 1825|  24.1k|        unparseObject(stream_dict, 0, flags, cur_stream_length, compress_stream);
 1826|  24.1k|        char last_char = stream_data.empty() ? '\0' : stream_data.back();
  ------------------
  |  Branch (1826:26): [True: 2.78k, False: 21.3k]
  ------------------
 1827|  24.1k|        write("\nstream\n").write_encrypted(stream_data);
 1828|  24.1k|        added_newline = cfg.newline_before_endstream() || (cfg.qdf() && last_char != '\n');
  ------------------
  |  Branch (1828:25): [True: 83, False: 24.0k]
  |  Branch (1828:60): [True: 24.0k, False: 0]
  |  Branch (1828:73): [True: 16.7k, False: 7.27k]
  ------------------
 1829|  24.1k|        write(added_newline ? "\nendstream" : "endstream");
  ------------------
  |  Branch (1829:15): [True: 16.7k, False: 7.36k]
  ------------------
 1830|  19.1M|    } else if (tc == ::ot_string) {
  ------------------
  |  Branch (1830:16): [True: 19.3k, False: 19.1M]
  ------------------
 1831|  19.3k|        std::string val;
 1832|  19.3k|        if (encryption && !(flags & f_in_ostream) && !(flags & f_no_encryption) &&
  ------------------
  |  Branch (1832:13): [True: 0, False: 19.3k]
  |  Branch (1832:27): [True: 0, False: 0]
  |  Branch (1832:54): [True: 0, False: 0]
  ------------------
 1833|      0|            !cur_data_key.empty()) {
  ------------------
  |  Branch (1833:13): [True: 0, False: 0]
  ------------------
 1834|      0|            val = object.getStringValue();
 1835|      0|            if (cfg.encrypt_use_aes()) {
  ------------------
  |  Branch (1835:17): [True: 0, False: 0]
  ------------------
 1836|      0|                Pl_Buffer bufpl("encrypted string");
 1837|      0|                Pl_AES_PDF pl("aes encrypt string", &bufpl, true, cur_data_key);
 1838|      0|                pl.writeString(val);
 1839|      0|                pl.finish();
 1840|      0|                val = QPDF_String(bufpl.getString()).unparse(true);
 1841|      0|            } else {
 1842|      0|                auto tmp_ph = QUtil::make_unique_cstr(val);
 1843|      0|                char* tmp = tmp_ph.get();
 1844|      0|                size_t vlen = val.length();
 1845|      0|                RC4 rc4(
 1846|      0|                    QUtil::unsigned_char_pointer(cur_data_key),
 1847|      0|                    QIntC::to_int(cur_data_key.length()));
 1848|      0|                auto data = QUtil::unsigned_char_pointer(tmp);
 1849|      0|                rc4.process(data, vlen, data);
 1850|      0|                val = QPDF_String(std::string(tmp, vlen)).unparse();
 1851|      0|            }
 1852|  19.3k|        } else if (flags & f_hex_string) {
  ------------------
  |  Branch (1852:20): [True: 15, False: 19.3k]
  ------------------
 1853|     15|            val = QPDF_String(object.getStringValue()).unparse(true);
 1854|  19.3k|        } else {
 1855|  19.3k|            val = object.unparseResolved();
 1856|  19.3k|        }
 1857|  19.3k|        write(val);
 1858|  19.1M|    } else {
 1859|  19.1M|        write(object.unparseResolved());
 1860|  19.1M|    }
 1861|  19.3M|}
_ZN4qpdf4impl6Writer24writeObjectStreamOffsetsERNSt3__16vectorIxNS2_9allocatorIxEEEEi:
 1865|  6.49k|{
 1866|  6.49k|    qpdf_assert_debug(first_obj > 0);
  ------------------
  |  |   11|  6.49k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (1866:5): [True: 6.49k, False: 0]
  ------------------
 1867|  6.49k|    bool is_first = true;
 1868|  6.49k|    auto id = std::to_string(first_obj) + ' ';
 1869|  37.2k|    for (auto& offset: offsets) {
  ------------------
  |  Branch (1869:22): [True: 37.2k, False: 6.49k]
  ------------------
 1870|  37.2k|        if (is_first) {
  ------------------
  |  Branch (1870:13): [True: 6.49k, False: 30.7k]
  ------------------
 1871|  6.49k|            is_first = false;
 1872|  30.7k|        } else {
 1873|  30.7k|            write_qdf("\n").write_no_qdf(" ");
 1874|  30.7k|        }
 1875|  37.2k|        write(id);
 1876|  37.2k|        util::increment(id, 1);
 1877|  37.2k|        write(offset);
 1878|  37.2k|    }
 1879|  6.49k|    write("\n");
 1880|  6.49k|}
_ZN4qpdf4impl6Writer17writeObjectStreamE16QPDFObjectHandle:
 1884|  3.24k|{
 1885|       |    // Note: object might be null if this is a place-holder for an object stream that we are
 1886|       |    // generating from scratch.
 1887|       |
 1888|  3.24k|    QPDFObjGen old_og = object.getObjGen();
 1889|  3.24k|    qpdf_assert_debug(old_og.getGen() == 0);
  ------------------
  |  |   11|  3.24k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (1889:5): [True: 3.24k, False: 0]
  ------------------
 1890|  3.24k|    int old_id = old_og.getObj();
 1891|  3.24k|    int new_stream_id = obj[old_og].renumber;
 1892|       |
 1893|  3.24k|    std::vector<qpdf_offset_t> offsets;
 1894|  3.24k|    qpdf_offset_t first = 0;
 1895|       |
 1896|       |    // Generate stream itself.  We have to do this in two passes so we can calculate offsets in the
 1897|       |    // first pass.
 1898|  3.24k|    std::string stream_buffer_pass1;
 1899|  3.24k|    std::string stream_buffer_pass2;
 1900|  3.24k|    int first_obj = -1;
 1901|  3.24k|    const bool compressed = cfg.compress_streams() && !cfg.qdf();
  ------------------
  |  Branch (1901:29): [True: 0, False: 3.24k]
  |  Branch (1901:55): [True: 0, False: 0]
  ------------------
 1902|  3.24k|    {
 1903|       |        // Pass 1
 1904|  3.24k|        auto pp_ostream_pass1 = pipeline_stack.activate(stream_buffer_pass1);
 1905|       |
 1906|  3.24k|        int count = -1;
 1907|  18.6k|        for (auto const& og: object_stream_to_objects[old_id]) {
  ------------------
  |  Branch (1907:28): [True: 18.6k, False: 3.24k]
  ------------------
 1908|  18.6k|            ++count;
 1909|  18.6k|            int new_o = obj[og].renumber;
 1910|  18.6k|            if (first_obj == -1) {
  ------------------
  |  Branch (1910:17): [True: 3.24k, False: 15.3k]
  ------------------
 1911|  3.24k|                first_obj = new_o;
 1912|  3.24k|            }
 1913|  18.6k|            if (cfg.qdf()) {
  ------------------
  |  Branch (1913:17): [True: 18.6k, False: 0]
  ------------------
 1914|  18.6k|                write("%% Object stream: object ").write(new_o).write(", index ").write(count);
 1915|  18.6k|                if (!cfg.no_original_object_ids()) {
  ------------------
  |  Branch (1915:21): [True: 18.6k, False: 0]
  ------------------
 1916|  18.6k|                    write("; original object ID: ").write(og.getObj());
 1917|       |                    // For compatibility, only write the generation if non-zero.  While object
 1918|       |                    // streams only allow objects with generation 0, if we are generating object
 1919|       |                    // streams, the old object could have a non-zero generation.
 1920|  18.6k|                    if (og.getGen() != 0) {
  ------------------
  |  Branch (1920:25): [True: 0, False: 18.6k]
  ------------------
 1921|      0|                        write(" ").write(og.getGen());
 1922|      0|                    }
 1923|  18.6k|                }
 1924|  18.6k|                write("\n");
 1925|  18.6k|            }
 1926|       |
 1927|  18.6k|            offsets.push_back(pipeline->getCount());
 1928|       |            // To avoid double-counting objects being written in object streams for progress
 1929|       |            // reporting, decrement in pass 1.
 1930|  18.6k|            indicateProgress(true, false);
 1931|       |
 1932|  18.6k|            QPDFObjectHandle obj_to_write = qpdf.getObject(og);
 1933|  18.6k|            if (obj_to_write.isStream()) {
  ------------------
  |  Branch (1933:17): [True: 0, False: 18.6k]
  ------------------
 1934|       |                // This condition occurred in a fuzz input. Ideally we should block it at parse
 1935|       |                // time, but it's not clear to me how to construct a case for this.
 1936|      0|                obj_to_write.warn("stream found inside object stream; treating as null");
 1937|      0|                obj_to_write = QPDFObjectHandle::newNull();
 1938|      0|            }
 1939|  18.6k|            writeObject(obj_to_write, count);
 1940|       |
 1941|  18.6k|            new_obj[new_o].xref = QPDFXRefEntry(new_stream_id, count);
 1942|  18.6k|        }
 1943|  3.24k|    }
 1944|  3.24k|    {
 1945|       |        // Adjust offsets to skip over comment before first object
 1946|  3.24k|        first = offsets.at(0);
 1947|  18.6k|        for (auto& iter: offsets) {
  ------------------
  |  Branch (1947:24): [True: 18.6k, False: 3.24k]
  ------------------
 1948|  18.6k|            iter -= first;
 1949|  18.6k|        }
 1950|       |
 1951|       |        // Take one pass at writing pairs of numbers so we can get their size information
 1952|  3.24k|        {
 1953|  3.24k|            auto pp_discard = pipeline_stack.activate(true);
 1954|  3.24k|            writeObjectStreamOffsets(offsets, first_obj);
 1955|  3.24k|            first += pipeline->getCount();
 1956|  3.24k|        }
 1957|       |
 1958|       |        // Set up a stream to write the stream data into a buffer.
 1959|  3.24k|        auto pp_ostream = pipeline_stack.activate(stream_buffer_pass2);
 1960|       |
 1961|  3.24k|        writeObjectStreamOffsets(offsets, first_obj);
 1962|  3.24k|        write(stream_buffer_pass1);
 1963|  3.24k|        stream_buffer_pass1.clear();
 1964|  3.24k|        stream_buffer_pass1.shrink_to_fit();
 1965|  3.24k|        if (compressed) {
  ------------------
  |  Branch (1965:13): [True: 0, False: 3.24k]
  ------------------
 1966|      0|            stream_buffer_pass2 = pl::pipe<Pl_Flate>(stream_buffer_pass2, Pl_Flate::a_deflate);
 1967|      0|        }
 1968|  3.24k|    }
 1969|       |
 1970|       |    // Write the object
 1971|  3.24k|    openObject(new_stream_id);
 1972|  3.24k|    setDataKey(new_stream_id);
 1973|  3.24k|    write("<<").write_qdf("\n ").write(" /Type /ObjStm").write_qdf("\n ");
 1974|  3.24k|    size_t length = stream_buffer_pass2.size();
 1975|  3.24k|    adjustAESStreamLength(length);
 1976|  3.24k|    write(" /Length ").write(length).write_qdf("\n ");
 1977|  3.24k|    if (compressed) {
  ------------------
  |  Branch (1977:9): [True: 0, False: 3.24k]
  ------------------
 1978|      0|        write(" /Filter /FlateDecode");
 1979|      0|    }
 1980|  3.24k|    write(" /N ").write(offsets.size()).write_qdf("\n ").write(" /First ").write(first);
 1981|  3.24k|    if (!object.null()) {
  ------------------
  |  Branch (1981:9): [True: 631, False: 2.61k]
  ------------------
 1982|       |        // If the original object has an /Extends key, preserve it.
 1983|    631|        QPDFObjectHandle dict = object.getDict();
 1984|    631|        QPDFObjectHandle extends = dict.getKey("/Extends");
 1985|    631|        if (extends.isIndirect()) {
  ------------------
  |  Branch (1985:13): [True: 81, False: 550]
  ------------------
 1986|     81|            write_qdf("\n ").write(" /Extends ");
 1987|     81|            unparseChild(extends, 1, f_in_ostream);
 1988|     81|        }
 1989|    631|    }
 1990|  3.24k|    write_qdf("\n").write_no_qdf(" ").write(">>\nstream\n").write_encrypted(stream_buffer_pass2);
 1991|  3.24k|    write(cfg.newline_before_endstream() ? "\nendstream" : "endstream");
  ------------------
  |  Branch (1991:11): [True: 0, False: 3.24k]
  ------------------
 1992|  3.24k|    if (encryption) {
  ------------------
  |  Branch (1992:9): [True: 0, False: 3.24k]
  ------------------
 1993|      0|        cur_data_key.clear();
 1994|      0|    }
 1995|  3.24k|    closeObject(new_stream_id);
 1996|  3.24k|}
_ZN4qpdf4impl6Writer11writeObjectE16QPDFObjectHandlei:
 2000|   105k|{
 2001|   105k|    QPDFObjGen old_og = object.getObjGen();
 2002|       |
 2003|   105k|    if (object_stream_index == -1 && old_og.getGen() == 0 &&
  ------------------
  |  Branch (2003:9): [True: 86.8k, False: 18.6k]
  |  Branch (2003:9): [True: 3.24k, False: 102k]
  |  Branch (2003:38): [True: 85.6k, False: 1.16k]
  ------------------
 2004|  85.6k|        object_stream_to_objects.contains(old_og.getObj())) {
  ------------------
  |  Branch (2004:9): [True: 3.24k, False: 82.4k]
  ------------------
 2005|  3.24k|        writeObjectStream(object);
 2006|  3.24k|        return;
 2007|  3.24k|    }
 2008|       |
 2009|   102k|    indicateProgress(false, false);
 2010|   102k|    auto new_id = obj[old_og].renumber;
 2011|   102k|    if (cfg.qdf()) {
  ------------------
  |  Branch (2011:9): [True: 102k, False: 0]
  ------------------
 2012|   102k|        if (page_object_to_seq.contains(old_og)) {
  ------------------
  |  Branch (2012:13): [True: 10.9k, False: 91.2k]
  ------------------
 2013|  10.9k|            write("%% Page ").write(page_object_to_seq[old_og]).write("\n");
 2014|  10.9k|        }
 2015|   102k|        if (contents_to_page_seq.contains(old_og)) {
  ------------------
  |  Branch (2015:13): [True: 8.45k, False: 93.7k]
  ------------------
 2016|  8.45k|            write("%% Contents for page ").write(contents_to_page_seq[old_og]).write("\n");
 2017|  8.45k|        }
 2018|   102k|    }
 2019|   102k|    if (object_stream_index == -1) {
  ------------------
  |  Branch (2019:9): [True: 83.6k, False: 18.6k]
  ------------------
 2020|  83.6k|        if (cfg.qdf() && !cfg.no_original_object_ids()) {
  ------------------
  |  Branch (2020:13): [True: 83.6k, False: 0]
  |  Branch (2020:26): [True: 83.6k, False: 0]
  ------------------
 2021|  83.6k|            write("%% Original object ID: ").write(object.getObjGen().unparse(' ')).write("\n");
 2022|  83.6k|        }
 2023|  83.6k|        openObject(new_id);
 2024|  83.6k|        setDataKey(new_id);
 2025|  83.6k|        unparseObject(object, 0, 0);
 2026|  83.6k|        cur_data_key.clear();
 2027|  83.6k|        closeObject(new_id);
 2028|  83.6k|    } else {
 2029|  18.6k|        unparseObject(object, 0, f_in_ostream);
 2030|  18.6k|        write("\n");
 2031|  18.6k|    }
 2032|       |
 2033|   102k|    if (!cfg.direct_stream_lengths() && object.isStream()) {
  ------------------
  |  Branch (2033:9): [True: 102k, False: 83]
  |  Branch (2033:41): [True: 24.0k, False: 78.0k]
  ------------------
 2034|  24.0k|        if (cfg.qdf()) {
  ------------------
  |  Branch (2034:13): [True: 24.0k, False: 0]
  ------------------
 2035|  24.0k|            if (added_newline) {
  ------------------
  |  Branch (2035:17): [True: 16.7k, False: 7.27k]
  ------------------
 2036|  16.7k|                write("%QDF: ignore_newline\n");
 2037|  16.7k|            }
 2038|  24.0k|        }
 2039|  24.0k|        openObject(new_id + 1);
 2040|  24.0k|        write(cur_stream_length);
 2041|  24.0k|        closeObject(new_id + 1);
 2042|  24.0k|    }
 2043|   102k|}
_ZN4qpdf4impl6Writer14getOriginalID1Ev:
 2047|  8.38k|{
 2048|  8.38k|    if (String id0 = qpdf.getTrailer()["/ID"][0]) {
  ------------------
  |  Branch (2048:16): [True: 657, False: 7.73k]
  ------------------
 2049|    657|        return id0;
 2050|    657|    }
 2051|  7.73k|    return "";
 2052|  8.38k|}
_ZN4qpdf4impl6Writer10generateIDEb:
 2056|  8.38k|{
 2057|       |    // Generate the ID lazily so that we can handle the user's preference to use static or
 2058|       |    // deterministic ID generation.
 2059|       |
 2060|  8.38k|    if (!id2.empty()) {
  ------------------
  |  Branch (2060:9): [True: 0, False: 8.38k]
  ------------------
 2061|      0|        return;
 2062|      0|    }
 2063|       |
 2064|  8.38k|    QPDFObjectHandle trailer = qpdf.getTrailer();
 2065|       |
 2066|  8.38k|    std::string result;
 2067|       |
 2068|  8.38k|    if (cfg.static_id()) {
  ------------------
  |  Branch (2068:9): [True: 0, False: 8.38k]
  ------------------
 2069|       |        // For test suite use only...
 2070|      0|        static unsigned char tmp[] = {
 2071|      0|            0x31,
 2072|      0|            0x41,
 2073|      0|            0x59,
 2074|      0|            0x26,
 2075|      0|            0x53,
 2076|      0|            0x58,
 2077|      0|            0x97,
 2078|      0|            0x93,
 2079|      0|            0x23,
 2080|      0|            0x84,
 2081|      0|            0x62,
 2082|      0|            0x64,
 2083|      0|            0x33,
 2084|      0|            0x83,
 2085|      0|            0x27,
 2086|      0|            0x95,
 2087|      0|            0x00};
 2088|      0|        result = reinterpret_cast<char*>(tmp);
 2089|  8.38k|    } else {
 2090|       |        // The PDF specification has guidelines for creating IDs, but it states clearly that the
 2091|       |        // only thing that's really important is that it is very likely to be unique.  We can't
 2092|       |        // really follow the guidelines in the spec exactly because we haven't written the file yet.
 2093|       |        // This scheme should be fine though.  The deterministic ID case uses a digest of a
 2094|       |        // sufficient portion of the file's contents such no two non-matching files would match in
 2095|       |        // the subsets used for this computation.  Note that we explicitly omit the filename from
 2096|       |        // the digest calculation for deterministic ID so that the same file converted with qpdf, in
 2097|       |        // that case, would have the same ID regardless of the output file's name.
 2098|       |
 2099|  8.38k|        std::string seed;
 2100|  8.38k|        if (cfg.deterministic_id()) {
  ------------------
  |  Branch (2100:13): [True: 8.38k, False: 0]
  ------------------
 2101|  8.38k|            if (encrypted) {
  ------------------
  |  Branch (2101:17): [True: 0, False: 8.38k]
  ------------------
 2102|      0|                throw std::runtime_error(
 2103|      0|                    "QPDFWriter: unable to generated a deterministic ID because the file to be "
 2104|      0|                    "written is encrypted (even though the file may not require a password)");
 2105|      0|            }
 2106|  8.38k|            if (deterministic_id_data.empty()) {
  ------------------
  |  Branch (2106:17): [True: 0, False: 8.38k]
  ------------------
 2107|      0|                throw std::logic_error(
 2108|      0|                    "INTERNAL ERROR: QPDFWriter::generateID has no data for deterministic ID");
 2109|      0|            }
 2110|  8.38k|            seed += deterministic_id_data;
 2111|  8.38k|        } else {
 2112|      0|            seed += std::to_string(QUtil::get_current_time());
 2113|      0|            seed += filename;
 2114|      0|            seed += " ";
 2115|      0|        }
 2116|  8.38k|        seed += " QPDF ";
 2117|  8.38k|        if (trailer.hasKey("/Info")) {
  ------------------
  |  Branch (2117:13): [True: 362, False: 8.02k]
  ------------------
 2118|  12.4k|            for (auto const& item: trailer.getKey("/Info").as_dictionary()) {
  ------------------
  |  Branch (2118:34): [True: 12.4k, False: 362]
  ------------------
 2119|  12.4k|                if (item.second.isString()) {
  ------------------
  |  Branch (2119:21): [True: 3.41k, False: 9.04k]
  ------------------
 2120|  3.41k|                    seed += " ";
 2121|  3.41k|                    seed += item.second.getStringValue();
 2122|  3.41k|                }
 2123|  12.4k|            }
 2124|    362|        }
 2125|       |
 2126|  8.38k|        MD5 md5;
 2127|  8.38k|        md5.encodeString(seed.c_str());
 2128|  8.38k|        MD5::Digest digest;
 2129|  8.38k|        md5.digest(digest);
 2130|  8.38k|        result = std::string(reinterpret_cast<char*>(digest), sizeof(MD5::Digest));
 2131|  8.38k|    }
 2132|       |
 2133|       |    // If /ID already exists, follow the spec: use the original first word and generate a new second
 2134|       |    // word.  Otherwise, we'll use the generated ID for both.
 2135|       |
 2136|  8.38k|    id2 = result;
 2137|       |    // Note: keep /ID from old file even if --static-id was given.
 2138|  8.38k|    id1 = getOriginalID1();
 2139|  8.38k|    if (id1.empty()) {
  ------------------
  |  Branch (2139:9): [True: 7.73k, False: 657]
  ------------------
 2140|  7.73k|        id1 = id2;
 2141|  7.73k|    }
 2142|  8.38k|}
_ZN4qpdf4impl6Writer24initializeSpecialStreamsEv:
 2146|  8.57k|{
 2147|       |    // Mark all page content streams in case we are filtering or normalizing.
 2148|  8.57k|    int num = 0;
 2149|  11.1k|    for (auto& page: pages) {
  ------------------
  |  Branch (2149:20): [True: 11.1k, False: 8.57k]
  ------------------
 2150|  11.1k|        page_object_to_seq[page.getObjGen()] = ++num;
 2151|  11.1k|        QPDFObjectHandle contents = page.getKey("/Contents");
 2152|  11.1k|        std::vector<QPDFObjGen> contents_objects;
 2153|  11.1k|        if (contents.isArray()) {
  ------------------
  |  Branch (2153:13): [True: 744, False: 10.4k]
  ------------------
 2154|    744|            int n = static_cast<int>(contents.size());
 2155|  39.7k|            for (int i = 0; i < n; ++i) {
  ------------------
  |  Branch (2155:29): [True: 38.9k, False: 744]
  ------------------
 2156|  38.9k|                contents_objects.push_back(contents.getArrayItem(i).getObjGen());
 2157|  38.9k|            }
 2158|  10.4k|        } else if (contents.isStream()) {
  ------------------
  |  Branch (2158:20): [True: 1.41k, False: 9.00k]
  ------------------
 2159|  1.41k|            contents_objects.push_back(contents.getObjGen());
 2160|  1.41k|        }
 2161|       |
 2162|  40.3k|        for (auto const& c: contents_objects) {
  ------------------
  |  Branch (2162:27): [True: 40.3k, False: 11.1k]
  ------------------
 2163|  40.3k|            contents_to_page_seq[c] = num;
 2164|  40.3k|            normalized_streams.insert(c);
 2165|  40.3k|        }
 2166|  11.1k|    }
 2167|  8.57k|}
_ZN4qpdf4impl6Writer21preserveObjectStreamsEv:
 2171|  8.57k|{
 2172|  8.57k|    auto const& xref = objects.xref_table();
 2173|       |    // Our object_to_object_stream map has to map ObjGen -> ObjGen since we may be generating object
 2174|       |    // streams out of old objects that have generation numbers greater than zero. However in an
 2175|       |    // existing PDF, all object stream objects and all objects in them must have generation 0
 2176|       |    // because the PDF spec does not provide any way to do otherwise. This code filters out objects
 2177|       |    // that are not allowed to be in object streams. In addition to removing objects that were
 2178|       |    // erroneously included in object streams in the source PDF, it also prevents unreferenced
 2179|       |    // objects from being included.
 2180|  8.57k|    auto end = xref.cend();
 2181|  8.57k|    obj.streams_empty = true;
 2182|  8.57k|    if (cfg.preserve_unreferenced()) {
  ------------------
  |  Branch (2182:9): [True: 0, False: 8.57k]
  ------------------
 2183|      0|        for (auto iter = xref.cbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (2183:41): [True: 0, False: 0]
  ------------------
 2184|      0|            if (iter->second.getType() == 2) {
  ------------------
  |  Branch (2184:17): [True: 0, False: 0]
  ------------------
 2185|       |                // Pdf contains object streams.
 2186|      0|                obj.streams_empty = false;
 2187|      0|                obj[iter->first].object_stream = iter->second.getObjStreamNumber();
 2188|      0|            }
 2189|      0|        }
 2190|  8.57k|    } else {
 2191|       |        // Start by scanning for first compressed object in case we don't have any object streams to
 2192|       |        // process.
 2193|  87.3k|        for (auto iter = xref.cbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (2193:41): [True: 79.7k, False: 7.59k]
  ------------------
 2194|  79.7k|            if (iter->second.getType() == 2) {
  ------------------
  |  Branch (2194:17): [True: 980, False: 78.7k]
  ------------------
 2195|       |                // Pdf contains object streams.
 2196|    980|                obj.streams_empty = false;
 2197|    980|                auto eligible = objects.compressible_set();
 2198|       |                // The object pointed to by iter may be a previous generation, in which case it is
 2199|       |                // removed by compressible_set. We need to restart the loop (while the object
 2200|       |                // table may contain multiple generations of an object).
 2201|   776k|                for (iter = xref.cbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (2201:44): [True: 775k, False: 980]
  ------------------
 2202|   775k|                    if (iter->second.getType() == 2) {
  ------------------
  |  Branch (2202:25): [True: 753k, False: 21.3k]
  ------------------
 2203|   753k|                        auto id = static_cast<size_t>(iter->first.getObj());
 2204|   753k|                        if (id < eligible.size() && eligible[id]) {
  ------------------
  |  Branch (2204:29): [True: 753k, False: 0]
  |  Branch (2204:29): [True: 19.4k, False: 734k]
  |  Branch (2204:53): [True: 19.4k, False: 734k]
  ------------------
 2205|  19.4k|                            obj[iter->first].object_stream = iter->second.getObjStreamNumber();
 2206|   734k|                        } else {
 2207|   734k|                            QTC::TC("qpdf", "QPDFWriter exclude from object stream");
 2208|   734k|                        }
 2209|   753k|                    }
 2210|   775k|                }
 2211|    980|                return;
 2212|    980|            }
 2213|  79.7k|        }
 2214|  8.57k|    }
 2215|  8.57k|}
_ZN4qpdf4impl6Writer15trimmed_trailerEv:
 2258|  16.8k|{
 2259|       |    // Remove keys from the trailer that necessarily have to be replaced when writing the file.
 2260|       |
 2261|  16.8k|    Dictionary trailer = qpdf.getTrailer().unsafeShallowCopy();
 2262|       |
 2263|       |    // Remove encryption keys
 2264|  16.8k|    trailer.erase("/ID");
 2265|  16.8k|    trailer.erase("/Encrypt");
 2266|       |
 2267|       |    // Remove modification information
 2268|  16.8k|    trailer.erase("/Prev");
 2269|       |
 2270|       |    // Remove all trailer keys that potentially come from a cross-reference stream
 2271|  16.8k|    trailer.erase("/Index");
 2272|  16.8k|    trailer.erase("/W");
 2273|  16.8k|    trailer.erase("/Length");
 2274|  16.8k|    trailer.erase("/Filter");
 2275|  16.8k|    trailer.erase("/DecodeParms");
 2276|  16.8k|    trailer.erase("/Type");
 2277|  16.8k|    trailer.erase("/XRefStm");
 2278|       |
 2279|  16.8k|    return trailer;
 2280|  16.8k|}
_ZN4qpdf4impl6Writer19prepareFileForWriteEv:
 2285|  8.54k|{
 2286|  8.54k|    qpdf.fixDanglingReferences();
 2287|  8.54k|    auto root = qpdf.getRoot();
 2288|  8.54k|    auto oh = root.getKey("/Extensions");
 2289|  8.54k|    if (oh.isDictionary()) {
  ------------------
  |  Branch (2289:9): [True: 331, False: 8.21k]
  ------------------
 2290|    331|        const bool extensions_indirect = oh.isIndirect();
 2291|    331|        if (extensions_indirect) {
  ------------------
  |  Branch (2291:13): [True: 91, False: 240]
  ------------------
 2292|     91|            QTC::TC("qpdf", "QPDFWriter make Extensions direct");
 2293|     91|            oh = root.replaceKeyAndGetNew("/Extensions", oh.shallowCopy());
 2294|     91|        }
 2295|    331|        if (oh.hasKey("/ADBE")) {
  ------------------
  |  Branch (2295:13): [True: 230, False: 101]
  ------------------
 2296|    230|            auto adbe = oh.getKey("/ADBE");
 2297|    230|            if (adbe.isIndirect()) {
  ------------------
  |  Branch (2297:17): [True: 193, False: 37]
  ------------------
 2298|    193|                QTC::TC("qpdf", "QPDFWriter make ADBE direct", extensions_indirect ? 0 : 1);
  ------------------
  |  Branch (2298:64): [True: 2, False: 191]
  ------------------
 2299|    193|                adbe.makeDirect();
 2300|    193|                oh.replaceKey("/ADBE", adbe);
 2301|    193|            }
 2302|    230|        }
 2303|    331|    }
 2304|  8.54k|}
_ZN4qpdf4impl6Writer16initializeTablesEm:
 2308|  8.57k|{
 2309|  8.57k|    auto size = objects.table_size() + 100u + extra;
 2310|  8.57k|    obj.resize(size);
 2311|  8.57k|    new_obj.resize(size);
 2312|  8.57k|}
_ZN4qpdf4impl6Writer12doWriteSetupEv:
 2316|  8.57k|{
 2317|  8.57k|    if (did_write_setup) {
  ------------------
  |  Branch (2317:9): [True: 0, False: 8.57k]
  ------------------
 2318|      0|        return;
 2319|      0|    }
 2320|  8.57k|    did_write_setup = true;
 2321|       |
 2322|       |    // Do preliminary setup
 2323|       |
 2324|  8.57k|    if (cfg.linearize()) {
  ------------------
  |  Branch (2324:9): [True: 0, False: 8.57k]
  ------------------
 2325|      0|        cfg.qdf(false);
 2326|      0|    }
 2327|       |
 2328|  8.57k|    if (cfg.pclm()) {
  ------------------
  |  Branch (2328:9): [True: 0, False: 8.57k]
  ------------------
 2329|      0|        encryption = nullptr;
 2330|      0|    }
 2331|       |
 2332|  8.57k|    if (encryption) {
  ------------------
  |  Branch (2332:9): [True: 0, False: 8.57k]
  ------------------
 2333|       |        // Encryption has been explicitly set
 2334|      0|        cfg.preserve_encryption(false);
 2335|  8.57k|    } else if (cfg.normalize_content() || cfg.pclm()) {
  ------------------
  |  Branch (2335:16): [True: 8.57k, False: 0]
  |  Branch (2335:43): [True: 0, False: 0]
  ------------------
 2336|       |        // Encryption makes looking at contents pretty useless.  If the user explicitly encrypted
 2337|       |        // though, we still obey that.
 2338|  8.57k|        cfg.preserve_encryption(false);
 2339|  8.57k|    }
 2340|       |
 2341|  8.57k|    if (cfg.preserve_encryption()) {
  ------------------
  |  Branch (2341:9): [True: 0, False: 8.57k]
  ------------------
 2342|      0|        copyEncryptionParameters(qpdf);
 2343|      0|    }
 2344|       |
 2345|  8.57k|    if (!cfg.forced_pdf_version().empty()) {
  ------------------
  |  Branch (2345:9): [True: 0, False: 8.57k]
  ------------------
 2346|      0|        int major = 0;
 2347|      0|        int minor = 0;
 2348|      0|        parseVersion(cfg.forced_pdf_version(), major, minor);
 2349|      0|        disableIncompatibleEncryption(major, minor, cfg.forced_extension_level());
 2350|      0|        if (compareVersions(major, minor, 1, 5) < 0) {
  ------------------
  |  Branch (2350:13): [True: 0, False: 0]
  ------------------
 2351|      0|            cfg.object_streams(qpdf_o_disable);
 2352|      0|        }
 2353|      0|    }
 2354|       |
 2355|  8.57k|    if (cfg.qdf() || cfg.normalize_content()) {
  ------------------
  |  Branch (2355:9): [True: 8.57k, False: 0]
  |  Branch (2355:22): [True: 0, False: 0]
  ------------------
 2356|  8.57k|        initializeSpecialStreams();
 2357|  8.57k|    }
 2358|       |
 2359|  8.57k|    switch (cfg.object_streams()) {
  ------------------
  |  Branch (2359:13): [True: 8.57k, False: 1]
  ------------------
 2360|      0|    case qpdf_o_disable:
  ------------------
  |  Branch (2360:5): [True: 0, False: 8.57k]
  ------------------
 2361|      0|        initializeTables();
 2362|      0|        obj.streams_empty = true;
 2363|      0|        break;
 2364|       |
 2365|  8.57k|    case qpdf_o_preserve:
  ------------------
  |  Branch (2365:5): [True: 8.57k, False: 1]
  ------------------
 2366|  8.57k|        initializeTables();
 2367|  8.57k|        preserveObjectStreams();
 2368|  8.57k|        break;
 2369|       |
 2370|      0|    case qpdf_o_generate:
  ------------------
  |  Branch (2370:5): [True: 0, False: 8.57k]
  ------------------
 2371|      0|        generateObjectStreams();
 2372|      0|        break;
 2373|  8.57k|    }
 2374|       |
 2375|  8.57k|    if (!obj.streams_empty) {
  ------------------
  |  Branch (2375:9): [True: 980, False: 7.59k]
  ------------------
 2376|    980|        if (cfg.linearize()) {
  ------------------
  |  Branch (2376:13): [True: 0, False: 980]
  ------------------
 2377|       |            // Page dictionaries are not allowed to be compressed objects.
 2378|      0|            for (auto& page: pages) {
  ------------------
  |  Branch (2378:28): [True: 0, False: 0]
  ------------------
 2379|      0|                if (obj[page].object_stream > 0) {
  ------------------
  |  Branch (2379:21): [True: 0, False: 0]
  ------------------
 2380|      0|                    obj[page].object_stream = 0;
 2381|      0|                }
 2382|      0|            }
 2383|      0|        }
 2384|       |
 2385|    980|        if (cfg.linearize() || encryption) {
  ------------------
  |  Branch (2385:13): [True: 0, False: 980]
  |  Branch (2385:32): [True: 0, False: 980]
  ------------------
 2386|       |            // The document catalog is not allowed to be compressed in linearized files either.
 2387|       |            // It also appears that Adobe Reader 8.0.0 has a bug that prevents it from being able to
 2388|       |            // handle encrypted files with compressed document catalogs, so we disable them in that
 2389|       |            // case as well.
 2390|      0|            if (obj[root_og].object_stream > 0) {
  ------------------
  |  Branch (2390:17): [True: 0, False: 0]
  ------------------
 2391|      0|                obj[root_og].object_stream = 0;
 2392|      0|            }
 2393|      0|        }
 2394|       |
 2395|       |        // Generate reverse mapping from object stream to objects
 2396|    980|        obj.forEach([this](auto id, auto const& item) -> void {
 2397|    980|            if (item.object_stream > 0) {
 2398|    980|                auto& vec = object_stream_to_objects[item.object_stream];
 2399|    980|                vec.emplace_back(id, item.gen);
 2400|    980|                if (max_ostream_index < vec.size()) {
 2401|    980|                    ++max_ostream_index;
 2402|    980|                }
 2403|    980|            }
 2404|    980|        });
 2405|    980|        --max_ostream_index;
 2406|       |
 2407|    980|        if (object_stream_to_objects.empty()) {
  ------------------
  |  Branch (2407:13): [True: 459, False: 521]
  ------------------
 2408|    459|            obj.streams_empty = true;
 2409|    521|        } else {
 2410|    521|            setMinimumPDFVersion("1.5");
 2411|    521|        }
 2412|    980|    }
 2413|       |
 2414|  8.57k|    setMinimumPDFVersion(qpdf.getPDFVersion(), qpdf.getExtensionLevel());
 2415|  8.57k|    final_pdf_version = min_pdf_version;
 2416|  8.57k|    final_extension_level = min_extension_level;
 2417|  8.57k|    if (!cfg.forced_pdf_version().empty()) {
  ------------------
  |  Branch (2417:9): [True: 0, False: 8.57k]
  ------------------
 2418|      0|        final_pdf_version = cfg.forced_pdf_version();
 2419|      0|        final_extension_level = cfg.forced_extension_level();
 2420|      0|    }
 2421|  8.57k|}
_ZN10QPDFWriter5writeEv:
 2425|  8.57k|{
 2426|  8.57k|    m->write();
 2427|  8.57k|}
_ZN4qpdf4impl6Writer5writeEv:
 2431|  8.57k|{
 2432|  8.57k|    doWriteSetup();
 2433|       |
 2434|       |    // Set up progress reporting. For linearized files, we write two passes. events_expected is an
 2435|       |    // approximation, but it's good enough for progress reporting, which is mostly a guess anyway.
 2436|       |    // Count only objects that, when written, trigger an indicateProgress increment.
 2437|  8.57k|    size_t in_stream_objs = 0;
 2438|  8.57k|    for (auto const& kv: object_stream_to_objects) {
  ------------------
  |  Branch (2438:24): [True: 3.56k, False: 8.57k]
  ------------------
 2439|  3.56k|        in_stream_objs += kv.second.size();
 2440|  3.56k|    }
 2441|  8.57k|    const size_t expected =
 2442|  8.57k|        (qpdf.getObjectCount() - object_stream_to_objects.size() - in_stream_objs) *
 2443|  8.57k|        (cfg.linearize() ? 2 : 1);
  ------------------
  |  Branch (2443:10): [True: 0, False: 8.57k]
  ------------------
 2444|  8.57k|    events_expected = std::max(
 2445|  8.57k|        1,
 2446|  8.57k|        util::fits<int>(expected) ? static_cast<int>(expected) : std::numeric_limits<int>::max());
  ------------------
  |  Branch (2446:9): [True: 8.54k, False: 32]
  ------------------
 2447|       |
 2448|  8.57k|    prepareFileForWrite();
 2449|       |
 2450|  8.57k|    if (cfg.linearize()) {
  ------------------
  |  Branch (2450:9): [True: 0, False: 8.57k]
  ------------------
 2451|      0|        writeLinearized();
 2452|  8.57k|    } else {
 2453|  8.57k|        writeStandard();
 2454|  8.57k|    }
 2455|       |
 2456|  8.57k|    pipeline->finish();
 2457|  8.57k|    if (close_file) {
  ------------------
  |  Branch (2457:9): [True: 0, False: 8.57k]
  ------------------
 2458|      0|        fclose(file);
 2459|      0|    }
 2460|  8.57k|    file = nullptr;
 2461|  8.57k|    if (buffer_pipeline) {
  ------------------
  |  Branch (2461:9): [True: 0, False: 8.57k]
  ------------------
 2462|      0|        output_buffer = buffer_pipeline->getBuffer();
 2463|      0|        buffer_pipeline = nullptr;
 2464|      0|    }
 2465|  8.57k|    indicateProgress(false, true);
 2466|  8.57k|}
_ZN4qpdf4impl6Writer11writeHeaderEv:
 2551|  8.50k|{
 2552|  8.50k|    write("%PDF-").write(final_pdf_version);
 2553|  8.50k|    if (cfg.pclm()) {
  ------------------
  |  Branch (2553:9): [True: 0, False: 8.50k]
  ------------------
 2554|       |        // PCLm version
 2555|      0|        write("\n%PCLm 1.0\n");
 2556|  8.50k|    } else {
 2557|       |        // This string of binary characters would not be valid UTF-8, so it really should be treated
 2558|       |        // as binary.
 2559|  8.50k|        write("\n%\xbf\xf7\xa2\xfe\n");
 2560|  8.50k|    }
 2561|  8.50k|    write_qdf("%QDF-1.0\n\n");
 2562|       |
 2563|       |    // Note: do not write extra header text here.  Linearized PDFs must include the entire
 2564|       |    // linearization parameter dictionary within the first 1024 characters of the PDF file, so for
 2565|       |    // linearized files, we have to write extra header text after the linearization parameter
 2566|       |    // dictionary.
 2567|  8.50k|}
_ZN4qpdf4impl6Writer14writeXRefTableENS1_9trailer_eEiii:
 2605|  7.91k|{
 2606|       |    // There are too many extra arguments to replace overloaded function with defaults in the header
 2607|       |    // file...too much risk of leaving something off.
 2608|  7.91k|    return writeXRefTable(which, first, last, size, 0, false, 0, 0, 0, 0);
 2609|  7.91k|}
_ZN4qpdf4impl6Writer14writeXRefTableENS1_9trailer_eEiiixbixxi:
 2623|  7.91k|{
 2624|  7.91k|    write("xref\n").write(first).write(" ").write(last - first + 1);
 2625|  7.91k|    qpdf_offset_t space_before_zero = pipeline->getCount();
 2626|  7.91k|    write("\n");
 2627|  7.91k|    if (first == 0) {
  ------------------
  |  Branch (2627:9): [True: 7.91k, False: 0]
  ------------------
 2628|  7.91k|        write("0000000000 65535 f \n");
 2629|  7.91k|        ++first;
 2630|  7.91k|    }
 2631|  93.2k|    for (int i = first; i <= last; ++i) {
  ------------------
  |  Branch (2631:25): [True: 85.3k, False: 7.91k]
  ------------------
 2632|  85.3k|        qpdf_offset_t offset = 0;
 2633|  85.3k|        if (!suppress_offsets) {
  ------------------
  |  Branch (2633:13): [True: 85.3k, False: 0]
  ------------------
 2634|  85.3k|            offset = new_obj[i].xref.getOffset();
 2635|  85.3k|            if ((hint_id != 0) && (i != hint_id) && (offset >= hint_offset)) {
  ------------------
  |  Branch (2635:17): [True: 0, False: 85.3k]
  |  Branch (2635:35): [True: 0, False: 0]
  |  Branch (2635:53): [True: 0, False: 0]
  ------------------
 2636|      0|                offset += hint_length;
 2637|      0|            }
 2638|  85.3k|        }
 2639|  85.3k|        write(QUtil::int_to_string(offset, 10)).write(" 00000 n \n");
 2640|  85.3k|    }
 2641|  7.91k|    writeTrailer(which, size, false, prev, linearization_pass);
 2642|  7.91k|    write("\n");
 2643|  7.91k|    return space_before_zero;
 2644|  7.91k|}
_ZN4qpdf4impl6Writer15writeXRefStreamEiixNS1_9trailer_eEiii:
 2649|    470|{
 2650|       |    // There are too many extra arguments to replace overloaded function with defaults in the header
 2651|       |    // file...too much risk of leaving something off.
 2652|    470|    return writeXRefStream(
 2653|    470|        objid, max_id, max_offset, which, first, last, size, 0, 0, 0, 0, false, 0);
 2654|    470|}
_ZN4qpdf4impl6Writer15writeXRefStreamEiixNS1_9trailer_eEiiixixxbi:
 2671|    470|{
 2672|    470|    qpdf_offset_t xref_offset = pipeline->getCount();
 2673|    470|    qpdf_offset_t space_before_zero = xref_offset - 1;
 2674|       |
 2675|       |    // field 1 contains offsets and object stream identifiers
 2676|    470|    unsigned int f1_size = std::max(bytesNeeded(max_offset + hint_length), bytesNeeded(max_id));
 2677|       |
 2678|       |    // field 2 contains object stream indices
 2679|    470|    unsigned int f2_size = bytesNeeded(QIntC::to_longlong(max_ostream_index));
 2680|       |
 2681|    470|    unsigned int esize = 1 + f1_size + f2_size;
 2682|       |
 2683|       |    // Must store in xref table in advance of writing the actual data rather than waiting for
 2684|       |    // openObject to do it.
 2685|    470|    new_obj[xref_id].xref = QPDFXRefEntry(pipeline->getCount());
 2686|       |
 2687|    470|    std::string xref_data;
 2688|    470|    const bool compressed = cfg.compress_streams() && !cfg.qdf();
  ------------------
  |  Branch (2688:29): [True: 0, False: 470]
  |  Branch (2688:55): [True: 0, False: 0]
  ------------------
 2689|    470|    {
 2690|    470|        auto pp_xref = pipeline_stack.activate(xref_data);
 2691|       |
 2692|  42.8k|        for (int i = first; i <= last; ++i) {
  ------------------
  |  Branch (2692:29): [True: 42.4k, False: 470]
  ------------------
 2693|  42.4k|            QPDFXRefEntry& e = new_obj[i].xref;
 2694|  42.4k|            switch (e.getType()) {
 2695|    470|            case 0:
  ------------------
  |  Branch (2695:13): [True: 470, False: 41.9k]
  ------------------
 2696|    470|                writeBinary(0, 1);
 2697|    470|                writeBinary(0, f1_size);
 2698|    470|                writeBinary(0, f2_size);
 2699|    470|                break;
 2700|       |
 2701|  24.0k|            case 1:
  ------------------
  |  Branch (2701:13): [True: 24.0k, False: 18.3k]
  ------------------
 2702|  24.0k|                {
 2703|  24.0k|                    qpdf_offset_t offset = e.getOffset();
 2704|  24.0k|                    if ((hint_id != 0) && (i != hint_id) && (offset >= hint_offset)) {
  ------------------
  |  Branch (2704:25): [True: 0, False: 24.0k]
  |  Branch (2704:43): [True: 0, False: 0]
  |  Branch (2704:61): [True: 0, False: 0]
  ------------------
 2705|      0|                        offset += hint_length;
 2706|      0|                    }
 2707|  24.0k|                    writeBinary(1, 1);
 2708|  24.0k|                    writeBinary(QIntC::to_ulonglong(offset), f1_size);
 2709|  24.0k|                    writeBinary(0, f2_size);
 2710|  24.0k|                }
 2711|  24.0k|                break;
 2712|       |
 2713|  17.8k|            case 2:
  ------------------
  |  Branch (2713:13): [True: 17.8k, False: 24.5k]
  ------------------
 2714|  17.8k|                writeBinary(2, 1);
 2715|  17.8k|                writeBinary(QIntC::to_ulonglong(e.getObjStreamNumber()), f1_size);
 2716|  17.8k|                writeBinary(QIntC::to_ulonglong(e.getObjStreamIndex()), f2_size);
 2717|  17.8k|                break;
 2718|       |
 2719|      0|            default:
  ------------------
  |  Branch (2719:13): [True: 0, False: 42.4k]
  ------------------
 2720|      0|                throw std::logic_error("invalid type writing xref stream");
 2721|      0|                break;
 2722|  42.4k|            }
 2723|  42.4k|        }
 2724|    470|    }
 2725|       |
 2726|    470|    if (compressed) {
  ------------------
  |  Branch (2726:9): [True: 0, False: 470]
  ------------------
 2727|      0|        xref_data = pl::pipe<Pl_PNGFilter>(xref_data, Pl_PNGFilter::a_encode, esize);
 2728|      0|        if (!skip_compression) {
  ------------------
  |  Branch (2728:13): [True: 0, False: 0]
  ------------------
 2729|       |            // Write the stream dictionary for compression but don't actually compress.  This
 2730|       |            // helps us with computation of padding for pass 1 of linearization.
 2731|      0|            xref_data = pl::pipe<Pl_Flate>(xref_data, Pl_Flate::a_deflate);
 2732|      0|        }
 2733|      0|    }
 2734|       |
 2735|    470|    openObject(xref_id);
 2736|    470|    write("<<").write_qdf("\n ").write(" /Type /XRef").write_qdf("\n ");
 2737|    470|    write(" /Length ").write(xref_data.size());
 2738|    470|    if (compressed) {
  ------------------
  |  Branch (2738:9): [True: 0, False: 470]
  ------------------
 2739|      0|        write_qdf("\n ").write(" /Filter /FlateDecode").write_qdf("\n ");
 2740|      0|        write(" /DecodeParms << /Columns ").write(esize).write(" /Predictor 12 >>");
 2741|      0|    }
 2742|    470|    write_qdf("\n ").write(" /W [ 1 ").write(f1_size).write(" ").write(f2_size).write(" ]");
 2743|    470|    if (!(first == 0 && last == (size - 1))) {
  ------------------
  |  Branch (2743:11): [True: 470, False: 0]
  |  Branch (2743:25): [True: 470, False: 0]
  ------------------
 2744|      0|        write(" /Index [ ").write(first).write(" ").write(last - first + 1).write(" ]");
 2745|      0|    }
 2746|    470|    writeTrailer(which, size, true, prev, linearization_pass);
 2747|    470|    write("\nstream\n").write(xref_data).write("\nendstream");
 2748|    470|    closeObject(xref_id);
 2749|    470|    return space_before_zero;
 2750|    470|}
_ZN4qpdf4impl6Writer22enqueueObjectsStandardEv:
 3112|  8.50k|{
 3113|  8.50k|    if (cfg.preserve_unreferenced()) {
  ------------------
  |  Branch (3113:9): [True: 0, False: 8.50k]
  ------------------
 3114|      0|        for (auto const& oh: qpdf.getAllObjects()) {
  ------------------
  |  Branch (3114:28): [True: 0, False: 0]
  ------------------
 3115|      0|            enqueue(oh);
 3116|      0|        }
 3117|      0|    }
 3118|       |
 3119|       |    // Put root first on queue.
 3120|  8.50k|    auto trailer = trimmed_trailer();
 3121|  8.50k|    enqueue(trailer["/Root"]);
 3122|       |
 3123|       |    // Next place any other objects referenced from the trailer dictionary into the queue, handling
 3124|       |    // direct objects recursively. Root is already there, so enqueuing it a second time is a no-op.
 3125|  17.6k|    for (auto& item: trailer) {
  ------------------
  |  Branch (3125:20): [True: 17.6k, False: 8.50k]
  ------------------
 3126|  17.6k|        if (!item.second.null()) {
  ------------------
  |  Branch (3126:13): [True: 14.2k, False: 3.39k]
  ------------------
 3127|  14.2k|            enqueue(item.second);
 3128|  14.2k|        }
 3129|  17.6k|    }
 3130|  8.50k|}
_ZN4qpdf4impl6Writer16indicateProgressEbb:
 3158|   129k|{
 3159|   129k|    if (decrement) {
  ------------------
  |  Branch (3159:9): [True: 18.6k, False: 110k]
  ------------------
 3160|  18.6k|        --events_seen;
 3161|  18.6k|        return;
 3162|  18.6k|    }
 3163|       |
 3164|   110k|    ++events_seen;
 3165|       |
 3166|   110k|    if (!progress_reporter.get()) {
  ------------------
  |  Branch (3166:9): [True: 110k, False: 0]
  ------------------
 3167|   110k|        return;
 3168|   110k|    }
 3169|       |
 3170|      0|    if (finished || events_seen >= next_progress_report) {
  ------------------
  |  Branch (3170:9): [True: 0, False: 0]
  |  Branch (3170:21): [True: 0, False: 0]
  ------------------
 3171|      0|        int percentage =
 3172|      0|            (finished ? 100
  ------------------
  |  Branch (3172:14): [True: 0, False: 0]
  ------------------
 3173|      0|                 : next_progress_report == 0
  ------------------
  |  Branch (3173:20): [True: 0, False: 0]
  ------------------
 3174|      0|                 ? 0
 3175|      0|                 : std::min(99, 1 + ((100 * events_seen) / events_expected)));
 3176|      0|        if (cfg.linearize()) {
  ------------------
  |  Branch (3176:13): [True: 0, False: 0]
  ------------------
 3177|       |            // When linearizing, we register a separate progress reporter with the linearization
 3178|       |            // engine and scale its progress to the first half of overall progress. This logic moves
 3179|       |            // the writer's internal progress to the second half. The division is not really 50%,
 3180|       |            // but this still results in a meaningful and relatively steady advancement of progress.
 3181|       |            // Otherwise, progress reporting doesn't start until after the linearization
 3182|       |            // computations are done.
 3183|      0|            percentage = 50 + percentage / 2;
 3184|      0|        }
 3185|      0|        progress_reporter->reportProgress(percentage);
 3186|      0|    }
 3187|      0|    int increment = std::max(1, (events_expected / 100));
 3188|      0|    while (events_seen >= next_progress_report) {
  ------------------
  |  Branch (3188:12): [True: 0, False: 0]
  ------------------
 3189|      0|        next_progress_report += increment;
 3190|      0|    }
 3191|      0|}
_ZN4qpdf4impl6Writer13writeStandardEv:
 3212|  8.50k|{
 3213|  8.50k|    auto pp_md5 = pipeline_stack.popper();
 3214|  8.50k|    if (cfg.deterministic_id()) {
  ------------------
  |  Branch (3214:9): [True: 8.50k, False: 0]
  ------------------
 3215|  8.50k|        pipeline_stack.activate_md5(pp_md5);
 3216|  8.50k|    }
 3217|       |
 3218|       |    // Start writing
 3219|       |
 3220|  8.50k|    writeHeader();
 3221|  8.50k|    write(cfg.extra_header_text());
 3222|       |
 3223|  8.50k|    if (cfg.pclm()) {
  ------------------
  |  Branch (3223:9): [True: 0, False: 8.50k]
  ------------------
 3224|      0|        enqueueObjectsPCLm();
 3225|  8.50k|    } else {
 3226|  8.50k|        enqueueObjectsStandard();
 3227|  8.50k|    }
 3228|       |
 3229|       |    // Now start walking queue, outputting each object.
 3230|  95.3k|    while (object_queue_front < object_queue.size()) {
  ------------------
  |  Branch (3230:12): [True: 86.8k, False: 8.50k]
  ------------------
 3231|  86.8k|        QPDFObjectHandle cur_object = object_queue.at(object_queue_front);
 3232|  86.8k|        ++object_queue_front;
 3233|  86.8k|        writeObject(cur_object);
 3234|  86.8k|    }
 3235|       |
 3236|       |    // Write out the encryption dictionary, if any
 3237|  8.50k|    if (encryption) {
  ------------------
  |  Branch (3237:9): [True: 0, False: 8.50k]
  ------------------
 3238|      0|        writeEncryptionDictionary();
 3239|      0|    }
 3240|       |
 3241|       |    // Now write out xref.  next_objid is now the number of objects.
 3242|  8.50k|    qpdf_offset_t xref_offset = pipeline->getCount();
 3243|  8.50k|    if (object_stream_to_objects.empty()) {
  ------------------
  |  Branch (3243:9): [True: 7.91k, False: 591]
  ------------------
 3244|       |        // Write regular cross-reference table
 3245|  7.91k|        writeXRefTable(t_normal, 0, next_objid - 1, next_objid);
 3246|  7.91k|    } else {
 3247|       |        // Write cross-reference stream.
 3248|    591|        int xref_id = next_objid++;
 3249|    591|        writeXRefStream(xref_id, xref_id, xref_offset, t_normal, 0, next_objid - 1, next_objid);
 3250|    591|    }
 3251|  8.50k|    write("startxref\n").write(xref_offset).write("\n%%EOF\n");
 3252|       |
 3253|  8.50k|    if (cfg.deterministic_id()) {
  ------------------
  |  Branch (3253:9): [True: 8.38k, False: 121]
  ------------------
 3254|  8.38k|        QTC::TC(
 3255|  8.38k|            "qpdf",
 3256|  8.38k|            "QPDFWriter standard deterministic ID",
 3257|  8.38k|            object_stream_to_objects.empty() ? 0 : 1);
  ------------------
  |  Branch (3257:13): [True: 7.91k, False: 470]
  ------------------
 3258|  8.38k|    }
 3259|  8.50k|}
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack10initializeEP8Pipeline:
  125|  8.57k|        {
  126|  8.57k|            auto c = std::make_unique<pl::Count>(++last_id, p);
  127|  8.57k|            top = c.get();
  128|  8.57k|            stack.emplace_back(std::move(c));
  129|  8.57k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack10hex_digestEv:
  203|  8.38k|        {
  204|  8.38k|            qpdf_assert_debug(md5_pipeline);
  ------------------
  |  |   11|  8.38k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (204:13): [True: 8.38k, False: 0]
  ------------------
  205|  8.38k|            auto digest = md5_pipeline->getHexDigest();
  206|  8.38k|            md5_pipeline->enable(false);
  207|  8.38k|            return digest;
  208|  8.38k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack8activateERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  133|  44.5k|        {
  134|  44.5k|            Popper pp{*this};
  135|  44.5k|            activate(pp, str);
  136|  44.5k|            return pp;
  137|  44.5k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack6PopperC2ERS0_:
  103|  56.2k|                stack(&stack)
  104|  56.2k|            {
  105|  56.2k|            }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack8activateERNS0_6PopperERNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
  141|  44.5k|        {
  142|  44.5k|            activate(pp, false, &str, nullptr);
  143|  44.5k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack8activateEbPNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS1_10unique_ptrI8PipelineNS1_14default_deleteISA_EEEE:
  157|  3.24k|        {
  158|  3.24k|            Popper pp{*this};
  159|  3.24k|            activate(pp, discard, str, std::move(next));
  160|  3.24k|            return pp;
  161|  3.24k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack6PopperD2Ev:
  249|  56.2k|{
  250|  56.2k|    if (stack) {
  ------------------
  |  Branch (250:9): [True: 56.2k, False: 0]
  ------------------
  251|  56.2k|        stack->pop(stack_id);
  252|  56.2k|    }
  253|  56.2k|}
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack3popEm:
  219|  56.2k|        {
  220|  56.2k|            if (!stack_id) {
  ------------------
  |  Branch (220:17): [True: 0, False: 56.2k]
  ------------------
  221|      0|                return;
  222|      0|            }
  223|  56.2k|            qpdf_assert_debug(stack.size() >= 2);
  ------------------
  |  |   11|  56.2k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (223:13): [True: 56.2k, False: 0]
  ------------------
  224|  56.2k|            top->finish();
  225|  56.2k|            qpdf_assert_debug(stack.back().get() == top);
  ------------------
  |  |   11|  56.2k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (225:13): [True: 56.2k, False: 0]
  ------------------
  226|       |            // It used to be possible for this assertion to fail if writeLinearized exits by
  227|       |            // exception when deterministic ID. There are no longer any cases in which two
  228|       |            // dynamically allocated pipeline Popper objects ever exist at the same time, so the
  229|       |            // assertion will fail if they get popped out of order from automatic destruction.
  230|  56.2k|            qpdf_assert_debug(top->id() == stack_id);
  ------------------
  |  |   11|  56.2k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (230:13): [True: 56.2k, False: 0]
  ------------------
  231|  56.2k|            if (stack_id == md5_id) {
  ------------------
  |  Branch (231:17): [True: 8.50k, False: 47.7k]
  ------------------
  232|  8.50k|                md5_pipeline = nullptr;
  233|  8.50k|                md5_id = 0;
  234|  8.50k|            }
  235|  56.2k|            stack.pop_back();
  236|  56.2k|            top = stack.back().get();
  237|  56.2k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack6popperEv:
  119|  8.50k|        {
  120|  8.50k|            return {*this};
  121|  8.50k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack8activateERNS0_6PopperEbPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_10unique_ptrI8PipelineNS3_14default_deleteISC_EEEE:
  169|  47.7k|        {
  170|  47.7k|            std::unique_ptr<pl::Count> c;
  171|  47.7k|            if (next) {
  ------------------
  |  Branch (171:17): [True: 0, False: 47.7k]
  ------------------
  172|      0|                c = std::make_unique<pl::Count>(++last_id, count_buffer, std::move(next));
  173|  47.7k|            } else if (discard) {
  ------------------
  |  Branch (173:24): [True: 3.24k, False: 44.5k]
  ------------------
  174|  3.24k|                c = std::make_unique<pl::Count>(++last_id, nullptr);
  175|  44.5k|            } else if (!str) {
  ------------------
  |  Branch (175:24): [True: 0, False: 44.5k]
  ------------------
  176|      0|                c = std::make_unique<pl::Count>(++last_id, top);
  177|  44.5k|            } else {
  178|  44.5k|                c = std::make_unique<pl::Count>(++last_id, *str);
  179|  44.5k|            }
  180|  47.7k|            pp.stack_id = last_id;
  181|  47.7k|            top = c.get();
  182|  47.7k|            stack.emplace_back(std::move(c));
  183|  47.7k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stack12activate_md5ERNS0_6PopperE:
  186|  8.50k|        {
  187|  8.50k|            qpdf_assert_debug(!md5_pipeline);
  ------------------
  |  |   11|  8.50k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (187:13): [True: 8.50k, False: 0]
  ------------------
  188|  8.50k|            qpdf_assert_debug(md5_id == 0);
  ------------------
  |  |   11|  8.50k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (188:13): [True: 8.50k, False: 0]
  ------------------
  189|  8.50k|            qpdf_assert_debug(top->getCount() == 0);
  ------------------
  |  |   11|  8.50k|#define qpdf_assert_debug assert
  ------------------
  |  Branch (189:13): [True: 8.50k, False: 0]
  ------------------
  190|  8.50k|            md5_pipeline = std::make_unique<Pl_MD5>("qpdf md5", top);
  191|  8.50k|            md5_pipeline->persistAcrossFinish(true);
  192|       |            // Special case code in pop clears m->md5_pipeline upon deletion.
  193|  8.50k|            auto c = std::make_unique<pl::Count>(++last_id, md5_pipeline.get());
  194|  8.50k|            pp.stack_id = last_id;
  195|  8.50k|            md5_id = last_id;
  196|  8.50k|            top = c.get();
  197|  8.50k|            stack.emplace_back(std::move(c));
  198|  8.50k|        }
_ZN10QPDFWriter7MembersC2ERS_R4QPDF:
  480|  8.57k|        impl::Writer(qpdf, w)
  481|  8.57k|    {
  482|  8.57k|    }
_ZN4qpdf4impl6WriterC2ER4QPDFR10QPDFWriter:
  293|  8.57k|            Common(qpdf.doc()),
  294|  8.57k|            lin(qpdf.doc().linearization()),
  295|  8.57k|            cfg(true),
  296|  8.57k|            root_og(qpdf.getRoot().indirect() ? qpdf.getRoot().id_gen() : QPDFObjGen(-1, 0)),
  ------------------
  |  Branch (296:21): [True: 8.07k, False: 503]
  ------------------
  297|  8.57k|            pipeline_stack(pipeline)
  298|  8.57k|        {
  299|  8.57k|        }
QPDFWriter.cc:_ZN12_GLOBAL__N_18Pl_stackC2ERPN4qpdf2pl5CountE:
  113|  8.57k|            top(top)
  114|  8.57k|        {
  115|  8.57k|        }
_ZN4qpdf4impl6WriterD2Ev:
  286|  8.57k|        {
  287|  8.57k|            if (file && close_file) {
  ------------------
  |  Branch (287:17): [True: 0, False: 8.57k]
  |  Branch (287:25): [True: 0, False: 0]
  ------------------
  288|      0|                fclose(file);
  289|      0|            }
  290|  8.57k|            delete output_buffer;
  291|  8.57k|        }
_ZN4qpdf4impl6Writer5writeITkNSt3__18integralEiEERS1_T_:
 1271|   373k|{
 1272|   373k|    pipeline->write(std::to_string(val));
 1273|   373k|    return *this;
 1274|   373k|}
_ZN4qpdf4impl6Writer9write_qdfIJRA2_KcEEERS1_DpOT_:
 1300|   176k|{
 1301|   176k|    if (cfg.qdf()) {
  ------------------
  |  Branch (1301:9): [True: 176k, False: 0]
  ------------------
 1302|   176k|        pipeline->write(std::forward<Args>(args)...);
 1303|   176k|    }
 1304|   176k|    return *this;
 1305|   176k|}
_ZN4qpdf4impl6Writer9write_qdfIJRA3_KcEEERS1_DpOT_:
 1300|  28.5k|{
 1301|  28.5k|    if (cfg.qdf()) {
  ------------------
  |  Branch (1301:9): [True: 28.5k, False: 0]
  ------------------
 1302|  28.5k|        pipeline->write(std::forward<Args>(args)...);
 1303|  28.5k|    }
 1304|  28.5k|    return *this;
 1305|  28.5k|}
_ZN4qpdf4impl6Writer12write_no_qdfIJRA2_KcEEERS1_DpOT_:
 1310|  48.0k|{
 1311|  48.0k|    if (!cfg.qdf()) {
  ------------------
  |  Branch (1311:9): [True: 0, False: 48.0k]
  ------------------
 1312|      0|        pipeline->write(std::forward<Args>(args)...);
 1313|      0|    }
 1314|  48.0k|    return *this;
 1315|  48.0k|}
_ZN4qpdf4impl6Writer5writeITkNSt3__18integralExEERS1_T_:
 1271|  48.8k|{
 1272|  48.8k|    pipeline->write(std::to_string(val));
 1273|  48.8k|    return *this;
 1274|  48.8k|}
_ZN4qpdf4impl6Writer9write_qdfIJRA4_KcEEERS1_DpOT_:
 1300|  8.38k|{
 1301|  8.38k|    if (cfg.qdf()) {
  ------------------
  |  Branch (1301:9): [True: 8.38k, False: 0]
  ------------------
 1302|  8.38k|        pipeline->write(std::forward<Args>(args)...);
 1303|  8.38k|    }
 1304|  8.38k|    return *this;
 1305|  8.38k|}
_ZN4qpdf4impl6Writer12write_no_qdfIJRA4_KcEEERS1_DpOT_:
 1310|  8.38k|{
 1311|  8.38k|    if (!cfg.qdf()) {
  ------------------
  |  Branch (1311:9): [True: 0, False: 8.38k]
  ------------------
 1312|      0|        pipeline->write(std::forward<Args>(args)...);
 1313|      0|    }
 1314|  8.38k|    return *this;
 1315|  8.38k|}
_ZN4qpdf4impl6Writer5writeITkNSt3__18integralEmEERS1_T_:
 1271|  31.0k|{
 1272|  31.0k|    pipeline->write(std::to_string(val));
 1273|  31.0k|    return *this;
 1274|  31.0k|}
QPDFWriter.cc:_ZZN4qpdf4impl6Writer12doWriteSetupEvENK3$_0clIiN10QPDFWriter6ObjectEEEvT_RKT0_:
 2396|  3.17M|        obj.forEach([this](auto id, auto const& item) -> void {
 2397|  3.17M|            if (item.object_stream > 0) {
  ------------------
  |  Branch (2397:17): [True: 19.3k, False: 3.15M]
  ------------------
 2398|  19.3k|                auto& vec = object_stream_to_objects[item.object_stream];
 2399|  19.3k|                vec.emplace_back(id, item.gen);
 2400|  19.3k|                if (max_ostream_index < vec.size()) {
  ------------------
  |  Branch (2400:21): [True: 9.44k, False: 9.89k]
  ------------------
 2401|  9.44k|                    ++max_ostream_index;
 2402|  9.44k|                }
 2403|  19.3k|            }
 2404|  3.17M|        });
_ZN4qpdf4impl6Writer9write_qdfIJRA11_KcEEERS1_DpOT_:
 1300|  8.50k|{
 1301|  8.50k|    if (cfg.qdf()) {
  ------------------
  |  Branch (1301:9): [True: 8.50k, False: 0]
  ------------------
 1302|  8.50k|        pipeline->write(std::forward<Args>(args)...);
 1303|  8.50k|    }
 1304|  8.50k|    return *this;
 1305|  8.50k|}
_ZN4qpdf4impl6Writer5writeITkNSt3__18integralEjEERS1_T_:
 1271|    940|{
 1272|    940|    pipeline->write(std::to_string(val));
 1273|    940|    return *this;
 1274|    940|}

_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEEb:
   39|  1.67k|{
   40|  1.67k|    if (sparse) {
  ------------------
  |  Branch (40:9): [True: 915, False: 757]
  ------------------
   41|    915|        sp = std::make_unique<Sparse>();
   42|  15.7M|        for (auto& item: v) {
  ------------------
  |  Branch (42:24): [True: 15.7M, False: 915]
  ------------------
   43|  15.7M|            if (item.raw_type_code() != ::ot_null || item.indirect()) {
  ------------------
  |  Branch (43:17): [True: 15.5M, False: 222k]
  |  Branch (43:54): [True: 68, False: 222k]
  ------------------
   44|  15.5M|                sp->elements[sp->size] = std::move(item);
   45|  15.5M|            }
   46|  15.7M|            ++sp->size;
   47|  15.7M|        }
   48|    915|    } else {
   49|    757|        elements = std::move(v);
   50|    757|    }
   51|  1.67k|}
_ZNK4qpdf5Array5arrayEv:
   55|  21.2k|{
   56|  21.2k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (56:14): [True: 21.2k, False: 0]
  ------------------
   57|  21.2k|        return a;
   58|  21.2k|    }
   59|       |
   60|      0|    throw std::runtime_error("Expected an array but found a non-array object");
   61|      0|    return nullptr; // unreachable
   62|  21.2k|}
_ZN4qpdf5ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS1_9allocatorIS3_EEEE:
   65|  2.02k|    BaseHandle(QPDFObject::create<QPDF_Array>(items))
   66|  2.02k|{
   67|  2.02k|}
_ZN4qpdf5Array5beginEv:
   82|   561k|{
   83|   561k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (83:14): [True: 544k, False: 17.2k]
  ------------------
   84|   544k|        if (!a->sp) {
  ------------------
  |  Branch (84:13): [True: 537k, False: 6.53k]
  ------------------
   85|   537k|            return a->elements.begin();
   86|   537k|        }
   87|  6.53k|        if (!sp_elements) {
  ------------------
  |  Branch (87:13): [True: 6.53k, False: 0]
  ------------------
   88|  6.53k|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
   89|  6.53k|        }
   90|  6.53k|        return sp_elements->begin();
   91|   544k|    }
   92|  17.2k|    return {};
   93|   561k|}
_ZN4qpdf5Array3endEv:
   97|   561k|{
   98|   561k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (98:14): [True: 544k, False: 17.2k]
  ------------------
   99|   544k|        if (!a->sp) {
  ------------------
  |  Branch (99:13): [True: 537k, False: 6.53k]
  ------------------
  100|   537k|            return a->elements.end();
  101|   537k|        }
  102|  6.53k|        if (!sp_elements) {
  ------------------
  |  Branch (102:13): [True: 0, False: 6.53k]
  ------------------
  103|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  104|      0|        }
  105|  6.53k|        return sp_elements->end();
  106|   544k|    }
  107|  17.2k|    return {};
  108|   561k|}
_ZN4qpdf5Array7crbeginEv:
  142|  18.8M|{
  143|  18.8M|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (143:14): [True: 19.1k, False: 18.8M]
  ------------------
  144|  19.1k|        if (!a->sp) {
  ------------------
  |  Branch (144:13): [True: 18.7k, False: 445]
  ------------------
  145|  18.7k|            return a->elements.crbegin();
  146|  18.7k|        }
  147|    445|        if (!sp_elements) {
  ------------------
  |  Branch (147:13): [True: 445, False: 0]
  ------------------
  148|    445|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  149|    445|        }
  150|    445|        return sp_elements->crbegin();
  151|  19.1k|    }
  152|  18.8M|    return {};
  153|  18.8M|}
_ZN4qpdf5Array5crendEv:
  157|  18.8M|{
  158|  18.8M|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (158:14): [True: 19.1k, False: 18.8M]
  ------------------
  159|  19.1k|        if (!a->sp) {
  ------------------
  |  Branch (159:13): [True: 18.7k, False: 445]
  ------------------
  160|  18.7k|            return a->elements.crend();
  161|  18.7k|        }
  162|    445|        if (!sp_elements) {
  ------------------
  |  Branch (162:13): [True: 0, False: 445]
  ------------------
  163|      0|            sp_elements = std::make_unique<std::vector<QPDFObjectHandle>>(getAsVector());
  164|      0|        }
  165|    445|        return sp_elements->crend();
  166|  19.1k|    }
  167|  18.8M|    return {};
  168|  18.8M|}
_ZNK4qpdf5Array4sizeEv:
  178|  43.8k|{
  179|  43.8k|    if (auto a = as<QPDF_Array>()) {
  ------------------
  |  Branch (179:14): [True: 26.9k, False: 16.8k]
  ------------------
  180|  26.9k|        return a->sp ? a->sp->size : a->elements.size();
  ------------------
  |  Branch (180:16): [True: 20.0k, False: 6.93k]
  ------------------
  181|  26.9k|    }
  182|  16.8k|    return 0;
  183|  43.8k|}
_ZNK4qpdf5ArrayixEm:
  187|  61.1k|{
  188|  61.1k|    static const QPDFObjectHandle null_obj;
  189|  61.1k|    auto a = as<QPDF_Array>();
  190|  61.1k|    if (!a) {
  ------------------
  |  Branch (190:9): [True: 0, False: 61.1k]
  ------------------
  191|      0|        return null_obj;
  192|      0|    }
  193|  61.1k|    if (a->sp) {
  ------------------
  |  Branch (193:9): [True: 27.4k, False: 33.7k]
  ------------------
  194|  27.4k|        auto const& iter = a->sp->elements.find(n);
  195|  27.4k|        return iter == a->sp->elements.end() ? null_obj : iter->second;
  ------------------
  |  Branch (195:16): [True: 5.76k, False: 21.6k]
  ------------------
  196|  27.4k|    }
  197|  33.7k|    return n >= a->elements.size() ? null_obj : a->elements[n];
  ------------------
  |  Branch (197:12): [True: 2, False: 33.7k]
  ------------------
  198|  61.1k|}
_ZNK4qpdf5ArrayixEi:
  202|  60.3k|{
  203|  60.3k|    static const QPDFObjectHandle null_obj;
  204|  60.3k|    if (n < 0) {
  ------------------
  |  Branch (204:9): [True: 0, False: 60.3k]
  ------------------
  205|      0|        return null_obj;
  206|      0|    }
  207|  60.3k|    return (*this)[static_cast<size_t>(n)];
  208|  60.3k|}
_ZNK4qpdf5Array3getEm:
  212|    120|{
  213|    120|    if (n >= size()) {
  ------------------
  |  Branch (213:9): [True: 0, False: 120]
  ------------------
  214|      0|        return {};
  215|      0|    }
  216|    120|    auto a = array();
  217|    120|    if (!a->sp) {
  ------------------
  |  Branch (217:9): [True: 120, False: 0]
  ------------------
  218|    120|        return a->elements[n];
  219|    120|    }
  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|    120|}
_ZNK4qpdf5Array3getEi:
  226|    120|{
  227|    120|    if (n < 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 120]
  ------------------
  228|      0|        return {};
  229|      0|    }
  230|    120|    return get(to_s(n));
  231|    120|}
_ZNK4qpdf5Array11getAsVectorEv:
  235|  20.7k|{
  236|  20.7k|    auto a = array();
  237|  20.7k|    if (a->sp) {
  ------------------
  |  Branch (237:9): [True: 7.07k, False: 13.7k]
  ------------------
  238|  7.07k|        std::vector<QPDFObjectHandle> v;
  239|  7.07k|        v.reserve(size());
  240|   147M|        for (auto const& item: a->sp->elements) {
  ------------------
  |  Branch (240:30): [True: 147M, False: 7.07k]
  ------------------
  241|   147M|            v.resize(item.first, null_oh);
  242|   147M|            v.emplace_back(item.second);
  243|   147M|        }
  244|  7.07k|        v.resize(size(), null_oh);
  245|  7.07k|        return v;
  246|  13.7k|    } else {
  247|  13.7k|        return a->elements;
  248|  13.7k|    }
  249|  20.7k|}
_ZN4qpdf5Array5eraseEm:
  345|    335|{
  346|    335|    auto a = array();
  347|    335|    if (at >= size()) {
  ------------------
  |  Branch (347:9): [True: 34, False: 301]
  ------------------
  348|     34|        return false;
  349|     34|    }
  350|    301|    if (!a->sp) {
  ------------------
  |  Branch (350:9): [True: 183, False: 118]
  ------------------
  351|    183|        a->elements.erase(a->elements.cbegin() + to_i(at));
  352|    183|        return true;
  353|    183|    }
  354|    118|    auto end = a->sp->elements.end();
  355|    118|    if (auto iter = a->sp->elements.lower_bound(at); iter != end) {
  ------------------
  |  Branch (355:54): [True: 115, False: 3]
  ------------------
  356|    115|        if (iter->first == at) {
  ------------------
  |  Branch (356:13): [True: 109, False: 6]
  ------------------
  357|    109|            iter++;
  358|    109|            a->sp->elements.erase(at);
  359|    109|        }
  360|       |
  361|  34.2k|        while (iter != end) {
  ------------------
  |  Branch (361:16): [True: 34.1k, False: 115]
  ------------------
  362|  34.1k|            auto nh = a->sp->elements.extract(iter++);
  363|  34.1k|            --nh.key();
  364|  34.1k|            a->sp->elements.insert(std::move(nh));
  365|  34.1k|        }
  366|    115|    }
  367|    118|    --(a->sp->size);
  368|    118|    return true;
  369|    301|}
_ZN4qpdf5Array5eraseEi:
  373|    335|{
  374|    335|    if (at_i < 0) {
  ------------------
  |  Branch (374:9): [True: 0, False: 335]
  ------------------
  375|      0|        return false;
  376|      0|    }
  377|    335|    return erase(to_s(at_i));
  378|    335|}
_ZNK16QPDFObjectHandle12getArrayItemEi:
  393|  60.3k|{
  394|  60.3k|    if (auto array = Array(*this)) {
  ------------------
  |  Branch (394:14): [True: 60.3k, False: 0]
  ------------------
  395|  60.3k|        if (auto result = array[n]) {
  ------------------
  |  Branch (395:18): [True: 54.5k, False: 5.76k]
  ------------------
  396|  54.5k|            return result;
  397|  54.5k|        }
  398|  5.76k|        if (n >= 0 && std::cmp_less(n, array.size())) {
  ------------------
  |  Branch (398:13): [True: 5.76k, False: 0]
  |  Branch (398:23): [True: 5.76k, False: 0]
  ------------------
  399|       |            // sparse array null
  400|  5.76k|            return newNull();
  401|  5.76k|        }
  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|  60.3k|}
_ZNK16QPDFObjectHandle11isRectangleEv:
  412|  23.3k|{
  413|  23.3k|    Array array(*this);
  414|  25.5k|    for (auto const& oh: array) {
  ------------------
  |  Branch (414:24): [True: 25.5k, False: 23.0k]
  ------------------
  415|  25.5k|        if (!oh.isNumber()) {
  ------------------
  |  Branch (415:13): [True: 253, False: 25.2k]
  ------------------
  416|    253|            return false;
  417|    253|        }
  418|  25.5k|    }
  419|  23.0k|    return array.size() == 4;
  420|  23.3k|}
_ZNK16QPDFObjectHandle16getArrayAsVectorEv:
  472|  13.8k|{
  473|  13.8k|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (473:14): [True: 13.8k, False: 0]
  ------------------
  474|  13.8k|        return array.getAsVector();
  475|  13.8k|    }
  476|      0|    typeWarning("array", "treating as empty");
  477|      0|    QTC::TC("qpdf", "QPDFObjectHandle array treating as empty vector");
  478|      0|    return {};
  479|  13.8k|}
_ZN16QPDFObjectHandle9eraseItemEi:
  544|    414|{
  545|    414|    if (auto array = as_array(strict)) {
  ------------------
  |  Branch (545:14): [True: 335, False: 79]
  ------------------
  546|    335|        if (!array.erase(at)) {
  ------------------
  |  Branch (546:13): [True: 34, False: 301]
  ------------------
  547|     34|            objectWarning("ignoring attempt to erase out of bounds array item");
  548|     34|            QTC::TC("qpdf", "QPDFObjectHandle erase array bounds");
  549|     34|        }
  550|    335|    } else {
  551|     79|        typeWarning("array", "ignoring attempt to erase item");
  552|     79|        QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item");
  553|     79|    }
  554|    414|}
_ZNK4qpdf10BaseHandle4sizeEv:
  566|  68.6k|{
  567|  68.6k|    switch (resolved_type_code()) {
  568|  16.0k|    case ::ot_array:
  ------------------
  |  Branch (568:5): [True: 16.0k, False: 52.5k]
  ------------------
  569|  16.0k|        return as<QPDF_Array>()->size();
  570|  7.59k|    case ::ot_uninitialized:
  ------------------
  |  Branch (570:5): [True: 7.59k, False: 61.0k]
  ------------------
  571|  7.59k|    case ::ot_reserved:
  ------------------
  |  Branch (571:5): [True: 0, False: 68.6k]
  ------------------
  572|  31.9k|    case ::ot_null:
  ------------------
  |  Branch (572:5): [True: 24.3k, False: 44.2k]
  ------------------
  573|  31.9k|    case ::ot_destroyed:
  ------------------
  |  Branch (573:5): [True: 0, False: 68.6k]
  ------------------
  574|  31.9k|    case ::ot_unresolved:
  ------------------
  |  Branch (574:5): [True: 0, False: 68.6k]
  ------------------
  575|  31.9k|    case ::ot_reference:
  ------------------
  |  Branch (575:5): [True: 0, False: 68.6k]
  ------------------
  576|  31.9k|        return 0;
  577|     12|    case ::ot_boolean:
  ------------------
  |  Branch (577:5): [True: 12, False: 68.6k]
  ------------------
  578|     28|    case ::ot_integer:
  ------------------
  |  Branch (578:5): [True: 16, False: 68.6k]
  ------------------
  579|     38|    case ::ot_real:
  ------------------
  |  Branch (579:5): [True: 10, False: 68.6k]
  ------------------
  580|     84|    case ::ot_string:
  ------------------
  |  Branch (580:5): [True: 46, False: 68.6k]
  ------------------
  581|  20.2k|    case ::ot_name:
  ------------------
  |  Branch (581:5): [True: 20.1k, False: 48.5k]
  ------------------
  582|  20.5k|    case ::ot_dictionary:
  ------------------
  |  Branch (582:5): [True: 335, False: 68.3k]
  ------------------
  583|  20.5k|    case ::ot_stream:
  ------------------
  |  Branch (583:5): [True: 10, False: 68.6k]
  ------------------
  584|  20.5k|    case ::ot_inlineimage:
  ------------------
  |  Branch (584:5): [True: 0, False: 68.6k]
  ------------------
  585|  20.5k|    case ::ot_operator:
  ------------------
  |  Branch (585:5): [True: 0, False: 68.6k]
  ------------------
  586|  20.5k|        return 1;
  587|      0|    default:
  ------------------
  |  Branch (587:5): [True: 0, False: 68.6k]
  ------------------
  588|      0|        throw std::logic_error("Unexpected type code in size"); // unreachable
  589|      0|        return 0;                                               // unreachable
  590|  68.6k|    }
  591|  68.6k|}
_ZNK4qpdf10BaseHandleixEm:
  595|  8.38k|{
  596|  8.38k|    if (resolved_type_code() == ::ot_array) {
  ------------------
  |  Branch (596:9): [True: 765, False: 7.62k]
  ------------------
  597|    765|        return Array(obj)[n];
  598|    765|    }
  599|  7.62k|    if (n < size()) {
  ------------------
  |  Branch (599:9): [True: 15, False: 7.60k]
  ------------------
  600|     15|        return *this;
  601|     15|    }
  602|  7.60k|    return {};
  603|  7.62k|}
_ZNK4qpdf10BaseHandleixEi:
  607|  8.38k|{
  608|  8.38k|    if (n < 0) {
  ------------------
  |  Branch (608:9): [True: 0, False: 8.38k]
  ------------------
  609|      0|        return {};
  610|      0|    }
  611|  8.38k|    return (*this)[static_cast<size_t>(n)];
  612|  8.38k|}
QPDF_Array.cc:_ZL4to_si:
   15|    455|{
   16|    455|    return static_cast<size_t>(n);
   17|    455|}
QPDF_Array.cc:_ZL4to_im:
   21|    183|{
   22|    183|    return static_cast<int>(n);
   23|    183|}

_ZNK4qpdf14BaseDictionary4dictEv:
   12|  6.92k|{
   13|  6.92k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (13:14): [True: 6.92k, False: 0]
  ------------------
   14|  6.92k|        return d;
   15|  6.92k|    }
   16|      0|    throw std::runtime_error("Expected a dictionary but found a non-dictionary object");
   17|      0|    return nullptr; // unreachable
   18|  6.92k|}
_ZNK4qpdf10BaseHandleixERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   22|   859k|{
   23|   859k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (23:14): [True: 839k, False: 20.4k]
  ------------------
   24|   839k|        auto it = d->items.find(key);
   25|   839k|        if (it != d->items.end()) {
  ------------------
  |  Branch (25:13): [True: 444k, False: 394k]
  ------------------
   26|   444k|            return it->second;
   27|   444k|        }
   28|   839k|    }
   29|   415k|    static const QPDFObjectHandle null_obj;
   30|   415k|    return null_obj;
   31|   859k|}
_ZNK4qpdf10BaseHandle8containsERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   63|  76.9k|{
   64|  76.9k|    return !(*this)[key].null();
   65|  76.9k|}
_ZN4qpdf14BaseDictionary7getKeysEv:
   99|  6.92k|{
  100|  6.92k|    std::set<std::string> result;
  101|  28.0k|    for (auto& iter: dict()->items) {
  ------------------
  |  Branch (101:20): [True: 28.0k, False: 6.92k]
  ------------------
  102|  28.0k|        if (!iter.second.null()) {
  ------------------
  |  Branch (102:13): [True: 25.0k, False: 3.03k]
  ------------------
  103|  25.0k|            result.insert(iter.first);
  104|  25.0k|        }
  105|  28.0k|    }
  106|  6.92k|    return result;
  107|  6.92k|}
_ZN4qpdf10BaseHandle5eraseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  117|   239k|{
  118|       |    // no-op if key does not exist
  119|   239k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (119:14): [True: 239k, False: 0]
  ------------------
  120|   239k|        return d->items.erase(key);
  121|   239k|    }
  122|      0|    return 0;
  123|   239k|}
_ZN4qpdf10BaseHandle7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  140|  52.2k|{
  141|  52.2k|    if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (141:14): [True: 52.2k, False: 0]
  ------------------
  142|  52.2k|        if (value.null() && !value.indirect()) {
  ------------------
  |  Branch (142:13): [True: 0, False: 52.2k]
  |  Branch (142:29): [True: 0, False: 0]
  ------------------
  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|      0|            d->items.erase(key);
  147|  52.2k|        } else {
  148|       |            // add or replace value
  149|  52.2k|            d->items[key] = value;
  150|  52.2k|        }
  151|  52.2k|        return true;
  152|  52.2k|    }
  153|      0|    return false;
  154|  52.2k|}
_ZN4qpdf14BaseDictionary7replaceERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE16QPDFObjectHandle:
  172|  52.2k|{
  173|  52.2k|    if (!BaseHandle::replace(key, value)) {
  ------------------
  |  Branch (173:9): [True: 0, False: 52.2k]
  ------------------
  174|      0|        (void)dict();
  175|      0|    }
  176|  52.2k|}
_ZN4qpdf10DictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  184|   199k|    BaseDictionary(obj)
  185|   199k|{
  186|   199k|}
_ZNK16QPDFObjectHandle14checkOwnershipERKS_:
  196|  49.4k|{
  197|  49.4k|    auto qpdf = getOwningQPDF();
  198|  49.4k|    auto item_qpdf = item.getOwningQPDF();
  199|  49.4k|    if (qpdf && item_qpdf && qpdf != item_qpdf) {
  ------------------
  |  Branch (199:9): [True: 43.7k, False: 5.77k]
  |  Branch (199:17): [True: 6.31k, False: 37.4k]
  |  Branch (199:30): [True: 0, False: 6.31k]
  ------------------
  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|  49.4k|}
_ZNK16QPDFObjectHandle6hasKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  208|  56.1k|{
  209|  56.1k|    if (Dictionary dict = *this) {
  ------------------
  |  Branch (209:20): [True: 55.9k, False: 150]
  ------------------
  210|  55.9k|        return dict.contains(key);
  211|  55.9k|    } else {
  212|    150|        typeWarning("dictionary", "returning false for a key containment request");
  213|    150|        QTC::TC("qpdf", "QPDFObjectHandle dictionary false for hasKey");
  214|    150|        return false;
  215|    150|    }
  216|  56.1k|}
_ZNK16QPDFObjectHandle6getKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  220|   358k|{
  221|   358k|    if (auto result = get(key)) {
  ------------------
  |  Branch (221:14): [True: 187k, False: 170k]
  ------------------
  222|   187k|        return result;
  223|   187k|    }
  224|   170k|    if (isDictionary()) {
  ------------------
  |  Branch (224:9): [True: 170k, False: 1]
  ------------------
  225|   170k|        static auto constexpr msg = " -> dictionary key $VD"sv;
  226|   170k|        return QPDF_Null::create(obj, msg, key);
  227|   170k|    }
  228|      1|    typeWarning("dictionary", "returning null for attempted key retrieval");
  229|      1|    static auto constexpr msg = " -> null returned from getting key $VD from non-Dictionary"sv;
  230|      1|    return QPDF_Null::create(obj, msg, "");
  231|   170k|}
_ZNK16QPDFObjectHandle7getKeysEv:
  241|  7.02k|{
  242|  7.02k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (242:14): [True: 6.92k, False: 101]
  ------------------
  243|  6.92k|        return dict.getKeys();
  244|  6.92k|    }
  245|    101|    typeWarning("dictionary", "treating as empty");
  246|    101|    QTC::TC("qpdf", "QPDFObjectHandle dictionary empty set for getKeys");
  247|    101|    return {};
  248|  7.02k|}
_ZN16QPDFObjectHandle10replaceKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  263|  53.3k|{
  264|  53.3k|    if (auto dict = as_dictionary(strict)) {
  ------------------
  |  Branch (264:14): [True: 49.4k, False: 3.84k]
  ------------------
  265|  49.4k|        checkOwnership(value);
  266|  49.4k|        dict.replace(key, value);
  267|  49.4k|        return;
  268|  49.4k|    }
  269|  3.84k|    typeWarning("dictionary", "ignoring key replacement request");
  270|  3.84k|}
_ZN16QPDFObjectHandle19replaceKeyAndGetNewERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKS_:
  274|     91|{
  275|     91|    replaceKey(key, value);
  276|     91|    return value;
  277|     91|}
_ZN16QPDFObjectHandle9removeKeyERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  289|  69.6k|{
  290|  69.6k|    if (erase(key) || isDictionary()) {
  ------------------
  |  Branch (290:9): [True: 26.8k, False: 42.7k]
  |  Branch (290:23): [True: 42.7k, False: 0]
  ------------------
  291|  69.6k|        return;
  292|  69.6k|    }
  293|      0|    typeWarning("dictionary", "ignoring key removal request");
  294|      0|}

_ZN4QPDF3Doc7Objects7StreamsC2ERNS0_6CommonE:
  126|  22.0k|    Common(common),
  127|  22.0k|    copier_(std::make_shared<Copier>(*this))
  128|  22.0k|{
  129|  22.0k|}
_ZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  225|  32.9k|{
  226|  32.9k|    if (filter_factories_registered) [[unlikely]] {
  ------------------
  |  Branch (226:9): [True: 0, False: 32.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|  32.9k|    if (name == "/FlateDecode") {
  ------------------
  |  Branch (235:9): [True: 15.1k, False: 17.7k]
  ------------------
  236|  15.1k|        return SF_FlateLzwDecode::flate_factory;
  237|  15.1k|    }
  238|  17.7k|    if (name == "/Crypt") {
  ------------------
  |  Branch (238:9): [True: 350, False: 17.4k]
  ------------------
  239|    350|        return []() { return std::make_shared<SF_Crypt>(); };
  240|    350|    }
  241|  17.4k|    if (name == "/LZWDecode") {
  ------------------
  |  Branch (241:9): [True: 108, False: 17.2k]
  ------------------
  242|    108|        return SF_FlateLzwDecode::lzw_factory;
  243|    108|    }
  244|  17.2k|    if (name == "/RunLengthDecode") {
  ------------------
  |  Branch (244:9): [True: 40, False: 17.2k]
  ------------------
  245|     40|        return SF_RunLengthDecode::factory;
  246|     40|    }
  247|  17.2k|    if (name == "/DCTDecode") {
  ------------------
  |  Branch (247:9): [True: 5.28k, False: 11.9k]
  ------------------
  248|  5.28k|        return SF_DCTDecode::factory;
  249|  5.28k|    }
  250|  11.9k|    if (name == "/ASCII85Decode") {
  ------------------
  |  Branch (250:9): [True: 1.73k, False: 10.2k]
  ------------------
  251|  1.73k|        return SF_ASCII85Decode::factory;
  252|  1.73k|    }
  253|  10.2k|    if (name == "/ASCIIHexDecode") {
  ------------------
  |  Branch (253:9): [True: 779, False: 9.45k]
  ------------------
  254|    779|        return SF_ASCIIHexDecode::factory;
  255|    779|    }
  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|  9.45k|    if (name == "/Fl") {
  ------------------
  |  Branch (260:9): [True: 1.32k, False: 8.13k]
  ------------------
  261|  1.32k|        return SF_FlateLzwDecode::flate_factory;
  262|  1.32k|    }
  263|  8.13k|    if (name == "/AHx") {
  ------------------
  |  Branch (263:9): [True: 1.37k, False: 6.76k]
  ------------------
  264|  1.37k|        return SF_ASCIIHexDecode::factory;
  265|  1.37k|    }
  266|  6.76k|    if (name == "/A85") {
  ------------------
  |  Branch (266:9): [True: 716, False: 6.04k]
  ------------------
  267|    716|        return SF_ASCII85Decode::factory;
  268|    716|    }
  269|  6.04k|    if (name == "/LZW") {
  ------------------
  |  Branch (269:9): [True: 2.74k, False: 3.30k]
  ------------------
  270|  2.74k|        return SF_FlateLzwDecode::lzw_factory;
  271|  2.74k|    }
  272|  3.30k|    if (name == "/RL") {
  ------------------
  |  Branch (272:9): [True: 940, False: 2.36k]
  ------------------
  273|    940|        return SF_RunLengthDecode::factory;
  274|    940|    }
  275|  2.36k|    if (name == "/DCT") {
  ------------------
  |  Branch (275:9): [True: 1.31k, False: 1.04k]
  ------------------
  276|  1.31k|        return SF_DCTDecode::factory;
  277|  1.31k|    }
  278|  1.04k|    return nullptr;
  279|  2.36k|}
_ZN4qpdf6StreamC2ER4QPDF10QPDFObjGen16QPDFObjectHandlexm:
  283|  47.8k|    BaseHandle(QPDFObject::create<QPDF_Stream>(&qpdf, og, std::move(stream_dict), length))
  284|  47.8k|{
  285|  47.8k|    auto descr = std::make_shared<QPDFObject::Description>(
  286|  47.8k|        qpdf.getFilename() + ", stream object " + og.unparse(' '));
  287|  47.8k|    obj->setDescription(&qpdf, descr, offset);
  288|  47.8k|    setDictDescription();
  289|  47.8k|}
_ZN4qpdf6Stream18setDictDescriptionEv:
  451|  47.8k|{
  452|  47.8k|    auto s = stream();
  453|  47.8k|    if (!s->stream_dict.hasObjectDescription()) {
  ------------------
  |  Branch (453:9): [True: 0, False: 47.8k]
  ------------------
  454|      0|        s->stream_dict.setObjectDescription(
  455|      0|            obj->getQPDF(), obj->getDescription() + " -> stream dictionary");
  456|      0|    }
  457|  47.8k|}
_ZN4qpdf6Stream13getStreamDataE26qpdf_stream_decode_level_e:
  461|  8.03k|{
  462|  8.03k|    std::string result;
  463|  8.03k|    pl::String buf(result);
  464|  8.03k|    bool filtered;
  465|  8.03k|    pipeStreamData(&buf, &filtered, 0, decode_level, false, false);
  466|  8.03k|    if (!filtered) {
  ------------------
  |  Branch (466:9): [True: 1.35k, False: 6.67k]
  ------------------
  467|  1.35k|        throw QPDFExc(
  468|  1.35k|            qpdf_e_unsupported,
  469|  1.35k|            qpdf()->getFilename(),
  470|  1.35k|            "",
  471|  1.35k|            offset(),
  472|  1.35k|            "getStreamData called on unfilterable stream");
  473|  1.35k|    }
  474|  6.67k|    return result;
  475|  8.03k|}
_ZNK4qpdf6Stream14isRootMetadataEv:
  495|  69.6k|{
  496|  69.6k|    if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
  ------------------
  |  Branch (496:9): [True: 69.3k, False: 263]
  ------------------
  497|  69.3k|        return false;
  498|  69.3k|    }
  499|    263|    return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
  500|  69.6k|}
_ZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEE:
  506|  32.6k|{
  507|  32.6k|    auto s = stream();
  508|       |    // Check filters
  509|       |
  510|  32.6k|    auto const& filter_obj = s->stream_dict["/Filter"];
  511|       |
  512|  32.6k|    if (filter_obj.null()) {
  ------------------
  |  Branch (512:9): [True: 4.71k, False: 27.8k]
  ------------------
  513|       |        // No filters
  514|  4.71k|        return true;
  515|  4.71k|    }
  516|  27.8k|    if (filter_obj.size() > global::Limits::max_stream_filters()) {
  ------------------
  |  Branch (516:9): [True: 197, False: 27.6k]
  ------------------
  517|    197|        global::Limits::error();
  518|    197|        warn(
  519|    197|            "limits error(max-stream-filters): too many filters for stream; treating stream as "
  520|    197|            "not filterable");
  521|    197|        return false;
  522|    197|    }
  523|  27.6k|    if (filter_obj.isName()) {
  ------------------
  |  Branch (523:9): [True: 20.1k, False: 7.58k]
  ------------------
  524|       |        // One filter
  525|  20.1k|        auto ff = s->filter_factory(filter_obj.getName());
  526|  20.1k|        if (!ff) {
  ------------------
  |  Branch (526:13): [True: 493, False: 19.6k]
  ------------------
  527|    493|            return false;
  528|    493|        }
  529|  19.6k|        filters.emplace_back(ff());
  530|  19.6k|    } else if (Array array = filter_obj) {
  ------------------
  |  Branch (530:22): [True: 7.51k, False: 76]
  ------------------
  531|       |        // Potentially multiple filters
  532|  13.0k|        for (Name item: array) {
  ------------------
  |  Branch (532:23): [True: 13.0k, False: 6.73k]
  ------------------
  533|  13.0k|            if (!item) {
  ------------------
  |  Branch (533:17): [True: 228, False: 12.8k]
  ------------------
  534|    228|                warn("stream filter type is not name or array");
  535|    228|                return false;
  536|    228|            }
  537|  12.8k|            auto ff = s->filter_factory(item);
  538|  12.8k|            if (!ff) {
  ------------------
  |  Branch (538:17): [True: 555, False: 12.2k]
  ------------------
  539|    555|                filters.clear();
  540|    555|                return false;
  541|    555|            }
  542|  12.2k|            filters.emplace_back(ff());
  543|  12.2k|        }
  544|  7.51k|    } else {
  545|     76|        warn("stream filter type is not name or array");
  546|     76|        return false;
  547|     76|    }
  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|  26.3k|    auto decode_obj = s->stream_dict.getKey("/DecodeParms");
  553|       |
  554|  26.3k|    auto can_filter = // linebreak
  555|  26.3k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  26.3k|        if (!filter.setDecodeParms(d_obj) ||
  557|  26.3k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  558|  26.3k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  559|  26.3k|            return false;
  560|  26.3k|        }
  561|  26.3k|        return true;
  562|  26.3k|    };
  563|       |
  564|  26.3k|    auto decode_array = decode_obj.as_array(strict);
  565|  26.3k|    if (!decode_array || decode_array.size() == 0) {
  ------------------
  |  Branch (565:9): [True: 26.2k, False: 116]
  |  Branch (565:26): [True: 4, False: 112]
  ------------------
  566|  26.2k|        if (decode_array) {
  ------------------
  |  Branch (566:13): [True: 4, False: 26.2k]
  ------------------
  567|      4|            decode_obj = QPDFObjectHandle::newNull();
  568|      4|        }
  569|       |
  570|  31.1k|        for (auto& filter: filters) {
  ------------------
  |  Branch (570:26): [True: 31.1k, False: 25.9k]
  ------------------
  571|  31.1k|            if (!can_filter(decode_level, *filter, decode_obj)) {
  ------------------
  |  Branch (571:17): [True: 317, False: 30.7k]
  ------------------
  572|    317|                return false;
  573|    317|            }
  574|  31.1k|        }
  575|  26.2k|    } 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|    112|        if (!filters.empty() && QIntC::to_size(decode_array.size()) != filters.size()) {
  ------------------
  |  Branch (578:13): [True: 109, False: 3]
  |  Branch (578:13): [True: 15, False: 97]
  |  Branch (578:33): [True: 15, False: 94]
  ------------------
  579|     15|            warn("stream /DecodeParms length is inconsistent with filters");
  580|     15|            return false;
  581|     15|        }
  582|       |
  583|     97|        int i = -1;
  584|    120|        for (auto& filter: filters) {
  ------------------
  |  Branch (584:26): [True: 120, False: 86]
  ------------------
  585|    120|            auto d_obj = decode_array.get(++i);
  586|    120|            if (!can_filter(decode_level, *filter, d_obj)) {
  ------------------
  |  Branch (586:17): [True: 11, False: 109]
  ------------------
  587|     11|                return false;
  588|     11|            }
  589|    120|        }
  590|     97|    }
  591|       |
  592|  26.0k|    return true;
  593|  26.3k|}
_ZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebb:
  603|  45.5k|{
  604|  45.5k|    auto s = stream();
  605|  45.5k|    std::vector<std::shared_ptr<QPDFStreamFilter>> filters;
  606|  45.5k|    bool ignored;
  607|  45.5k|    if (!filterp) {
  ------------------
  |  Branch (607:9): [True: 0, False: 45.5k]
  ------------------
  608|      0|        filterp = &ignored;
  609|      0|    }
  610|  45.5k|    bool& filter = *filterp;
  611|       |
  612|  45.5k|    const bool empty_stream = !s->stream_provider && !s->stream_data && s->length == 0;
  ------------------
  |  Branch (612:31): [True: 45.5k, False: 0]
  |  Branch (612:54): [True: 45.5k, False: 0]
  |  Branch (612:73): [True: 1.72k, False: 43.8k]
  ------------------
  613|  45.5k|    const bool empty_stream_data = s->stream_data && s->stream_data->getSize() == 0;
  ------------------
  |  Branch (613:36): [True: 0, False: 45.5k]
  |  Branch (613:54): [True: 0, False: 0]
  ------------------
  614|  45.5k|    const bool empty = empty_stream || empty_stream_data;
  ------------------
  |  Branch (614:24): [True: 1.72k, False: 43.8k]
  |  Branch (614:40): [True: 0, False: 43.8k]
  ------------------
  615|       |
  616|  45.5k|    if (empty_stream || empty_stream_data) {
  ------------------
  |  Branch (616:9): [True: 1.72k, False: 43.8k]
  |  Branch (616:25): [True: 0, False: 43.8k]
  ------------------
  617|  1.72k|        filter = true;
  618|  1.72k|    }
  619|       |
  620|  45.5k|    filter = empty || encode_flags || decode_level != qpdf_dl_none;
  ------------------
  |  Branch (620:14): [True: 1.72k, False: 43.8k]
  |  Branch (620:23): [True: 2.71k, False: 41.1k]
  |  Branch (620:39): [True: 28.1k, False: 12.9k]
  ------------------
  621|  45.5k|    if (filter) {
  ------------------
  |  Branch (621:9): [True: 32.6k, False: 12.9k]
  ------------------
  622|  32.6k|        filter = filterable(decode_level, filters);
  623|  32.6k|    }
  624|       |
  625|  45.5k|    if (!pipeline) {
  ------------------
  |  Branch (625:9): [True: 0, False: 45.5k]
  ------------------
  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|  45.5k|    std::vector<std::unique_ptr<Pipeline>> to_delete;
  635|       |
  636|  45.5k|    ContentNormalizer normalizer;
  637|  45.5k|    if (filter) {
  ------------------
  |  Branch (637:9): [True: 30.7k, False: 14.8k]
  ------------------
  638|  30.7k|        if (encode_flags & qpdf_ef_compress) {
  ------------------
  |  Branch (638:13): [True: 0, False: 30.7k]
  ------------------
  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|  30.7k|        if (encode_flags & qpdf_ef_normalize) {
  ------------------
  |  Branch (645:13): [True: 2.79k, False: 27.9k]
  ------------------
  646|  2.79k|            auto new_pipeline =
  647|  2.79k|                std::make_unique<Pl_QPDFTokenizer>("normalizer", &normalizer, pipeline);
  648|  2.79k|            pipeline = new_pipeline.get();
  649|  2.79k|            to_delete.push_back(std::move(new_pipeline));
  650|  2.79k|        }
  651|       |
  652|  30.7k|        for (auto iter = s->token_filters.rbegin(); iter != s->token_filters.rend(); ++iter) {
  ------------------
  |  Branch (652:53): [True: 0, False: 30.7k]
  ------------------
  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|  61.5k|        for (auto f_iter = filters.rbegin(); f_iter != filters.rend(); ++f_iter) {
  ------------------
  |  Branch (659:46): [True: 30.8k, False: 30.7k]
  ------------------
  660|  30.8k|            if (auto decode_pipeline = (*f_iter)->getDecodePipeline(pipeline)) {
  ------------------
  |  Branch (660:22): [True: 30.6k, False: 253]
  ------------------
  661|  30.6k|                pipeline = decode_pipeline;
  662|  30.6k|            }
  663|  30.8k|            auto* flate = dynamic_cast<Pl_Flate*>(pipeline);
  664|  30.8k|            if (flate) {
  ------------------
  |  Branch (664:17): [True: 16.3k, False: 14.5k]
  ------------------
  665|  16.3k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });
  666|  16.3k|            }
  667|  30.8k|        }
  668|  30.7k|    }
  669|       |
  670|  45.5k|    if (s->stream_data.get()) {
  ------------------
  |  Branch (670:9): [True: 0, False: 45.5k]
  ------------------
  671|      0|        QTC::TC("qpdf", "QPDF_Stream pipe replaced stream data");
  672|      0|        pipeline->write(s->stream_data->getBuffer(), s->stream_data->getSize());
  673|      0|        pipeline->finish();
  674|  45.5k|    } else if (s->stream_provider.get()) {
  ------------------
  |  Branch (674:16): [True: 0, False: 45.5k]
  ------------------
  675|      0|        Pl_Count count("stream provider count", pipeline);
  676|      0|        if (s->stream_provider->supportsRetry()) {
  ------------------
  |  Branch (676:13): [True: 0, False: 0]
  ------------------
  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|      0|        } else {
  683|      0|            s->stream_provider->provideStreamData(obj->getObjGen(), &count);
  684|      0|        }
  685|      0|        qpdf_offset_t actual_length = count.getCount();
  686|      0|        if (auto desired_length = Length()) {
  ------------------
  |  Branch (686:18): [True: 0, False: 0]
  ------------------
  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|      0|        } else {
  696|      0|            Length(actual_length);
  697|      0|        }
  698|  45.5k|    } else {
  699|  45.5k|        if (offset() == 0) {
  ------------------
  |  Branch (699:13): [True: 0, False: 45.5k]
  ------------------
  700|      0|            throw std::logic_error("pipeStreamData called for stream with no data");
  701|      0|        }
  702|  45.5k|        if (!Streams::pipeStreamData(
  ------------------
  |  Branch (702:13): [True: 13.2k, False: 32.3k]
  ------------------
  703|  45.5k|                qpdf(),
  704|  45.5k|                id_gen(),
  705|  45.5k|                offset(),
  706|  45.5k|                s->length,
  707|  45.5k|                s->stream_dict,
  708|  45.5k|                isRootMetadata(),
  709|  45.5k|                pipeline,
  710|  45.5k|                suppress_warnings,
  711|  45.5k|                will_retry)) {
  712|  13.2k|            filter = false;
  713|  13.2k|            return false;
  714|  13.2k|        }
  715|  45.5k|    }
  716|       |
  717|  32.3k|    if (filter && !suppress_warnings && normalizer.anyBadTokens()) {
  ------------------
  |  Branch (717:9): [True: 17.3k, False: 15.0k]
  |  Branch (717:19): [True: 17.3k, False: 0]
  |  Branch (717:41): [True: 731, False: 16.5k]
  ------------------
  718|    731|        warn("content normalization encountered bad tokens");
  719|    731|        if (normalizer.lastTokenWasBad()) {
  ------------------
  |  Branch (719:13): [True: 404, False: 327]
  ------------------
  720|    404|            QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
  721|    404|            warn(
  722|    404|                "normalized content ended with a bad token; you may be able to resolve this by "
  723|    404|                "coalescing content streams in combination with normalizing content. From the "
  724|    404|                "command line, specify --coalesce-contents");
  725|    404|        }
  726|    731|        warn(
  727|    731|            "Resulting stream data may be corrupted but is may still useful for manual "
  728|    731|            "inspection. For more information on this warning, search for content normalization "
  729|    731|            "in the manual.");
  730|    731|    }
  731|       |
  732|  32.3k|    return true;
  733|  45.5k|}
_ZN4qpdf6Stream4warnERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  789|  5.74k|{
  790|  5.74k|    qpdf()->warn(qpdf_e_damaged_pdf, "", offset(), message);
  791|  5.74k|}
_ZNK16QPDFObjectHandle7getDictEv:
  795|  72.8k|{
  796|  72.8k|    return as_stream(error).getDict();
  797|  72.8k|}
_ZN16QPDFObjectHandle16setFilterOnWriteEb:
  801|  13.4k|{
  802|  13.4k|    as_stream(error).setFilterOnWrite(val);
  803|  13.4k|}
_ZN16QPDFObjectHandle16getFilterOnWriteEv:
  807|  24.1k|{
  808|  24.1k|    return as_stream(error).getFilterOnWrite();
  809|  24.1k|}
_ZN16QPDFObjectHandle14isDataModifiedEv:
  813|  24.1k|{
  814|  24.1k|    return as_stream(error).isDataModified();
  815|  24.1k|}
_ZNK16QPDFObjectHandle14isRootMetadataEv:
  825|  24.1k|{
  826|  24.1k|    return as_stream(error).isRootMetadata();
  827|  24.1k|}
_ZN16QPDFObjectHandle13getStreamDataE26qpdf_stream_decode_level_e:
  831|  6.41k|{
  832|  6.41k|    return std::make_shared<Buffer>(as_stream(error).getStreamData(level));
  833|  6.41k|}
_ZN16QPDFObjectHandle14pipeStreamDataEP8Pipelinei26qpdf_stream_decode_level_ebb:
  861|  37.5k|{
  862|  37.5k|    bool filtering_attempted;
  863|  37.5k|    as_stream(error).pipeStreamData(
  864|  37.5k|        p, &filtering_attempted, encode_flags, decode_level, suppress_warnings, will_retry);
  865|  37.5k|    return filtering_attempted;
  866|  37.5k|}
QPDF_Stream.cc:_ZZN4qpdf6Stream10filterableE26qpdf_stream_decode_level_eRNSt3__16vectorINS2_10shared_ptrI16QPDFStreamFilterEENS2_9allocatorIS6_EEEEENK3$_0clIS1_S5_16QPDFObjectHandleEEbT_RT0_RT1_:
  555|  31.2k|        [](auto d_level, auto& filter, auto& d_obj) -> bool {
  556|  31.2k|        if (!filter.setDecodeParms(d_obj) ||
  ------------------
  |  Branch (556:13): [True: 328, False: 30.9k]
  |  Branch (556:13): [True: 328, False: 30.9k]
  ------------------
  557|  30.9k|            (d_level < qpdf_dl_all && filter.isLossyCompression()) ||
  ------------------
  |  Branch (557:14): [True: 8.11k, False: 22.7k]
  |  Branch (557:39): [True: 4, False: 8.11k]
  ------------------
  558|  30.9k|            (d_level < qpdf_dl_specialized && filter.isSpecializedCompression())) {
  ------------------
  |  Branch (558:14): [True: 21, False: 30.8k]
  |  Branch (558:47): [True: 0, False: 21]
  ------------------
  559|    328|            return false;
  560|    328|        }
  561|  30.9k|        return true;
  562|  31.2k|    };
_ZN4QPDF3Doc7Objects7Streams6CopierC2ERS2_:
   67|  22.0k|        QPDFObjectHandle::StreamDataProvider(true),
   68|  22.0k|        streams(streams)
   69|  22.0k|    {
   70|  22.0k|    }
_ZN4QPDF3Doc7Objects7Streams6CopierD2Ev:
   64|  22.0k|    ~Copier() final = default;
QPDF_Stream.cc:_ZZNK11QPDF_Stream7Members14filter_factoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clEv:
  239|    350|        return []() { return std::make_shared<SF_Crypt>(); };
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_CryptC2Ev:
  136|    350|        SF_Crypt() = default;
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt14setDecodeParmsE16QPDFObjectHandle:
  141|    311|        {
  142|       |            // we only validate here - processing happens in decryptStream
  143|    311|            if (Dictionary dict = decode_parms) {
  ------------------
  |  Branch (143:28): [True: 200, False: 111]
  ------------------
  144|  1.76k|                for (auto const& [key, value]: dict) {
  ------------------
  |  Branch (144:46): [True: 1.76k, False: 58]
  ------------------
  145|  1.76k|                    if (key == "/Type" &&
  ------------------
  |  Branch (145:25): [True: 89, False: 1.67k]
  |  Branch (145:25): [True: 23, False: 1.73k]
  ------------------
  146|     89|                        (value.null() || Name(value) == "/CryptFilterDecodeParms")) {
  ------------------
  |  Branch (146:26): [True: 6, False: 83]
  |  Branch (146:42): [True: 17, False: 66]
  ------------------
  147|     23|                        continue;
  148|     23|                    }
  149|  1.73k|                    if (key == "/Name") {
  ------------------
  |  Branch (149:25): [True: 25, False: 1.71k]
  ------------------
  150|     25|                        continue;
  151|     25|                    }
  152|  1.71k|                    if (!value.null()) {
  ------------------
  |  Branch (152:25): [True: 142, False: 1.57k]
  ------------------
  153|    142|                        return false;
  154|    142|                    }
  155|  1.71k|                }
  156|     58|                return true;
  157|    200|            }
  158|    111|            return decode_parms.null();
  159|    311|        }
QPDF_Stream.cc:_ZN12_GLOBAL__N_18SF_Crypt17getDecodePipelineEP8Pipeline:
  163|    159|        {
  164|       |            // Not used -- handled by pipeStreamData
  165|    159|            return nullptr;
  166|    159|        }
QPDF_Stream.cc:_ZZN4qpdf6Stream14pipeStreamDataEP8PipelinePbi26qpdf_stream_decode_level_ebbENK3$_0clEPKci:
  665|  3.36k|                flate->setWarnCallback([this](char const* msg, int code) { warn(msg); });

_ZNK11QPDF_String12useHexStringEv:
   57|  66.4k|{
   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|  66.4k|    unsigned int non_ascii = 0;
   62|  3.89M|    for (auto const ch: val) {
  ------------------
  |  Branch (62:23): [True: 3.89M, False: 58.1k]
  ------------------
   63|  3.89M|        if (ch > 126) {
  ------------------
  |  Branch (63:13): [True: 5.64k, False: 3.88M]
  ------------------
   64|  5.64k|            ++non_ascii;
   65|  3.88M|        } else if (ch >= 32) {
  ------------------
  |  Branch (65:20): [True: 1.99M, False: 1.89M]
  ------------------
   66|  1.99M|            continue;
   67|  1.99M|        } else if (ch < 0 || ch >= 24) {
  ------------------
  |  Branch (67:20): [True: 573k, False: 1.32M]
  |  Branch (67:30): [True: 31.1k, False: 1.29M]
  ------------------
   68|   604k|            ++non_ascii;
   69|  1.29M|        } else if (!(ch == '\n' || ch == '\r' || ch == '\t' || ch == '\b' || ch == '\f')) {
  ------------------
  |  Branch (69:22): [True: 258k, False: 1.03M]
  |  Branch (69:36): [True: 855, False: 1.03M]
  |  Branch (69:50): [True: 131k, False: 902k]
  |  Branch (69:64): [True: 117k, False: 785k]
  |  Branch (69:78): [True: 777k, False: 8.29k]
  ------------------
   70|  8.29k|            return true;
   71|  8.29k|        }
   72|  3.89M|    }
   73|  58.1k|    return 5 * non_ascii > val.length();
   74|  66.4k|}
_ZN11QPDF_String7unparseEb:
   78|  83.2k|{
   79|  83.2k|    bool use_hexstring = force_binary || useHexString();
  ------------------
  |  Branch (79:26): [True: 16.7k, False: 66.4k]
  |  Branch (79:42): [True: 12.4k, False: 54.0k]
  ------------------
   80|  83.2k|    std::string result;
   81|  83.2k|    if (use_hexstring) {
  ------------------
  |  Branch (81:9): [True: 29.2k, False: 54.0k]
  ------------------
   82|  29.2k|        static auto constexpr hexchars = "0123456789abcdef";
   83|  29.2k|        result.reserve(2 * val.length() + 2);
   84|  29.2k|        result += '<';
   85|  25.3M|        for (const char c: val) {
  ------------------
  |  Branch (85:26): [True: 25.3M, False: 29.2k]
  ------------------
   86|  25.3M|            result += hexchars[static_cast<unsigned char>(c) >> 4];
   87|  25.3M|            result += hexchars[c & 0x0f];
   88|  25.3M|        }
   89|  29.2k|        result += '>';
   90|  54.0k|    } else {
   91|  54.0k|        result += "(";
   92|  3.04M|        for (unsigned int i = 0; i < val.length(); ++i) {
  ------------------
  |  Branch (92:34): [True: 2.98M, False: 54.0k]
  ------------------
   93|  2.98M|            char ch = val.at(i);
   94|  2.98M|            switch (ch) {
   95|   255k|            case '\n':
  ------------------
  |  Branch (95:13): [True: 255k, False: 2.73M]
  ------------------
   96|   255k|                result += "\\n";
   97|   255k|                break;
   98|       |
   99|    736|            case '\r':
  ------------------
  |  Branch (99:13): [True: 736, False: 2.98M]
  ------------------
  100|    736|                result += "\\r";
  101|    736|                break;
  102|       |
  103|   129k|            case '\t':
  ------------------
  |  Branch (103:13): [True: 129k, False: 2.85M]
  ------------------
  104|   129k|                result += "\\t";
  105|   129k|                break;
  106|       |
  107|   116k|            case '\b':
  ------------------
  |  Branch (107:13): [True: 116k, False: 2.87M]
  ------------------
  108|   116k|                result += "\\b";
  109|   116k|                break;
  110|       |
  111|   767k|            case '\f':
  ------------------
  |  Branch (111:13): [True: 767k, False: 2.22M]
  ------------------
  112|   767k|                result += "\\f";
  113|   767k|                break;
  114|       |
  115|  26.5k|            case '(':
  ------------------
  |  Branch (115:13): [True: 26.5k, False: 2.96M]
  ------------------
  116|  26.5k|                result += "\\(";
  117|  26.5k|                break;
  118|       |
  119|  26.4k|            case ')':
  ------------------
  |  Branch (119:13): [True: 26.4k, False: 2.96M]
  ------------------
  120|  26.4k|                result += "\\)";
  121|  26.4k|                break;
  122|       |
  123|  5.64k|            case '\\':
  ------------------
  |  Branch (123:13): [True: 5.64k, False: 2.98M]
  ------------------
  124|  5.64k|                result += "\\\\";
  125|  5.64k|                break;
  126|       |
  127|  1.65M|            default:
  ------------------
  |  Branch (127:13): [True: 1.65M, False: 1.32M]
  ------------------
  128|  1.65M|                if (is_iso_latin1_printable(ch)) {
  ------------------
  |  Branch (128:21): [True: 1.61M, False: 46.8k]
  ------------------
  129|  1.61M|                    result += val.at(i);
  130|  1.61M|                } else {
  131|  46.8k|                    result += "\\" +
  132|  46.8k|                        QUtil::int_to_string_base(
  133|  46.8k|                                  static_cast<int>(static_cast<unsigned char>(ch)), 8, 3);
  134|  46.8k|                }
  135|  1.65M|                break;
  136|  2.98M|            }
  137|  2.98M|        }
  138|  54.0k|        result += ")";
  139|  54.0k|    }
  140|       |
  141|  83.2k|    return result;
  142|  83.2k|}
QPDF_String.cc:_ZL23is_iso_latin1_printablec:
   12|  1.65M|{
   13|  1.65M|    return (ch >= 32 && ch <= 126) || static_cast<unsigned char>(ch) >= 160;
  ------------------
  |  Branch (13:13): [True: 1.61M, False: 46.3k]
  |  Branch (13:25): [True: 1.60M, False: 4.04k]
  |  Branch (13:39): [True: 3.52k, False: 46.8k]
  ------------------
   14|  1.65M|}

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

_ZN13QPDFXRefEntryC2Ev:
   30|  5.59M|QPDFXRefEntry::QPDFXRefEntry() = default;
_ZNK13QPDFXRefEntry7getTypeEv:
   42|  2.78M|{
   43|  2.78M|    return type;
   44|  2.78M|}
_ZNK13QPDFXRefEntry9getOffsetEv:
   48|  1.09M|{
   49|  1.09M|    util::assertion(type == 1, "getOffset called for xref entry of type != 1");
   50|  1.09M|    return this->field1;
   51|  1.09M|}
_ZNK13QPDFXRefEntry18getObjStreamNumberEv:
   55|   841k|{
   56|   841k|    util::assertion(type == 2, "getObjStreamNumber called for xref entry of type != 2");
   57|   841k|    return QIntC::to_int(field1);
   58|   841k|}
_ZNK13QPDFXRefEntry17getObjStreamIndexEv:
   62|  17.8k|{
   63|  17.8k|    util::assertion(type == 2, "getObjStreamIndex called for xref entry of type != 2");
   64|  17.8k|    return field2;
   65|  17.8k|}
_ZN4QPDF3Doc7Objects18validatePDFVersionERPKcRNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  165|  3.97k|{
  166|  3.97k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (166:9): [True: 1.51k, False: 2.46k]
  ------------------
  167|  1.51k|        return false;
  168|  1.51k|    }
  169|  7.06k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (169:12): [True: 4.60k, False: 2.46k]
  ------------------
  170|  4.60k|        version.append(1, *p++);
  171|  4.60k|    }
  172|  2.46k|    if (!(*p == '.' && util::is_digit(*(p + 1)))) {
  ------------------
  |  Branch (172:11): [True: 1.96k, False: 493]
  |  Branch (172:24): [True: 1.33k, False: 630]
  ------------------
  173|  1.12k|        return false;
  174|  1.12k|    }
  175|  1.33k|    version.append(1, *p++);
  176|  11.2k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (176:12): [True: 9.94k, False: 1.33k]
  ------------------
  177|  9.94k|        version.append(1, *p++);
  178|  9.94k|    }
  179|  1.33k|    return true;
  180|  2.46k|}
_ZN4QPDF3Doc7Objects10findHeaderEv:
  184|  3.97k|{
  185|  3.97k|    qpdf_offset_t global_offset = m->file->tell();
  186|  3.97k|    std::string line = m->file->readLine(1024);
  187|  3.97k|    char const* p = line.data();
  188|  3.97k|    util::assertion(strncmp(p, "%PDF-", 5) == 0, "findHeader is not looking at %PDF-");
  189|  3.97k|    p += 5;
  190|  3.97k|    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|  3.97k|    if (!validatePDFVersion(p, version)) {
  ------------------
  |  Branch (193:9): [True: 2.63k, False: 1.33k]
  ------------------
  194|  2.63k|        return false;
  195|  2.63k|    }
  196|  1.33k|    m->pdf_version = version;
  197|  1.33k|    if (global_offset != 0) {
  ------------------
  |  Branch (197:9): [True: 865, False: 474]
  ------------------
  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|    865|        m->file = std::make_shared<OffsetInputSource>(m->file, global_offset);
  202|    865|    }
  203|  1.33k|    return true;
  204|  3.97k|}
_ZN4QPDF3Doc7Objects13findStartxrefEv:
  208|  6.57k|{
  209|  6.57k|    if (readToken(*m->file).isWord("startxref") && readToken(*m->file).isInteger()) {
  ------------------
  |  Branch (209:9): [True: 6.19k, False: 376]
  |  Branch (209:9): [True: 5.07k, False: 1.49k]
  |  Branch (209:52): [True: 5.07k, False: 1.12k]
  ------------------
  210|       |        // Position in front of offset token
  211|  5.07k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
  212|  5.07k|        return true;
  213|  5.07k|    }
  214|  1.49k|    return false;
  215|  6.57k|}
_ZN4QPDF3Doc7Objects5parseEPKc:
  219|  22.0k|{
  220|  22.0k|    if (password) {
  ------------------
  |  Branch (220:9): [True: 0, False: 22.0k]
  ------------------
  221|      0|        m->encp->provided_password = password;
  222|      0|    }
  223|       |
  224|       |    // Find the header anywhere in the first 1024 bytes of the file.
  225|  22.0k|    PatternFinder hf(*this, &Objects::findHeader);
  226|  22.0k|    if (!m->file->findFirst("%PDF-", 0, 1024, hf)) {
  ------------------
  |  Branch (226:9): [True: 20.7k, False: 1.33k]
  ------------------
  227|  20.7k|        warn(damagedPDF("", -1, "can't find PDF header"));
  228|       |        // QPDFWriter writes files that usually require at least version 1.2 for /FlateDecode
  229|  20.7k|        m->pdf_version = "1.2";
  230|  20.7k|    }
  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|  22.0k|    m->file->seek(0, SEEK_END);
  235|  22.0k|    qpdf_offset_t end_offset = m->file->tell();
  236|  22.0k|    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|  22.0k|    if (m->xref_table_max_id > m->xref_table_max_offset / 3) {
  ------------------
  |  Branch (239:9): [True: 22.0k, False: 0]
  ------------------
  240|  22.0k|        m->xref_table_max_id = static_cast<int>(m->xref_table_max_offset / 3);
  241|  22.0k|    }
  242|  22.0k|    qpdf_offset_t start_offset = (end_offset > 1054 ? end_offset - 1054 : 0);
  ------------------
  |  Branch (242:35): [True: 3.95k, False: 18.1k]
  ------------------
  243|  22.0k|    PatternFinder sf(*this, &Objects::findStartxref);
  244|  22.0k|    qpdf_offset_t xref_offset = 0;
  245|  22.0k|    if (m->file->findLast("startxref", start_offset, 0, sf)) {
  ------------------
  |  Branch (245:9): [True: 4.72k, False: 17.3k]
  ------------------
  246|  4.72k|        xref_offset = QUtil::string_to_ll(readToken(*m->file).getValue().c_str());
  247|  4.72k|    }
  248|       |
  249|  22.0k|    try {
  250|  22.0k|        if (xref_offset == 0) {
  ------------------
  |  Branch (250:13): [True: 17.3k, False: 4.69k]
  ------------------
  251|  17.3k|            throw damagedPDF("", -1, "can't find startxref");
  252|  17.3k|        }
  253|  4.69k|        try {
  254|  4.69k|            read_xref(xref_offset);
  255|  4.69k|        } catch (QPDFExc&) {
  256|  2.99k|            throw;
  257|  2.99k|        } catch (std::exception& e) {
  258|    514|            throw damagedPDF("", -1, std::string("error reading xref: ") + e.what());
  259|    514|        }
  260|  20.9k|    } catch (QPDFExc& e) {
  261|  20.9k|        if (global::Options::inspection_mode()) {
  ------------------
  |  Branch (261:13): [True: 0, False: 20.9k]
  ------------------
  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|  20.9k|        if (cf.surpress_recovery()) {
  ------------------
  |  Branch (272:13): [True: 0, False: 20.9k]
  ------------------
  273|      0|            throw;
  274|      0|        }
  275|  20.9k|        reconstruct_xref(e, xref_offset > 0);
  276|  20.9k|    }
  277|       |
  278|  9.66k|    m->encp->initialize(qpdf);
  279|  9.66k|    m->parsed = true;
  280|  9.66k|    if (!m->xref_table.empty() && !qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (280:9): [True: 8.33k, False: 1.33k]
  |  Branch (280:9): [True: 4, False: 9.66k]
  |  Branch (280:35): [True: 4, False: 8.32k]
  ------------------
  281|       |        // QPDFs created from JSON have an empty xref table and no root object yet.
  282|      4|        throw damagedPDF("", -1, "unable to find page tree");
  283|      4|    }
  284|  9.66k|    if (m->cf.max_warnings()) {
  ------------------
  |  Branch (284:9): [True: 9.04k, False: 618]
  ------------------
  285|  9.04k|        if (m->pages.empty()) {
  ------------------
  |  Branch (285:13): [True: 123, False: 8.92k]
  ------------------
  286|    123|            throw damagedPDF("", -1, "no pages found");
  287|    123|        }
  288|  8.92k|        (void)m->cf.max_warnings(0);
  289|  8.92k|    }
  290|  9.66k|}
_ZN4QPDF3Doc7Objects7inParseEb:
  294|   352k|{
  295|   352k|    util::internal_error_if(
  296|   352k|        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|   352k|    );
  300|   352k|    m->in_parse = v;
  301|   352k|}
_ZN4QPDF3Doc7Objects10setTrailerE16QPDFObjectHandle:
  305|  7.50k|{
  306|  7.50k|    if (m->trailer) {
  ------------------
  |  Branch (306:9): [True: 341, False: 7.16k]
  ------------------
  307|    341|        return;
  308|    341|    }
  309|  7.16k|    m->trailer = obj;
  310|  7.16k|}
_ZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcb:
  314|  26.4k|{
  315|  26.4k|    if (m->reconstructed_xref) {
  ------------------
  |  Branch (315:9): [True: 5.46k, False: 21.0k]
  ------------------
  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|  5.46k|        throw e;
  319|  5.46k|    }
  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|  21.0k|    const auto max_warnings = m->warnings.size() + 1000U;
  324|  21.0k|    auto check_warnings = [this, max_warnings]() {
  325|  21.0k|        if (m->warnings.size() > max_warnings) {
  326|  21.0k|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|  21.0k|        }
  328|  21.0k|    };
  329|       |
  330|  21.0k|    m->reconstructed_xref = true;
  331|       |    // We may find more objects, which may contain dangling references.
  332|  21.0k|    m->fixed_dangling_refs = false;
  333|       |
  334|  21.0k|    warn(damagedPDF("", -1, "file is damaged"));
  335|  21.0k|    warn(e);
  336|  21.0k|    warn(damagedPDF("", -1, "Attempting to reconstruct cross-reference table"));
  337|       |
  338|       |    // Delete all references to type 1 (uncompressed) objects
  339|  21.0k|    std::vector<QPDFObjGen> to_delete;
  340|  54.0k|    for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (340:26): [True: 54.0k, False: 21.0k]
  ------------------
  341|  54.0k|        if (iter.second.getType() == 1) {
  ------------------
  |  Branch (341:13): [True: 35.4k, False: 18.5k]
  ------------------
  342|  35.4k|            to_delete.emplace_back(iter.first);
  343|  35.4k|        }
  344|  54.0k|    }
  345|  35.4k|    for (auto const& iter: to_delete) {
  ------------------
  |  Branch (345:26): [True: 35.4k, False: 21.0k]
  ------------------
  346|  35.4k|        m->xref_table.erase(iter);
  347|  35.4k|    }
  348|       |
  349|  21.0k|    std::vector<std::tuple<int, int, qpdf_offset_t>> found_objects;
  350|  21.0k|    std::vector<qpdf_offset_t> trailers;
  351|  21.0k|    std::vector<qpdf_offset_t> startxrefs;
  352|       |
  353|  21.0k|    m->file->seek(0, SEEK_END);
  354|  21.0k|    qpdf_offset_t eof = m->file->tell();
  355|  21.0k|    m->file->seek(0, SEEK_SET);
  356|       |    // Don't allow very long tokens here during recovery. All the interesting tokens are covered.
  357|  21.0k|    static size_t const MAX_LEN = 10;
  358|  1.50M|    while (m->file->tell() < eof) {
  ------------------
  |  Branch (358:12): [True: 1.48M, False: 21.0k]
  ------------------
  359|  1.48M|        QPDFTokenizer::Token t1 = m->objects.readToken(*m->file, MAX_LEN);
  360|  1.48M|        qpdf_offset_t token_start = m->file->tell() - toO(t1.getValue().length());
  361|  1.48M|        if (t1.isInteger()) {
  ------------------
  |  Branch (361:13): [True: 240k, False: 1.24M]
  ------------------
  362|   240k|            auto pos = m->file->tell();
  363|   240k|            auto t2 = m->objects.readToken(*m->file, MAX_LEN);
  364|   240k|            if (t2.isInteger() && m->objects.readToken(*m->file, MAX_LEN).isWord("obj")) {
  ------------------
  |  Branch (364:17): [True: 204k, False: 35.6k]
  |  Branch (364:17): [True: 147k, False: 92.6k]
  |  Branch (364:35): [True: 147k, False: 56.9k]
  ------------------
  365|   147k|                int obj = QUtil::string_to_int(t1.getValue().c_str());
  366|   147k|                if (obj > 0) {
  ------------------
  |  Branch (366:21): [True: 146k, False: 1.01k]
  ------------------
  367|   146k|                    int gen = QUtil::string_to_int(t2.getValue().c_str());
  368|   146k|                    if (0 <= gen && gen < 65535) {
  ------------------
  |  Branch (368:25): [True: 146k, False: 284]
  |  Branch (368:37): [True: 146k, False: 216]
  ------------------
  369|   146k|                        if (obj <= m->xref_table_max_id) {
  ------------------
  |  Branch (369:29): [True: 145k, False: 826]
  ------------------
  370|   145k|                            found_objects.emplace_back(obj, gen, token_start);
  371|   145k|                        } else {
  372|    826|                            warn(damagedPDF(
  373|    826|                                "",
  374|    826|                                -1,
  375|    826|                                "ignoring object with impossibly large id " + std::to_string(obj)));
  376|    826|                        }
  377|   146k|                    }
  378|   146k|                }
  379|   147k|            }
  380|   240k|            m->file->seek(pos, SEEK_SET);
  381|  1.24M|        } else if (!m->trailer && t1.isWord("trailer")) {
  ------------------
  |  Branch (381:20): [True: 1.15M, False: 85.5k]
  |  Branch (381:20): [True: 34.0k, False: 1.20M]
  |  Branch (381:35): [True: 34.0k, False: 1.12M]
  ------------------
  382|  34.0k|            trailers.emplace_back(m->file->tell());
  383|  1.20M|        } else if (!found_startxref && t1.isWord("startxref")) {
  ------------------
  |  Branch (383:20): [True: 1.01M, False: 196k]
  |  Branch (383:20): [True: 2.78k, False: 1.20M]
  |  Branch (383:40): [True: 2.78k, False: 1.00M]
  ------------------
  384|  2.78k|            startxrefs.emplace_back(m->file->tell());
  385|  2.78k|        }
  386|  1.48M|        check_warnings();
  387|  1.48M|        m->file->findAndSkipNextEOL();
  388|  1.48M|    }
  389|       |
  390|  21.0k|    if (!found_startxref && !startxrefs.empty() && !found_objects.empty() &&
  ------------------
  |  Branch (390:9): [True: 17.5k, False: 3.41k]
  |  Branch (390:29): [True: 979, False: 16.6k]
  |  Branch (390:52): [True: 876, False: 103]
  ------------------
  391|    876|        startxrefs.back() > std::get<2>(found_objects.back())) {
  ------------------
  |  Branch (391:9): [True: 425, False: 451]
  ------------------
  392|    425|        auto xref_backup{m->xref_table};
  393|    425|        try {
  394|    425|            m->file->seek(startxrefs.back(), SEEK_SET);
  395|    425|            if (auto offset = QUtil::string_to_ll(readToken(*m->file).getValue().data())) {
  ------------------
  |  Branch (395:22): [True: 342, False: 83]
  ------------------
  396|    342|                read_xref(offset);
  397|       |
  398|    342|                if (qpdf.getRoot().getKey("/Pages").isDictionary()) {
  ------------------
  |  Branch (398:21): [True: 36, False: 306]
  ------------------
  399|     36|                    warn(damagedPDF(
  400|     36|                        "", -1, "startxref was more than 1024 bytes before end of file"));
  401|     36|                    m->encp->initialize(qpdf);
  402|     36|                    m->parsed = true;
  403|     36|                    m->reconstructed_xref = false;
  404|     36|                    return;
  405|     36|                }
  406|    342|            }
  407|    425|        } catch (...) {
  408|       |            // ok, bad luck. Do recovery.
  409|    323|        }
  410|    405|        m->xref_table = std::move(xref_backup);
  411|    405|    }
  412|       |
  413|  20.9k|    auto rend = found_objects.rend();
  414|   166k|    for (auto it = found_objects.rbegin(); it != rend; it++) {
  ------------------
  |  Branch (414:44): [True: 145k, False: 20.9k]
  ------------------
  415|   145k|        auto [obj, gen, token_start] = *it;
  416|   145k|        insertXrefEntry(obj, 1, token_start, gen);
  417|   145k|        check_warnings();
  418|   145k|    }
  419|  20.9k|    m->deleted_objects.clear();
  420|       |
  421|       |    // Search at most the last 100 trailer candidates. If none of them are valid, odds are this file
  422|       |    // is deliberately broken.
  423|  20.9k|    int end_index = trailers.size() > 100 ? static_cast<int>(trailers.size()) - 100 : 0;
  ------------------
  |  Branch (423:21): [True: 5, False: 20.9k]
  ------------------
  424|  34.8k|    for (auto it = trailers.rbegin(); it != std::prev(trailers.rend(), end_index); it++) {
  ------------------
  |  Branch (424:39): [True: 16.1k, False: 18.7k]
  ------------------
  425|  16.1k|        m->file->seek(*it, SEEK_SET);
  426|  16.1k|        auto t = readTrailer();
  427|  16.1k|        if (!t.isDictionary()) {
  ------------------
  |  Branch (427:13): [True: 13.0k, False: 3.14k]
  ------------------
  428|       |            // Oh well.  It was worth a try.
  429|  13.0k|        } else {
  430|  3.14k|            if (t.hasKey("/Root")) {
  ------------------
  |  Branch (430:17): [True: 2.27k, False: 873]
  ------------------
  431|  2.27k|                m->trailer = t;
  432|  2.27k|                break;
  433|  2.27k|            }
  434|    873|            warn(damagedPDF("trailer", *it, "recovered trailer has no /Root entry"));
  435|    873|        }
  436|  13.8k|        check_warnings();
  437|  13.8k|    }
  438|       |
  439|  20.9k|    if (!m->trailer) {
  ------------------
  |  Branch (439:9): [True: 18.0k, False: 2.95k]
  ------------------
  440|  18.0k|        qpdf_offset_t max_offset{0};
  441|  18.0k|        size_t max_size{0};
  442|       |        // If there are any xref streams, take the last one to appear.
  443|  78.7k|        for (auto const& iter: m->xref_table) {
  ------------------
  |  Branch (443:30): [True: 78.7k, False: 18.0k]
  ------------------
  444|  78.7k|            auto entry = iter.second;
  445|  78.7k|            if (entry.getType() != 1) {
  ------------------
  |  Branch (445:17): [True: 1.43k, False: 77.3k]
  ------------------
  446|  1.43k|                continue;
  447|  1.43k|            }
  448|  77.3k|            auto oh = qpdf.getObject(iter.first);
  449|  77.3k|            try {
  450|  77.3k|                if (!oh.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (450:21): [True: 68.9k, False: 8.36k]
  ------------------
  451|  68.9k|                    continue;
  452|  68.9k|                }
  453|  77.3k|            } catch (std::exception&) {
  454|  2.54k|                continue;
  455|  2.54k|            }
  456|  5.81k|            auto offset = entry.getOffset();
  457|  5.81k|            auto size = oh.getDict().getKey("/Size").getUIntValueAsUInt();
  458|  5.81k|            if (size > max_size || (size == max_size && offset > max_offset)) {
  ------------------
  |  Branch (458:17): [True: 4.89k, False: 925]
  |  Branch (458:37): [True: 925, False: 0]
  |  Branch (458:57): [True: 855, False: 70]
  ------------------
  459|  5.74k|                max_offset = offset;
  460|  5.74k|                setTrailer(oh.getDict());
  461|  5.74k|            }
  462|  5.81k|            check_warnings();
  463|  5.81k|        }
  464|  18.0k|        if (max_offset > 0) {
  ------------------
  |  Branch (464:13): [True: 5.39k, False: 12.6k]
  ------------------
  465|  5.39k|            try {
  466|  5.39k|                read_xref(max_offset, true);
  467|  5.39k|            } catch (std::exception&) {
  468|  2.98k|                warn(damagedPDF(
  469|  2.98k|                    "", -1, "error decoding candidate xref stream while recovering damaged file"));
  470|  2.98k|            }
  471|  5.39k|            QTC::TC("qpdf", "QPDF recover xref stream");
  472|  5.36k|        }
  473|  18.0k|    }
  474|       |
  475|  20.9k|    if (!m->trailer || (!m->parsed && !m->trailer.getKey("/Root").isDictionary())) {
  ------------------
  |  Branch (475:9): [True: 12.6k, False: 8.28k]
  |  Branch (475:9): [True: 18.2k, False: 2.70k]
  |  Branch (475:25): [True: 8.18k, False: 96]
  |  Branch (475:39): [True: 5.61k, False: 2.57k]
  ------------------
  476|       |        // Try to find a Root dictionary. As a quick fix try the one with the highest object id.
  477|  18.2k|        QPDFObjectHandle root;
  478|   164k|        for (auto const& iter: m->obj_cache) {
  ------------------
  |  Branch (478:30): [True: 164k, False: 18.2k]
  ------------------
  479|   164k|            try {
  480|   164k|                if (QPDFObjectHandle(iter.second.object).isDictionaryOfType("/Catalog")) {
  ------------------
  |  Branch (480:21): [True: 7.22k, False: 156k]
  ------------------
  481|  7.22k|                    root = iter.second.object;
  482|  7.22k|                }
  483|   164k|            } catch (std::exception&) {
  484|  4.53k|                continue;
  485|  4.53k|            }
  486|   164k|        }
  487|  18.2k|        if (root) {
  ------------------
  |  Branch (487:13): [True: 6.93k, False: 11.3k]
  ------------------
  488|  6.93k|            if (!m->trailer) {
  ------------------
  |  Branch (488:17): [True: 5.78k, False: 1.15k]
  ------------------
  489|  5.78k|                warn(damagedPDF(
  490|  5.78k|                    "", -1, "unable to find trailer dictionary while recovering damaged file"));
  491|  5.78k|                m->trailer = QPDFObjectHandle::newDictionary();
  492|  5.78k|            }
  493|  6.93k|            m->trailer.replaceKey("/Root", root);
  494|  6.93k|        }
  495|  18.2k|    }
  496|       |
  497|  20.9k|    if (!m->trailer) {
  ------------------
  |  Branch (497:9): [True: 6.83k, False: 14.1k]
  ------------------
  498|       |        // We could check the last encountered object to see if it was an xref stream.  If so, we
  499|       |        // could try to get the trailer from there.  This may make it possible to recover files with
  500|       |        // bad startxref pointers even when they have object streams.
  501|       |
  502|  6.83k|        throw damagedPDF("", -1, "unable to find trailer dictionary while recovering damaged file");
  503|  6.83k|    }
  504|  14.1k|    if (m->xref_table.empty()) {
  ------------------
  |  Branch (504:9): [True: 273, False: 13.8k]
  ------------------
  505|       |        // We cannot check for an empty xref table in parse because empty tables are valid when
  506|       |        // creating QPDF objects from JSON.
  507|    273|        throw damagedPDF("", -1, "unable to find objects while recovering damaged file");
  508|    273|    }
  509|  13.8k|    check_warnings();
  510|  13.8k|    if (!m->parsed) {
  ------------------
  |  Branch (510:9): [True: 13.6k, False: 144]
  ------------------
  511|  13.6k|        m->parsed = !m->pages.empty();
  512|  13.6k|        if (!m->parsed) {
  ------------------
  |  Branch (512:13): [True: 627, False: 13.0k]
  ------------------
  513|    627|            throw damagedPDF("", -1, "unable to find any pages while recovering damaged file");
  514|    627|        }
  515|  13.0k|        check_warnings();
  516|  13.0k|    }
  517|       |
  518|       |    // We could iterate through the objects looking for streams and try to find objects inside of
  519|       |    // them, but it's probably not worth the trouble.  Acrobat can't recover files with any errors
  520|       |    // in an xref stream, and this would be a real long shot anyway.  If we wanted to do anything
  521|       |    // that involved looking at stream contents, we'd also have to call initializeEncryption() here.
  522|       |    // It's safe to call it more than once.
  523|  13.8k|}
_ZN4QPDF3Doc7Objects9read_xrefExb:
  527|  10.4k|{
  528|  10.4k|    std::map<int, int> free_table;
  529|  10.4k|    std::set<qpdf_offset_t> visited;
  530|  21.6k|    while (xref_offset) {
  ------------------
  |  Branch (530:12): [True: 11.4k, False: 10.1k]
  ------------------
  531|  11.4k|        visited.insert(xref_offset);
  532|  11.4k|        char buf[7];
  533|  11.4k|        memset(buf, 0, sizeof(buf));
  534|  11.4k|        m->file->seek(xref_offset, SEEK_SET);
  535|       |        // Some files miss the mark a little with startxref. We could do a better job of searching
  536|       |        // in the neighborhood for something that looks like either an xref table or stream, but the
  537|       |        // simple heuristic of skipping whitespace can help with the xref table case and is harmless
  538|       |        // with the stream case.
  539|  11.4k|        bool done = false;
  540|  11.4k|        bool skipped_space = false;
  541|  25.9k|        while (!done) {
  ------------------
  |  Branch (541:16): [True: 14.4k, False: 11.4k]
  ------------------
  542|  14.4k|            char ch;
  543|  14.4k|            if (1 == m->file->read(&ch, 1)) {
  ------------------
  |  Branch (543:17): [True: 13.8k, False: 645]
  ------------------
  544|  13.8k|                if (util::is_space(ch)) {
  ------------------
  |  Branch (544:21): [True: 3.41k, False: 10.4k]
  ------------------
  545|  3.41k|                    skipped_space = true;
  546|  10.4k|                } else {
  547|  10.4k|                    m->file->unreadCh(ch);
  548|  10.4k|                    done = true;
  549|  10.4k|                }
  550|  13.8k|            } else {
  551|    645|                QTC::TC("qpdf", "QPDF eof skipping spaces before xref", skipped_space ? 0 : 1);
  ------------------
  |  Branch (551:73): [True: 2, False: 643]
  ------------------
  552|    645|                done = true;
  553|    645|            }
  554|  14.4k|        }
  555|       |
  556|  11.4k|        m->file->read(buf, sizeof(buf) - 1);
  557|       |        // The PDF spec says xref must be followed by a line terminator, but files exist in the wild
  558|       |        // where it is terminated by arbitrary whitespace.
  559|  11.4k|        if ((strncmp(buf, "xref", 4) == 0) && util::is_space(buf[4])) {
  ------------------
  |  Branch (559:13): [True: 2.36k, False: 9.08k]
  |  Branch (559:47): [True: 2.34k, False: 16]
  ------------------
  560|  2.34k|            if (skipped_space) {
  ------------------
  |  Branch (560:17): [True: 153, False: 2.19k]
  ------------------
  561|    153|                warn(damagedPDF("", -1, "extraneous whitespace seen before xref"));
  562|    153|            }
  563|  2.34k|            QTC::TC(
  564|  2.34k|                "qpdf",
  565|  2.34k|                "QPDF xref space",
  566|  2.34k|                ((buf[4] == '\n')       ? 0
  ------------------
  |  Branch (566:18): [True: 632, False: 1.71k]
  ------------------
  567|  2.34k|                     : (buf[4] == '\r') ? 1
  ------------------
  |  Branch (567:24): [True: 1.17k, False: 547]
  ------------------
  568|  1.71k|                     : (buf[4] == ' ')  ? 2
  ------------------
  |  Branch (568:24): [True: 210, False: 337]
  ------------------
  569|    547|                                        : 9999));
  570|  2.34k|            int skip = 4;
  571|       |            // buf is null-terminated, and util::is_space('\0') is false, so this won't overrun.
  572|  4.93k|            while (util::is_space(buf[skip])) {
  ------------------
  |  Branch (572:20): [True: 2.58k, False: 2.34k]
  ------------------
  573|  2.58k|                ++skip;
  574|  2.58k|            }
  575|  2.34k|            xref_offset = read_xrefTable(xref_offset + skip);
  576|  9.09k|        } else {
  577|  9.09k|            xref_offset = read_xrefStream(xref_offset, in_stream_recovery);
  578|  9.09k|        }
  579|  11.4k|        if (visited.contains(xref_offset)) {
  ------------------
  |  Branch (579:13): [True: 263, False: 11.1k]
  ------------------
  580|    263|            throw damagedPDF("", -1, "loop detected following xref tables");
  581|    263|        }
  582|  11.4k|    }
  583|       |
  584|  10.1k|    if (!m->trailer) {
  ------------------
  |  Branch (584:9): [True: 0, False: 10.1k]
  ------------------
  585|      0|        throw damagedPDF("", -1, "unable to find trailer while reading xref");
  586|      0|    }
  587|  10.1k|    int size = m->trailer.getKey("/Size").getIntValueAsInt();
  588|  10.1k|    int max_obj = 0;
  589|  10.1k|    if (!m->xref_table.empty()) {
  ------------------
  |  Branch (589:9): [True: 2.72k, False: 7.44k]
  ------------------
  590|  2.72k|        max_obj = m->xref_table.rbegin()->first.getObj();
  591|  2.72k|    }
  592|  10.1k|    if (!m->deleted_objects.empty()) {
  ------------------
  |  Branch (592:9): [True: 983, False: 9.18k]
  ------------------
  593|    983|        max_obj = std::max(max_obj, *(m->deleted_objects.rbegin()));
  594|    983|    }
  595|  10.1k|    if (size < 1 || (size - 1) != max_obj) {
  ------------------
  |  Branch (595:9): [True: 7.01k, False: 3.15k]
  |  Branch (595:21): [True: 2.14k, False: 1.00k]
  ------------------
  596|  2.63k|        if (size == (max_obj + 2) && qpdf.getObject(max_obj + 1, 0).isStreamOfType("/XRef")) {
  ------------------
  |  Branch (596:13): [True: 365, False: 2.27k]
  |  Branch (596:13): [True: 3, False: 2.63k]
  |  Branch (596:38): [True: 3, False: 362]
  ------------------
  597|      3|            warn(damagedPDF(
  598|      3|                "",
  599|      3|                -1,
  600|      3|                "xref entry for the xref stream itself is missing - a common error handled "
  601|      3|                "correctly by qpdf and most other applications"));
  602|  2.63k|        } else {
  603|  2.63k|            warn(damagedPDF(
  604|  2.63k|                "",
  605|  2.63k|                -1,
  606|  2.63k|                ("reported number of objects (" + std::to_string(size) +
  607|  2.63k|                 ") is not one plus the highest object number (" + std::to_string(max_obj) + ")")));
  608|  2.63k|        }
  609|  2.63k|    }
  610|       |
  611|       |    // We no longer need the deleted_objects table, so go ahead and clear it out to make sure we
  612|       |    // never depend on its being set.
  613|  10.1k|    m->deleted_objects.clear();
  614|       |
  615|       |    // Make sure we keep only the highest generation for any object.
  616|  10.1k|    QPDFObjGen last_og{-1, 0};
  617|   911k|    for (auto const& item: m->xref_table) {
  ------------------
  |  Branch (617:26): [True: 911k, False: 10.1k]
  ------------------
  618|   911k|        auto id = item.first.getObj();
  619|   911k|        if (id == last_og.getObj() && id > 0) {
  ------------------
  |  Branch (619:13): [True: 5.97k, False: 905k]
  |  Branch (619:39): [True: 5.97k, False: 0]
  ------------------
  620|  5.97k|            qpdf.removeObject(last_og);
  621|  5.97k|        }
  622|   911k|        last_og = item.first;
  623|   911k|    }
  624|  10.1k|}
_ZN4QPDF3Doc7Objects15parse_xrefFirstERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERiSB_SB_:
  628|  8.60k|{
  629|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  630|       |    // buffer.
  631|  8.60k|    char const* p = line.c_str();
  632|  8.60k|    char const* start = line.c_str();
  633|       |
  634|       |    // Skip zero or more spaces
  635|  10.4k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (635:12): [True: 1.83k, False: 8.60k]
  ------------------
  636|  1.83k|        ++p;
  637|  1.83k|    }
  638|       |    // Require digit
  639|  8.60k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (639:9): [True: 218, False: 8.38k]
  ------------------
  640|    218|        return false;
  641|    218|    }
  642|       |    // Gather digits
  643|  8.38k|    std::string obj_str;
  644|  30.3k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (644:12): [True: 21.9k, False: 8.38k]
  ------------------
  645|  21.9k|        obj_str.append(1, *p++);
  646|  21.9k|    }
  647|       |    // Require space
  648|  8.38k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (648:9): [True: 105, False: 8.27k]
  ------------------
  649|    105|        return false;
  650|    105|    }
  651|       |    // Skip spaces
  652|  20.9k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (652:12): [True: 12.6k, False: 8.27k]
  ------------------
  653|  12.6k|        ++p;
  654|  12.6k|    }
  655|       |    // Require digit
  656|  8.27k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (656:9): [True: 101, False: 8.17k]
  ------------------
  657|    101|        return false;
  658|    101|    }
  659|       |    // Gather digits
  660|  8.17k|    std::string num_str;
  661|  27.8k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (661:12): [True: 19.6k, False: 8.17k]
  ------------------
  662|  19.6k|        num_str.append(1, *p++);
  663|  19.6k|    }
  664|       |    // Skip any space including line terminators
  665|  18.7k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (665:12): [True: 10.5k, False: 8.17k]
  ------------------
  666|  10.5k|        ++p;
  667|  10.5k|    }
  668|  8.17k|    bytes = toI(p - start);
  669|  8.17k|    obj = QUtil::string_to_int(obj_str.c_str());
  670|  8.17k|    num = QUtil::string_to_int(num_str.c_str());
  671|  8.17k|    return true;
  672|  8.27k|}
_ZN4QPDF3Doc7Objects18read_bad_xrefEntryERxRiRc:
  676|  7.10k|{
  677|       |    // Reposition after initial read attempt and reread.
  678|  7.10k|    m->file->seek(m->file->getLastOffset(), SEEK_SET);
  679|  7.10k|    auto line = m->file->readLine(30);
  680|       |
  681|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  682|       |    // buffer.
  683|  7.10k|    char const* p = line.data();
  684|       |
  685|       |    // Skip zero or more spaces. There aren't supposed to be any.
  686|  7.10k|    bool invalid = false;
  687|  7.81k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (687:12): [True: 708, False: 7.10k]
  ------------------
  688|    708|        ++p;
  689|    708|        invalid = true;
  690|    708|    }
  691|       |    // Require digit
  692|  7.10k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (692:9): [True: 28, False: 7.07k]
  ------------------
  693|     28|        return false;
  694|     28|    }
  695|       |    // Gather digits
  696|  7.07k|    std::string f1_str;
  697|  40.7k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (697:12): [True: 33.6k, False: 7.07k]
  ------------------
  698|  33.6k|        f1_str.append(1, *p++);
  699|  33.6k|    }
  700|       |    // Require space
  701|  7.07k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (701:9): [True: 46, False: 7.03k]
  ------------------
  702|     46|        return false;
  703|     46|    }
  704|  7.03k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (704:9): [True: 582, False: 6.45k]
  ------------------
  705|    582|        invalid = true;
  706|    582|    }
  707|       |    // Skip spaces
  708|  15.2k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (708:12): [True: 8.22k, False: 7.03k]
  ------------------
  709|  8.22k|        ++p;
  710|  8.22k|    }
  711|       |    // Require digit
  712|  7.03k|    if (!util::is_digit(*p)) {
  ------------------
  |  Branch (712:9): [True: 77, False: 6.95k]
  ------------------
  713|     77|        return false;
  714|     77|    }
  715|       |    // Gather digits
  716|  6.95k|    std::string f2_str;
  717|  28.1k|    while (util::is_digit(*p)) {
  ------------------
  |  Branch (717:12): [True: 21.2k, False: 6.95k]
  ------------------
  718|  21.2k|        f2_str.append(1, *p++);
  719|  21.2k|    }
  720|       |    // Require space
  721|  6.95k|    if (!util::is_space(*p)) {
  ------------------
  |  Branch (721:9): [True: 59, False: 6.89k]
  ------------------
  722|     59|        return false;
  723|     59|    }
  724|  6.89k|    if (util::is_space(*(p + 1))) {
  ------------------
  |  Branch (724:9): [True: 795, False: 6.10k]
  ------------------
  725|    795|        invalid = true;
  726|    795|    }
  727|       |    // Skip spaces
  728|  14.7k|    while (util::is_space(*p)) {
  ------------------
  |  Branch (728:12): [True: 7.85k, False: 6.89k]
  ------------------
  729|  7.85k|        ++p;
  730|  7.85k|    }
  731|  6.89k|    if ((*p == 'f') || (*p == 'n')) {
  ------------------
  |  Branch (731:9): [True: 1.46k, False: 5.43k]
  |  Branch (731:24): [True: 5.35k, False: 71]
  ------------------
  732|  6.82k|        type = *p;
  733|  6.82k|    } else {
  734|     71|        return false;
  735|     71|    }
  736|  6.82k|    if ((f1_str.length() != 10) || (f2_str.length() != 5)) {
  ------------------
  |  Branch (736:9): [True: 5.15k, False: 1.67k]
  |  Branch (736:36): [True: 1.20k, False: 466]
  ------------------
  737|  6.35k|        invalid = true;
  738|  6.35k|    }
  739|       |
  740|  6.82k|    if (invalid) {
  ------------------
  |  Branch (740:9): [True: 6.37k, False: 447]
  ------------------
  741|  6.37k|        warn(damagedPDF("xref table", "accepting invalid xref table entry"));
  742|  6.37k|    }
  743|       |
  744|  6.82k|    f1 = QUtil::string_to_ll(f1_str.c_str());
  745|  6.82k|    f2 = QUtil::string_to_int(f2_str.c_str());
  746|       |
  747|  6.82k|    return true;
  748|  6.89k|}
_ZN4QPDF3Doc7Objects14read_xrefEntryERxRiRc:
  754|  22.4k|{
  755|  22.4k|    std::array<char, 21> line;
  756|  22.4k|    if (m->file->read(line.data(), 20) != 20) {
  ------------------
  |  Branch (756:9): [True: 237, False: 22.1k]
  ------------------
  757|       |        // C++20: [[unlikely]]
  758|    237|        return false;
  759|    237|    }
  760|  22.1k|    line[20] = '\0';
  761|  22.1k|    char const* p = line.data();
  762|       |
  763|  22.1k|    int f1_len = 0;
  764|  22.1k|    int f2_len = 0;
  765|       |
  766|       |    // is_space and is_digit both return false on '\0', so this will not overrun the null-terminated
  767|       |    // buffer.
  768|       |
  769|       |    // Gather f1 digits. NB No risk of overflow as 9'999'999'999 < max long long.
  770|   121k|    while (*p == '0') {
  ------------------
  |  Branch (770:12): [True: 99.6k, False: 22.1k]
  ------------------
  771|  99.6k|        ++f1_len;
  772|  99.6k|        ++p;
  773|  99.6k|    }
  774|   100k|    while (util::is_digit(*p) && f1_len++ < 10) {
  ------------------
  |  Branch (774:12): [True: 78.3k, False: 22.1k]
  |  Branch (774:34): [True: 78.3k, False: 7]
  ------------------
  775|  78.3k|        f1 *= 10;
  776|  78.3k|        f1 += *p++ - '0';
  777|  78.3k|    }
  778|       |    // Require space
  779|  22.1k|    if (!util::is_space(*p++)) {
  ------------------
  |  Branch (779:9): [True: 91, False: 22.0k]
  ------------------
  780|       |        // Entry doesn't start with space or digit.
  781|       |        // C++20: [[unlikely]]
  782|     91|        return false;
  783|     91|    }
  784|       |    // Gather digits. NB No risk of overflow as 99'999 < max int.
  785|  97.9k|    while (*p == '0') {
  ------------------
  |  Branch (785:12): [True: 75.8k, False: 22.0k]
  ------------------
  786|  75.8k|        ++f2_len;
  787|  75.8k|        ++p;
  788|  75.8k|    }
  789|  42.7k|    while (util::is_digit(*p) && f2_len++ < 5) {
  ------------------
  |  Branch (789:12): [True: 21.1k, False: 21.6k]
  |  Branch (789:34): [True: 20.6k, False: 447]
  ------------------
  790|  20.6k|        f2 *= 10;
  791|  20.6k|        f2 += static_cast<int>(*p++ - '0');
  792|  20.6k|    }
  793|  22.0k|    if (util::is_space(*p++) && (*p == 'f' || *p == 'n')) {
  ------------------
  |  Branch (793:9): [True: 21.3k, False: 751]
  |  Branch (793:34): [True: 3.78k, False: 17.5k]
  |  Branch (793:47): [True: 16.2k, False: 1.34k]
  ------------------
  794|       |        // C++20: [[likely]]
  795|  19.9k|        type = *p;
  796|       |        // No test for valid line[19].
  797|  19.9k|        if (*(++p) && *(++p) && (*p == '\n' || *p == '\r') && f1_len == 10 && f2_len == 5) {
  ------------------
  |  Branch (797:13): [True: 19.9k, False: 82]
  |  Branch (797:23): [True: 19.5k, False: 363]
  |  Branch (797:34): [True: 17.3k, False: 2.18k]
  |  Branch (797:48): [True: 455, False: 1.72k]
  |  Branch (797:63): [True: 15.9k, False: 1.82k]
  |  Branch (797:79): [True: 14.9k, False: 1.01k]
  ------------------
  798|       |            // C++20: [[likely]]
  799|  14.9k|            return true;
  800|  14.9k|        }
  801|  19.9k|    }
  802|  7.10k|    return read_bad_xrefEntry(f1, f2, type);
  803|  22.0k|}
_ZN4QPDF3Doc7Objects14read_xrefTableEx:
  808|  2.34k|{
  809|  2.34k|    m->file->seek(xref_offset, SEEK_SET);
  810|  2.34k|    std::string line;
  811|  8.62k|    while (true) {
  ------------------
  |  Branch (811:12): [True: 8.60k, Folded]
  ------------------
  812|  8.60k|        line.assign(50, '\0');
  813|  8.60k|        m->file->read(line.data(), line.size());
  814|  8.60k|        int obj = 0;
  815|  8.60k|        int num = 0;
  816|  8.60k|        int bytes = 0;
  817|  8.60k|        if (!parse_xrefFirst(line, obj, num, bytes)) {
  ------------------
  |  Branch (817:13): [True: 424, False: 8.17k]
  ------------------
  818|    424|            throw damagedPDF("xref table", "xref syntax invalid");
  819|    424|        }
  820|  8.17k|        m->file->seek(m->file->getLastOffset() + bytes, SEEK_SET);
  821|  29.9k|        for (qpdf_offset_t i = obj; i - num < obj; ++i) {
  ------------------
  |  Branch (821:37): [True: 22.4k, False: 7.56k]
  ------------------
  822|  22.4k|            if (i == 0) {
  ------------------
  |  Branch (822:17): [True: 679, False: 21.7k]
  ------------------
  823|       |                // This is needed by checkLinearization()
  824|    679|                first_xref_item_offset_ = m->file->tell();
  825|    679|            }
  826|       |            // For xref_table, these will always be small enough to be ints
  827|  22.4k|            qpdf_offset_t f1 = 0;
  828|  22.4k|            int f2 = 0;
  829|  22.4k|            char type = '\0';
  830|  22.4k|            if (!read_xrefEntry(f1, f2, type)) {
  ------------------
  |  Branch (830:17): [True: 609, False: 21.8k]
  ------------------
  831|    609|                throw damagedPDF(
  832|    609|                    "xref table", "invalid xref entry (obj=" + std::to_string(i) + ")");
  833|    609|            }
  834|  21.8k|            if (type == 'f') {
  ------------------
  |  Branch (834:17): [True: 4.23k, False: 17.5k]
  ------------------
  835|  4.23k|                insertFreeXrefEntry(QPDFObjGen(toI(i), f2));
  836|  17.5k|            } else {
  837|  17.5k|                insertXrefEntry(toI(i), 1, f1, f2);
  838|  17.5k|            }
  839|  21.8k|        }
  840|  7.56k|        qpdf_offset_t pos = m->file->tell();
  841|  7.56k|        if (readToken(*m->file).isWord("trailer")) {
  ------------------
  |  Branch (841:13): [True: 1.28k, False: 6.28k]
  ------------------
  842|  1.28k|            break;
  843|  6.28k|        } else {
  844|  6.28k|            m->file->seek(pos, SEEK_SET);
  845|  6.28k|        }
  846|  7.56k|    }
  847|       |
  848|       |    // Set offset to previous xref table if any
  849|  1.31k|    QPDFObjectHandle cur_trailer = m->objects.readTrailer();
  850|  1.31k|    if (!cur_trailer.isDictionary()) {
  ------------------
  |  Branch (850:9): [True: 74, False: 1.24k]
  ------------------
  851|     74|        throw damagedPDF("", "expected trailer dictionary");
  852|     74|    }
  853|       |
  854|  1.24k|    if (!m->trailer) {
  ------------------
  |  Branch (854:9): [True: 1.16k, False: 79]
  ------------------
  855|  1.16k|        setTrailer(cur_trailer);
  856|       |
  857|  1.16k|        if (!m->trailer.hasKey("/Size")) {
  ------------------
  |  Branch (857:13): [True: 131, False: 1.03k]
  ------------------
  858|    131|            throw damagedPDF("trailer", "trailer dictionary lacks /Size key");
  859|    131|        }
  860|  1.03k|        if (!m->trailer.getKey("/Size").isInteger()) {
  ------------------
  |  Branch (860:13): [True: 2, False: 1.02k]
  ------------------
  861|      2|            throw damagedPDF("trailer", "/Size key in trailer dictionary is not an integer");
  862|      2|        }
  863|  1.03k|    }
  864|       |
  865|  1.10k|    if (cur_trailer.hasKey("/XRefStm")) {
  ------------------
  |  Branch (865:9): [True: 27, False: 1.08k]
  ------------------
  866|     27|        if (cf.ignore_xref_streams()) {
  ------------------
  |  Branch (866:13): [True: 0, False: 27]
  ------------------
  867|      0|            QTC::TC("qpdf", "QPDF ignoring XRefStm in trailer");
  868|     27|        } else {
  869|     27|            if (cur_trailer.getKey("/XRefStm").isInteger()) {
  ------------------
  |  Branch (869:17): [True: 26, False: 1]
  ------------------
  870|       |                // Read the xref stream but disregard any return value -- we'll use our trailer's
  871|       |                // /Prev key instead of the xref stream's.
  872|     26|                (void)read_xrefStream(cur_trailer.getKey("/XRefStm").getIntValue());
  873|     26|            } else {
  874|      1|                throw damagedPDF("xref stream", xref_offset, "invalid /XRefStm");
  875|      1|            }
  876|     27|        }
  877|     27|    }
  878|       |
  879|  1.10k|    if (cur_trailer.hasKey("/Prev")) {
  ------------------
  |  Branch (879:9): [True: 183, False: 924]
  ------------------
  880|    183|        if (!cur_trailer.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (880:13): [True: 2, False: 181]
  ------------------
  881|      2|            throw damagedPDF("trailer", "/Prev key in trailer dictionary is not an integer");
  882|      2|        }
  883|    181|        return cur_trailer.getKey("/Prev").getIntValue();
  884|    183|    }
  885|       |
  886|    924|    return 0;
  887|  1.10k|}
_ZN4QPDF3Doc7Objects15read_xrefStreamExb:
  892|  8.75k|{
  893|  8.75k|    if (!cf.ignore_xref_streams()) {
  ------------------
  |  Branch (893:9): [True: 8.75k, False: 0]
  ------------------
  894|  8.75k|        QPDFObjectHandle xref_obj;
  895|  8.75k|        try {
  896|  8.75k|            m->in_read_xref_stream = true;
  897|  8.75k|            xref_obj = readObjectAtOffset(xref_offset, "xref stream", true);
  898|  8.75k|        } catch (QPDFExc&) {
  899|       |            // ignore -- report error below
  900|  1.46k|        }
  901|  8.75k|        m->in_read_xref_stream = false;
  902|  8.69k|        if (xref_obj.isStreamOfType("/XRef")) {
  ------------------
  |  Branch (902:13): [True: 7.08k, False: 1.60k]
  ------------------
  903|  7.08k|            return processXRefStream(xref_offset, xref_obj, in_stream_recovery);
  904|  7.08k|        }
  905|  8.69k|    }
  906|       |
  907|  1.60k|    throw damagedPDF("", xref_offset, "xref not found");
  908|      0|    return 0; // unreachable
  909|  8.75k|}
_ZN4QPDF3Doc7Objects12processXRefWER16QPDFObjectHandleNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  914|  7.08k|{
  915|  7.08k|    auto W_obj = dict.getKey("/W");
  916|  7.08k|    if (!(W_obj.size() >= 3 && W_obj.getArrayItem(0).isInteger() &&
  ------------------
  |  Branch (916:9): [True: 242, False: 6.84k]
  |  Branch (916:11): [True: 6.88k, False: 202]
  |  Branch (916:32): [True: 6.87k, False: 12]
  ------------------
  917|  6.87k|          W_obj.getArrayItem(1).isInteger() && W_obj.getArrayItem(2).isInteger())) {
  ------------------
  |  Branch (917:11): [True: 6.85k, False: 13]
  |  Branch (917:48): [True: 6.84k, False: 15]
  ------------------
  918|    242|        throw damaged("Cross-reference stream does not have a proper /W key");
  919|    242|    }
  920|       |
  921|  6.84k|    std::array<int, 3> W;
  922|  6.84k|    int entry_size = 0;
  923|  6.84k|    auto w_vector = W_obj.getArrayAsVector();
  924|  6.84k|    int max_bytes = sizeof(qpdf_offset_t);
  925|  27.2k|    for (size_t i = 0; i < 3; ++i) {
  ------------------
  |  Branch (925:24): [True: 20.4k, False: 6.78k]
  ------------------
  926|  20.4k|        W[i] = w_vector[i].getIntValueAsInt();
  927|  20.4k|        if (W[i] > max_bytes) {
  ------------------
  |  Branch (927:13): [True: 11, False: 20.4k]
  ------------------
  928|     11|            throw damaged("Cross-reference stream's /W contains impossibly large values");
  929|     11|        }
  930|  20.4k|        if (W[i] < 0) {
  ------------------
  |  Branch (930:13): [True: 49, False: 20.3k]
  ------------------
  931|     49|            throw damaged("Cross-reference stream's /W contains negative values");
  932|     49|        }
  933|  20.3k|        entry_size += W[i];
  934|  20.3k|    }
  935|  6.78k|    if (entry_size == 0) {
  ------------------
  |  Branch (935:9): [True: 6, False: 6.77k]
  ------------------
  936|      6|        throw damaged("Cross-reference stream's /W indicates entry size of 0");
  937|      6|    }
  938|  6.77k|    return {entry_size, W};
  939|  6.78k|}
_ZN4QPDF3Doc7Objects15processXRefSizeER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  945|  6.77k|{
  946|       |    // Number of entries is limited by the highest possible object id and stream size.
  947|  6.77k|    auto max_num_entries = std::numeric_limits<int>::max();
  948|  6.77k|    if (max_num_entries > (std::numeric_limits<qpdf_offset_t>::max() / entry_size)) {
  ------------------
  |  Branch (948:9): [True: 0, False: 6.77k]
  ------------------
  949|      0|        max_num_entries = toI(std::numeric_limits<qpdf_offset_t>::max() / entry_size);
  950|      0|    }
  951|       |
  952|  6.77k|    auto Size_obj = dict.getKey("/Size");
  953|  6.77k|    long long size;
  954|  6.77k|    if (!dict.getKey("/Size").getValueAsInt(size)) {
  ------------------
  |  Branch (954:9): [True: 52, False: 6.72k]
  ------------------
  955|     52|        throw damaged("Cross-reference stream does not have a proper /Size key");
  956|  6.72k|    } else if (size < 0) {
  ------------------
  |  Branch (956:16): [True: 65, False: 6.65k]
  ------------------
  957|     65|        throw damaged("Cross-reference stream has a negative /Size key");
  958|  6.65k|    } else if (size >= max_num_entries) {
  ------------------
  |  Branch (958:16): [True: 79, False: 6.57k]
  ------------------
  959|     79|        throw damaged("Cross-reference stream has an impossibly large /Size key");
  960|     79|    }
  961|       |    // We are not validating that Size <= (Size key of parent xref / trailer).
  962|  6.57k|    return max_num_entries;
  963|  6.77k|}
_ZN4QPDF3Doc7Objects16processXRefIndexER16QPDFObjectHandleiNSt3__18functionIF7QPDFExcNS4_17basic_string_viewIcNS4_11char_traitsIcEEEEEEE:
  969|  6.57k|{
  970|  6.57k|    auto size = dict.getKey("/Size").getIntValueAsInt();
  971|  6.57k|    auto Index_obj = dict.getKey("/Index");
  972|       |
  973|  6.57k|    if (Index_obj.isArray()) {
  ------------------
  |  Branch (973:9): [True: 966, False: 5.61k]
  ------------------
  974|    966|        std::vector<std::pair<int, int>> indx;
  975|    966|        int num_entries = 0;
  976|    966|        auto index_vec = Index_obj.getArrayAsVector();
  977|    966|        if ((index_vec.size() % 2) || index_vec.size() < 2) {
  ------------------
  |  Branch (977:13): [True: 4, False: 962]
  |  Branch (977:39): [True: 3, False: 959]
  ------------------
  978|      7|            throw damaged("Cross-reference stream's /Index has an invalid number of values");
  979|      7|        }
  980|       |
  981|    959|        int i = 0;
  982|    959|        long long first = 0;
  983|  9.18k|        for (auto& val: index_vec) {
  ------------------
  |  Branch (983:23): [True: 9.18k, False: 800]
  ------------------
  984|  9.18k|            if (val.isInteger()) {
  ------------------
  |  Branch (984:17): [True: 9.18k, False: 6]
  ------------------
  985|  9.18k|                if (i % 2) {
  ------------------
  |  Branch (985:21): [True: 4.56k, False: 4.61k]
  ------------------
  986|  4.56k|                    auto count = val.getIntValue();
  987|  4.56k|                    if (count <= 0) {
  ------------------
  |  Branch (987:25): [True: 53, False: 4.51k]
  ------------------
  988|     53|                        throw damaged(
  989|     53|                            "Cross-reference stream section claims to contain " +
  990|     53|                            std::to_string(count) + " entries");
  991|     53|                    }
  992|       |                    // We are guarding against the possibility of num_entries * entry_size
  993|       |                    // overflowing. We are not checking that entries are in ascending order as
  994|       |                    // required by the spec, which probably should generate a warning. We are also
  995|       |                    // not checking that for each subsection first object number + number of entries
  996|       |                    // <= /Size. The spec requires us to ignore object number > /Size.
  997|  4.51k|                    if (first > (max_num_entries - count) ||
  ------------------
  |  Branch (997:25): [True: 48, False: 4.46k]
  ------------------
  998|  4.46k|                        count > (max_num_entries - num_entries)) {
  ------------------
  |  Branch (998:25): [True: 3, False: 4.46k]
  ------------------
  999|     51|                        throw damaged(
 1000|     51|                            "Cross-reference stream claims to contain too many entries: " +
 1001|     51|                            std::to_string(first) + " " + std::to_string(max_num_entries) + " " +
 1002|     51|                            std::to_string(num_entries));
 1003|     51|                    }
 1004|  4.46k|                    indx.emplace_back(static_cast<int>(first), static_cast<int>(count));
 1005|  4.46k|                    num_entries += static_cast<int>(count);
 1006|  4.61k|                } else {
 1007|  4.61k|                    first = val.getIntValue();
 1008|  4.61k|                    if (first < 0) {
  ------------------
  |  Branch (1008:25): [True: 46, False: 4.57k]
  ------------------
 1009|     46|                        throw damaged(
 1010|     46|                            "Cross-reference stream's /Index contains a negative object id");
 1011|  4.57k|                    } else if (first > max_num_entries) {
  ------------------
  |  Branch (1011:32): [True: 3, False: 4.56k]
  ------------------
 1012|      3|                        throw damaged(
 1013|      3|                            "Cross-reference stream's /Index contains an impossibly "
 1014|      3|                            "large object id");
 1015|      3|                    }
 1016|  4.61k|                }
 1017|  9.18k|            } else {
 1018|      6|                throw damaged(
 1019|      6|                    "Cross-reference stream's /Index's item " + std::to_string(i) +
 1020|      6|                    " is not an integer");
 1021|      6|            }
 1022|  9.02k|            i++;
 1023|  9.02k|        }
 1024|    800|        QTC::TC("qpdf", "QPDF xref /Index is array", index_vec.size() == 2 ? 0 : 1);
  ------------------
  |  Branch (1024:54): [True: 564, False: 236]
  ------------------
 1025|    800|        return {num_entries, indx};
 1026|  5.61k|    } else if (Index_obj.null()) {
  ------------------
  |  Branch (1026:16): [True: 5.61k, False: 3]
  ------------------
 1027|  5.61k|        return {size, {{0, size}}};
 1028|  5.61k|    } else {
 1029|      3|        throw damaged("Cross-reference stream does not have a proper /Index key");
 1030|      3|    }
 1031|  6.57k|}
_ZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandleb:
 1036|  7.08k|{
 1037|  7.08k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  7.08k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  7.08k|    };
 1040|       |
 1041|  7.08k|    auto dict = xref_obj.getDict();
 1042|       |
 1043|  7.08k|    auto [entry_size, W] = processXRefW(dict, damaged);
 1044|  7.08k|    int max_num_entries = processXRefSize(dict, entry_size, damaged);
 1045|  7.08k|    auto [num_entries, indx] = processXRefIndex(dict, max_num_entries, damaged);
 1046|       |
 1047|  7.08k|    std::shared_ptr<Buffer> bp = xref_obj.getStreamData(qpdf_dl_specialized);
 1048|  7.08k|    size_t actual_size = bp->getSize();
 1049|  7.08k|    auto expected_size = toS(entry_size) * toS(num_entries);
 1050|       |
 1051|  7.08k|    if (expected_size != actual_size) {
  ------------------
  |  Branch (1051:9): [True: 4.10k, False: 2.97k]
  ------------------
 1052|  4.10k|        QPDFExc x = damaged(
 1053|  4.10k|            "Cross-reference stream data has the wrong size; expected = " +
 1054|  4.10k|            std::to_string(expected_size) + "; actual = " + std::to_string(actual_size));
 1055|  4.10k|        if (expected_size > actual_size) {
  ------------------
  |  Branch (1055:13): [True: 729, False: 3.37k]
  ------------------
 1056|    729|            throw x;
 1057|  3.37k|        } else {
 1058|  3.37k|            warn(x);
 1059|  3.37k|        }
 1060|  4.10k|    }
 1061|       |
 1062|  6.35k|    bool saw_first_compressed_object = false;
 1063|       |
 1064|       |    // Actual size vs. expected size check above ensures that we will not overflow any buffers here.
 1065|       |    // We know that entry_size * num_entries is less or equal to the size of the buffer.
 1066|  6.35k|    auto p = bp->getBuffer();
 1067|  6.76k|    for (auto [obj, sec_entries]: indx) {
  ------------------
  |  Branch (1067:33): [True: 6.76k, False: 6.35k]
  ------------------
 1068|       |        // Process a subsection.
 1069|  3.03M|        for (int i = 0; i < sec_entries; ++i) {
  ------------------
  |  Branch (1069:25): [True: 3.02M, False: 6.76k]
  ------------------
 1070|       |            // Read this entry
 1071|  3.02M|            std::array<qpdf_offset_t, 3> fields{};
 1072|  3.02M|            if (W[0] == 0) {
  ------------------
  |  Branch (1072:17): [True: 167k, False: 2.85M]
  ------------------
 1073|   167k|                fields[0] = 1;
 1074|   167k|            }
 1075|  12.1M|            for (size_t j = 0; j < 3; ++j) {
  ------------------
  |  Branch (1075:32): [True: 9.08M, False: 3.02M]
  ------------------
 1076|  20.7M|                for (int k = 0; k < W[j]; ++k) {
  ------------------
  |  Branch (1076:33): [True: 11.6M, False: 9.08M]
  ------------------
 1077|  11.6M|                    fields[j] <<= 8;
 1078|  11.6M|                    fields[j] |= *p++;
 1079|  11.6M|                }
 1080|  9.08M|            }
 1081|       |
 1082|       |            // Get the generation number.  The generation number is 0 unless this is an uncompressed
 1083|       |            // object record, in which case the generation number appears as the third field.
 1084|  3.02M|            if (saw_first_compressed_object) {
  ------------------
  |  Branch (1084:17): [True: 2.74M, False: 283k]
  ------------------
 1085|  2.74M|                if (fields[0] != 2) {
  ------------------
  |  Branch (1085:21): [True: 1.31M, False: 1.42M]
  ------------------
 1086|  1.31M|                    uncompressed_after_compressed_ = true;
 1087|  1.31M|                }
 1088|  2.74M|            } else if (fields[0] == 2) {
  ------------------
  |  Branch (1088:24): [True: 2.55k, False: 281k]
  ------------------
 1089|  2.55k|                saw_first_compressed_object = true;
 1090|  2.55k|            }
 1091|  3.02M|            if (obj == 0) {
  ------------------
  |  Branch (1091:17): [True: 3.48k, False: 3.02M]
  ------------------
 1092|       |                // This is needed by checkLinearization()
 1093|  3.48k|                first_xref_item_offset_ = xref_offset;
 1094|  3.02M|            } else if (fields[0] == 0) {
  ------------------
  |  Branch (1094:24): [True: 560k, False: 2.46M]
  ------------------
 1095|       |                // Ignore fields[2], which we don't care about in this case. This works around the
 1096|       |                // issue of some PDF files that put invalid values, like -1, here for deleted
 1097|       |                // objects.
 1098|   560k|                insertFreeXrefEntry(QPDFObjGen(obj, 0));
 1099|  2.46M|            } else {
 1100|  2.46M|                auto typ = toI(fields[0]);
 1101|  2.46M|                if (!in_stream_recovery || typ == 2) {
  ------------------
  |  Branch (1101:21): [True: 293k, False: 2.17M]
  |  Branch (1101:44): [True: 1.35M, False: 811k]
  ------------------
 1102|       |                    // If we are in xref stream recovery all actual uncompressed objects have
 1103|       |                    // already been inserted into the xref table. Avoid adding junk data into the
 1104|       |                    // xref table.
 1105|  1.65M|                    insertXrefEntry(obj, toI(fields[0]), fields[1], toI(fields[2]));
 1106|  1.65M|                }
 1107|  2.46M|            }
 1108|  3.02M|            ++obj;
 1109|  3.02M|        }
 1110|  6.76k|    }
 1111|       |
 1112|  6.35k|    if (!m->trailer) {
  ------------------
  |  Branch (1112:9): [True: 598, False: 5.75k]
  ------------------
 1113|    598|        setTrailer(dict);
 1114|    598|    }
 1115|       |
 1116|  6.35k|    if (dict.hasKey("/Prev")) {
  ------------------
  |  Branch (1116:9): [True: 1.18k, False: 5.17k]
  ------------------
 1117|  1.18k|        if (!dict.getKey("/Prev").isInteger()) {
  ------------------
  |  Branch (1117:13): [True: 73, False: 1.11k]
  ------------------
 1118|     73|            throw damagedPDF(
 1119|     73|                "xref stream", "/Prev key in xref stream dictionary is not an integer");
 1120|     73|        }
 1121|  1.11k|        return dict.getKey("/Prev").getIntValue();
 1122|  5.17k|    } else {
 1123|  5.17k|        return 0;
 1124|  5.17k|    }
 1125|  6.35k|}
_ZN4QPDF3Doc7Objects15insertXrefEntryEiixi:
 1129|  1.81M|{
 1130|       |    // Populate the xref table in such a way that the first reference to an object that we see,
 1131|       |    // which is the one in the latest xref table in which it appears, is the one that gets stored.
 1132|       |    // This works because we are reading more recent appends before older ones.
 1133|       |
 1134|       |    // If there is already an entry for this object and generation in the table, it means that a
 1135|       |    // later xref table has registered this object.  Disregard this one.
 1136|  1.81M|    int new_gen = f0 == 2 ? 0 : f2;
  ------------------
  |  Branch (1136:19): [True: 1.42M, False: 387k]
  ------------------
 1137|       |
 1138|  1.81M|    if (!(f0 == 1 || f0 == 2)) {
  ------------------
  |  Branch (1138:11): [True: 335k, False: 1.47M]
  |  Branch (1138:22): [True: 1.42M, False: 51.2k]
  ------------------
 1139|  51.2k|        return;
 1140|  51.2k|    }
 1141|       |
 1142|  1.76M|    if (!(obj > 0 && obj <= m->xref_table_max_id && 0 <= f2 && new_gen < 65535)) {
  ------------------
  |  Branch (1142:11): [True: 1.76M, False: 454]
  |  Branch (1142:22): [True: 1.16M, False: 595k]
  |  Branch (1142:53): [True: 1.16M, False: 38]
  |  Branch (1142:64): [True: 1.16M, False: 2.13k]
  ------------------
 1143|       |        // We are ignoring invalid objgens. Most will arrive here from xref reconstruction. There
 1144|       |        // is probably no point having another warning but we could count invalid items in order to
 1145|       |        // decide when to give up.
 1146|       |        // ignore impossibly large object ids or object ids > Size.
 1147|   598k|        return;
 1148|   598k|    }
 1149|       |
 1150|  1.16M|    if (m->deleted_objects.contains(obj)) {
  ------------------
  |  Branch (1150:9): [True: 2.35k, False: 1.16M]
  ------------------
 1151|  2.35k|        return;
 1152|  2.35k|    }
 1153|       |
 1154|  1.16M|    if (f0 == 2) {
  ------------------
  |  Branch (1154:9): [True: 956k, False: 206k]
  ------------------
 1155|   956k|        if (f1 == obj) {
  ------------------
  |  Branch (1155:13): [True: 531, False: 956k]
  ------------------
 1156|    531|            warn(
 1157|    531|                damagedPDF("xref stream", "self-referential object stream " + std::to_string(obj)));
 1158|    531|            return;
 1159|    531|        }
 1160|   956k|        if (f1 > m->xref_table_max_id) {
  ------------------
  |  Branch (1160:13): [True: 10.8k, False: 945k]
  ------------------
 1161|       |            // ignore impossibly large object stream ids
 1162|  10.8k|            warn(damagedPDF(
 1163|  10.8k|                "xref stream",
 1164|  10.8k|                "object stream id " + std::to_string(f1) + " for object " + std::to_string(obj) +
 1165|  10.8k|                    " is impossibly large"));
 1166|  10.8k|            return;
 1167|  10.8k|        }
 1168|   956k|    }
 1169|       |
 1170|  1.15M|    auto [iter, created] = m->xref_table.try_emplace(QPDFObjGen(obj, (f0 == 2 ? 0 : f2)));
  ------------------
  |  Branch (1170:71): [True: 945k, False: 206k]
  ------------------
 1171|  1.15M|    if (!created) {
  ------------------
  |  Branch (1171:9): [True: 48.7k, False: 1.10M]
  ------------------
 1172|  48.7k|        return;
 1173|  48.7k|    }
 1174|       |
 1175|  1.10M|    switch (f0) {
 1176|   169k|    case 1:
  ------------------
  |  Branch (1176:5): [True: 169k, False: 933k]
  ------------------
 1177|       |        // f2 is generation
 1178|   169k|        QTC::TC("qpdf", "QPDF xref gen > 0", ((f2 > 0) ? 1 : 0));
  ------------------
  |  Branch (1178:47): [True: 38.9k, False: 130k]
  ------------------
 1179|   169k|        iter->second = QPDFXRefEntry(f1);
 1180|   169k|        break;
 1181|       |
 1182|   933k|    case 2:
  ------------------
  |  Branch (1182:5): [True: 933k, False: 169k]
  ------------------
 1183|   933k|        iter->second = QPDFXRefEntry(toI(f1), f2);
 1184|   933k|        break;
 1185|       |
 1186|      0|    default:
  ------------------
  |  Branch (1186:5): [True: 0, False: 1.10M]
  ------------------
 1187|      0|        throw damagedPDF("xref stream", "unknown xref stream entry type " + std::to_string(f0));
 1188|      0|        break;
 1189|  1.10M|    }
 1190|  1.10M|}
_ZN4QPDF3Doc7Objects19insertFreeXrefEntryE10QPDFObjGen:
 1194|   564k|{
 1195|   564k|    if (!m->xref_table.contains(og) && og.getObj() <= m->xref_table_max_id) {
  ------------------
  |  Branch (1195:9): [True: 561k, False: 3.43k]
  |  Branch (1195:40): [True: 321k, False: 239k]
  ------------------
 1196|   321k|        m->deleted_objects.insert(og.getObj());
 1197|   321k|    }
 1198|   564k|}
_ZN4QPDF3Doc7Objects16resolveXRefTableEv:
 1230|  9.13k|{
 1231|  9.13k|    bool may_change = !m->reconstructed_xref;
 1232|   864k|    for (auto& iter: m->xref_table) {
  ------------------
  |  Branch (1232:20): [True: 864k, False: 9.09k]
  ------------------
 1233|   864k|        if (isUnresolved(iter.first)) {
  ------------------
  |  Branch (1233:13): [True: 761k, False: 102k]
  ------------------
 1234|   761k|            resolve(iter.first);
 1235|   761k|            if (may_change && m->reconstructed_xref) {
  ------------------
  |  Branch (1235:17): [True: 1.93k, False: 759k]
  |  Branch (1235:31): [True: 40, False: 1.89k]
  ------------------
 1236|     40|                return false;
 1237|     40|            }
 1238|   761k|        }
 1239|   864k|    }
 1240|  9.09k|    return true;
 1241|  9.13k|}
_ZN4QPDF21fixDanglingReferencesEb:
 1247|  21.3k|{
 1248|  21.3k|    if (m->fixed_dangling_refs) {
  ------------------
  |  Branch (1248:9): [True: 12.2k, False: 9.09k]
  ------------------
 1249|  12.2k|        return;
 1250|  12.2k|    }
 1251|  9.09k|    if (!m->objects.resolveXRefTable()) {
  ------------------
  |  Branch (1251:9): [True: 40, False: 9.05k]
  ------------------
 1252|     40|        m->objects.resolveXRefTable();
 1253|     40|    }
 1254|  9.09k|    m->fixed_dangling_refs = true;
 1255|  9.09k|}
_ZN4QPDF14getObjectCountEv:
 1259|  12.7k|{
 1260|       |    // This method returns the next available indirect object number. makeIndirectObject uses it for
 1261|       |    // this purpose. After fixDanglingReferences is called, all objects in the xref table will also
 1262|       |    // be in obj_cache.
 1263|  12.7k|    fixDanglingReferences();
 1264|  12.7k|    QPDFObjGen og;
 1265|  12.7k|    if (!m->obj_cache.empty()) {
  ------------------
  |  Branch (1265:9): [True: 12.3k, False: 412]
  ------------------
 1266|  12.3k|        og = (*(m->obj_cache.rbegin())).first;
 1267|  12.3k|    }
 1268|  12.7k|    return QIntC::to_size(og.getObj());
 1269|  12.7k|}
_ZN4QPDF3Doc7Objects24setLastObjectDescriptionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1285|   249k|{
 1286|   249k|    m->last_object_description.clear();
 1287|   249k|    if (!description.empty()) {
  ------------------
  |  Branch (1287:9): [True: 7.31k, False: 241k]
  ------------------
 1288|  7.31k|        m->last_object_description += description;
 1289|  7.31k|        if (og.isIndirect()) {
  ------------------
  |  Branch (1289:13): [True: 7.31k, False: 0]
  ------------------
 1290|  7.31k|            m->last_object_description += ": ";
 1291|  7.31k|        }
 1292|  7.31k|    }
 1293|   249k|    if (og.isIndirect()) {
  ------------------
  |  Branch (1293:9): [True: 249k, False: 0]
  ------------------
 1294|   249k|        m->last_object_description += "object " + og.unparse(' ');
 1295|   249k|    }
 1296|   249k|}
_ZN4QPDF3Doc7Objects11readTrailerEv:
 1300|  17.4k|{
 1301|  17.4k|    qpdf_offset_t offset = m->file->tell();
 1302|  17.4k|    auto object =
 1303|  17.4k|        Parser::parse(*m->file, "trailer", m->tokenizer, nullptr, qpdf, m->reconstructed_xref);
 1304|  17.4k|    if (object.isDictionary() && m->objects.readToken(*m->file).isWord("stream")) {
  ------------------
  |  Branch (1304:9): [True: 4.33k, False: 13.1k]
  |  Branch (1304:9): [True: 121, False: 17.3k]
  |  Branch (1304:34): [True: 121, False: 4.20k]
  ------------------
 1305|    121|        warn(damagedPDF("trailer", m->file->tell(), "stream keyword found in trailer"));
 1306|    121|    }
 1307|       |    // Override last_offset so that it points to the beginning of the object we just read
 1308|  17.4k|    m->file->setLastOffset(offset);
 1309|  17.4k|    return object;
 1310|  17.4k|}
_ZN4QPDF3Doc7Objects10readObjectERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1314|   124k|{
 1315|   124k|    setLastObjectDescription(description, og);
 1316|   124k|    qpdf_offset_t offset = m->file->tell();
 1317|       |
 1318|   124k|    StringDecrypter decrypter{&qpdf, og};
 1319|   124k|    StringDecrypter* decrypter_ptr = m->encp->encrypted ? &decrypter : nullptr;
  ------------------
  |  Branch (1319:38): [True: 12.0k, False: 112k]
  ------------------
 1320|   124k|    auto object = Parser::parse(
 1321|   124k|        *m->file,
 1322|   124k|        m->last_object_description,
 1323|   124k|        m->tokenizer,
 1324|   124k|        decrypter_ptr,
 1325|   124k|        qpdf,
 1326|   124k|        m->reconstructed_xref || m->in_read_xref_stream);
  ------------------
  |  Branch (1326:9): [True: 122k, False: 2.70k]
  |  Branch (1326:34): [True: 1.44k, False: 1.26k]
  ------------------
 1327|   124k|    if (!object) {
  ------------------
  |  Branch (1327:9): [True: 10.1k, False: 114k]
  ------------------
 1328|  10.1k|        return {};
 1329|  10.1k|    }
 1330|   114k|    auto token = readToken(*m->file);
 1331|   114k|    if (object.isDictionary() && token.isWord("stream")) {
  ------------------
  |  Branch (1331:9): [True: 103k, False: 11.1k]
  |  Branch (1331:9): [True: 55.3k, False: 59.3k]
  |  Branch (1331:34): [True: 55.3k, False: 48.2k]
  ------------------
 1332|  55.3k|        readStream(object, og, offset);
 1333|  55.3k|        token = readToken(*m->file);
 1334|  55.3k|    }
 1335|   114k|    if (!token.isWord("endobj")) {
  ------------------
  |  Branch (1335:9): [True: 33.5k, False: 81.2k]
  ------------------
 1336|  33.5k|        warn(damagedPDF("expected endobj"));
 1337|  33.5k|    }
 1338|   114k|    return object;
 1339|   124k|}
_ZN4QPDF3Doc7Objects10readStreamER16QPDFObjectHandle10QPDFObjGenx:
 1344|  55.3k|{
 1345|  55.3k|    validateStreamLineEnd(object, og, offset);
 1346|       |
 1347|       |    // Must get offset before accessing any additional objects since resolving a previously
 1348|       |    // unresolved indirect object will change file position.
 1349|  55.3k|    qpdf_offset_t stream_offset = m->file->tell();
 1350|  55.3k|    size_t length = 0;
 1351|       |
 1352|  55.3k|    try {
 1353|  55.3k|        auto length_obj = object.getKey("/Length");
 1354|       |
 1355|  55.3k|        if (!length_obj.isInteger()) {
  ------------------
  |  Branch (1355:13): [True: 20.7k, False: 34.6k]
  ------------------
 1356|  20.7k|            if (length_obj.null()) {
  ------------------
  |  Branch (1356:17): [True: 20.4k, False: 256]
  ------------------
 1357|  20.4k|                throw damagedPDF(offset, "stream dictionary lacks /Length key");
 1358|  20.4k|            }
 1359|    256|            throw damagedPDF(offset, "/Length key in stream dictionary is not an integer");
 1360|  20.7k|        }
 1361|       |
 1362|  34.6k|        length = toS(length_obj.getUIntValue());
 1363|       |        // Seek in two steps to avoid potential integer overflow
 1364|  34.6k|        m->file->seek(stream_offset, SEEK_SET);
 1365|  34.6k|        m->file->seek(toO(length), SEEK_CUR);
 1366|  34.6k|        if (!readToken(*m->file).isWord("endstream")) {
  ------------------
  |  Branch (1366:13): [True: 10.1k, False: 24.4k]
  ------------------
 1367|  10.1k|            throw damagedPDF("expected endstream");
 1368|  10.1k|        }
 1369|  36.6k|    } catch (QPDFExc& e) {
 1370|  36.6k|        if (!cf.surpress_recovery()) {
  ------------------
  |  Branch (1370:13): [True: 36.6k, False: 0]
  ------------------
 1371|  36.6k|            warn(e);
 1372|  36.6k|            length = recoverStreamLength(m->file, og, stream_offset);
 1373|  36.6k|        } else {
 1374|      0|            throw;
 1375|      0|        }
 1376|  36.6k|    }
 1377|  47.8k|    object = QPDFObjectHandle(qpdf::Stream(qpdf, og, object, stream_offset, length));
 1378|  47.8k|}
_ZN4QPDF3Doc7Objects21validateStreamLineEndER16QPDFObjectHandle10QPDFObjGenx:
 1382|  55.3k|{
 1383|       |    // The PDF specification states that the word "stream" should be followed by either a carriage
 1384|       |    // return and a newline or by a newline alone.  It specifically disallowed following it by a
 1385|       |    // carriage return alone since, in that case, there would be no way to tell whether the NL in a
 1386|       |    // CR NL sequence was part of the stream data.  However, some readers, including Adobe reader,
 1387|       |    // accept a carriage return by itself when followed by a non-newline character, so that's what
 1388|       |    // we do here. We have also seen files that have extraneous whitespace between the stream
 1389|       |    // keyword and the newline.
 1390|  81.3k|    while (true) {
  ------------------
  |  Branch (1390:12): [True: 81.2k, Folded]
  ------------------
 1391|  81.2k|        char ch;
 1392|  81.2k|        if (m->file->read(&ch, 1) == 0) {
  ------------------
  |  Branch (1392:13): [True: 195, False: 81.0k]
  ------------------
 1393|       |            // A premature EOF here will result in some other problem that will get reported at
 1394|       |            // another time.
 1395|    195|            return;
 1396|    195|        }
 1397|  81.0k|        if (ch == '\n') {
  ------------------
  |  Branch (1397:13): [True: 22.4k, False: 58.6k]
  ------------------
 1398|       |            // ready to read stream data
 1399|  22.4k|            return;
 1400|  22.4k|        }
 1401|  58.6k|        if (ch == '\r') {
  ------------------
  |  Branch (1401:13): [True: 28.9k, False: 29.6k]
  ------------------
 1402|       |            // Read another character
 1403|  28.9k|            if (m->file->read(&ch, 1) != 0) {
  ------------------
  |  Branch (1403:17): [True: 28.9k, False: 10]
  ------------------
 1404|  28.9k|                if (ch == '\n') {
  ------------------
  |  Branch (1404:21): [True: 27.9k, False: 1.04k]
  ------------------
 1405|       |                    // Ready to read stream data
 1406|  27.9k|                    QTC::TC("qpdf", "QPDF stream with CRNL");
 1407|  27.9k|                } else {
 1408|       |                    // Treat the \r by itself as the whitespace after endstream and start reading
 1409|       |                    // stream data in spite of not having seen a newline.
 1410|  1.04k|                    m->file->unreadCh(ch);
 1411|  1.04k|                    warn(damagedPDF(
 1412|  1.04k|                        m->file->tell(), "stream keyword followed by carriage return only"));
 1413|  1.04k|                }
 1414|  28.9k|            }
 1415|  28.9k|            return;
 1416|  28.9k|        }
 1417|  29.6k|        if (!util::is_space(ch)) {
  ------------------
  |  Branch (1417:13): [True: 3.68k, False: 25.9k]
  ------------------
 1418|  3.68k|            m->file->unreadCh(ch);
 1419|  3.68k|            warn(damagedPDF(
 1420|  3.68k|                m->file->tell(), "stream keyword not followed by proper line terminator"));
 1421|  3.68k|            return;
 1422|  3.68k|        }
 1423|  25.9k|        warn(damagedPDF(m->file->tell(), "stream keyword followed by extraneous whitespace"));
 1424|  25.9k|    }
 1425|  55.3k|}
_ZN4QPDF3Doc7Objects13findEndstreamEv:
 1429|  33.1k|{
 1430|       |    // Find endstream or endobj. Position the input at that token.
 1431|  33.1k|    auto t = readToken(*m->file, 20);
 1432|  33.1k|    if (t.isWord("endobj") || t.isWord("endstream")) {
  ------------------
  |  Branch (1432:9): [True: 18.9k, False: 14.1k]
  |  Branch (1432:9): [True: 28.7k, False: 4.31k]
  |  Branch (1432:31): [True: 9.86k, False: 4.31k]
  ------------------
 1433|  28.7k|        m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1434|  28.7k|        return true;
 1435|  28.7k|    }
 1436|  4.31k|    return false;
 1437|  33.1k|}
_ZN4QPDF3Doc7Objects19recoverStreamLengthENSt3__110shared_ptrI11InputSourceEE10QPDFObjGenx:
 1442|  29.4k|{
 1443|       |    // Try to reconstruct stream length by looking for endstream or endobj
 1444|  29.4k|    warn(damagedPDF(*input, stream_offset, "attempting to recover stream length"));
 1445|       |
 1446|  29.4k|    PatternFinder ef(*this, &Objects::findEndstream);
 1447|  29.4k|    size_t length = 0;
 1448|  29.4k|    if (m->file->findFirst("end", stream_offset, 0, ef)) {
  ------------------
  |  Branch (1448:9): [True: 28.7k, False: 621]
  ------------------
 1449|  28.7k|        length = toS(m->file->tell() - stream_offset);
 1450|       |        // Reread endstream but, if it was endobj, don't skip that.
 1451|  28.7k|        QPDFTokenizer::Token t = readToken(*m->file);
 1452|  28.7k|        if (t.getValue() == "endobj") {
  ------------------
  |  Branch (1452:13): [True: 18.9k, False: 9.86k]
  ------------------
 1453|  18.9k|            m->file->seek(m->file->getLastOffset(), SEEK_SET);
 1454|  18.9k|        }
 1455|  28.7k|    }
 1456|       |
 1457|  29.4k|    if (length) {
  ------------------
  |  Branch (1457:9): [True: 27.8k, False: 1.55k]
  ------------------
 1458|  27.8k|        auto end = stream_offset + toO(length);
 1459|  27.8k|        qpdf_offset_t found_offset = 0;
 1460|  27.8k|        QPDFObjGen found_og;
 1461|       |
 1462|       |        // Make sure this is inside this object
 1463|   821k|        for (auto const& [current_og, entry]: m->xref_table) {
  ------------------
  |  Branch (1463:45): [True: 821k, False: 27.8k]
  ------------------
 1464|   821k|            if (entry.getType() == 1) {
  ------------------
  |  Branch (1464:17): [True: 749k, False: 72.5k]
  ------------------
 1465|   749k|                qpdf_offset_t obj_offset = entry.getOffset();
 1466|   749k|                if (found_offset < obj_offset && obj_offset < end) {
  ------------------
  |  Branch (1466:21): [True: 522k, False: 226k]
  |  Branch (1466:50): [True: 175k, False: 347k]
  ------------------
 1467|   175k|                    found_offset = obj_offset;
 1468|   175k|                    found_og = current_og;
 1469|   175k|                }
 1470|   749k|            }
 1471|   821k|        }
 1472|  27.8k|        if (!found_offset || found_og == og) {
  ------------------
  |  Branch (1472:13): [True: 1.47k, False: 26.3k]
  |  Branch (1472:30): [True: 24.4k, False: 1.95k]
  ------------------
 1473|       |            // If we are trying to recover an XRef stream the xref table will not contain and
 1474|       |            // won't contain any entries, therefore we cannot check the found length. Otherwise we
 1475|       |            // found endstream\nendobj within the space allowed for this object, so we're probably
 1476|       |            // in good shape.
 1477|  25.8k|        } else {
 1478|  1.95k|            length = 0;
 1479|  1.95k|        }
 1480|  27.8k|    }
 1481|       |
 1482|  29.4k|    if (length == 0) {
  ------------------
  |  Branch (1482:9): [True: 3.51k, False: 25.8k]
  ------------------
 1483|  3.51k|        warn(damagedPDF(
 1484|  3.51k|            *input, stream_offset, "unable to recover stream data; treating stream as empty"));
 1485|  25.8k|    } else {
 1486|  25.8k|        warn(damagedPDF(
 1487|  25.8k|            *input, stream_offset, "recovered stream length: " + std::to_string(length)));
 1488|  25.8k|    }
 1489|       |
 1490|  29.4k|    return length;
 1491|  29.4k|}
_ZN4QPDF3Doc7Objects9readTokenER11InputSourcem:
 1495|  2.71M|{
 1496|  2.71M|    return m->tokenizer.readToken(input, m->last_object_description, true, max_len);
 1497|  2.71M|}
_ZN4QPDF3Doc7Objects17read_object_startEx:
 1501|   132k|{
 1502|   132k|    m->file->seek(offset, SEEK_SET);
 1503|   132k|    QPDFTokenizer::Token tobjid = readToken(*m->file);
 1504|   132k|    bool objidok = tobjid.isInteger();
 1505|   132k|    if (!objidok) {
  ------------------
  |  Branch (1505:9): [True: 4.31k, False: 128k]
  ------------------
 1506|  4.31k|        throw damagedPDF(offset, "expected n n obj");
 1507|  4.31k|    }
 1508|   128k|    QPDFTokenizer::Token tgen = readToken(*m->file);
 1509|   128k|    bool genok = tgen.isInteger();
 1510|   128k|    if (!genok) {
  ------------------
  |  Branch (1510:9): [True: 503, False: 127k]
  ------------------
 1511|    503|        throw damagedPDF(offset, "expected n n obj");
 1512|    503|    }
 1513|   127k|    QPDFTokenizer::Token tobj = readToken(*m->file);
 1514|       |
 1515|   127k|    bool objok = tobj.isWord("obj");
 1516|       |
 1517|   127k|    if (!objok) {
  ------------------
  |  Branch (1517:9): [True: 1.18k, False: 126k]
  ------------------
 1518|  1.18k|        throw damagedPDF(offset, "expected n n obj");
 1519|  1.18k|    }
 1520|   126k|    int objid = QUtil::string_to_int(tobjid.getValue().c_str());
 1521|   126k|    int generation = QUtil::string_to_int(tgen.getValue().c_str());
 1522|   126k|    if (objid <= 0 || objid >= m->xref_table_max_id || generation < 0 || generation >= 65535) {
  ------------------
  |  Branch (1522:9): [True: 915, False: 125k]
  |  Branch (1522:23): [True: 156, False: 125k]
  |  Branch (1522:56): [True: 102, False: 125k]
  |  Branch (1522:74): [True: 84, False: 125k]
  ------------------
 1523|    600|        throw damagedPDF(
 1524|    600|            offset,
 1525|    600|            "object " + std::to_string(objid) + " " + std::to_string(generation) +
 1526|    600|                " has an invalid or impossibly large ID or generation");
 1527|    600|    }
 1528|   125k|    return {objid, generation};
 1529|   126k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetEbxRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE10QPDFObjGen:
 1534|   124k|{
 1535|   124k|    QPDFObjGen og;
 1536|   124k|    setLastObjectDescription(description, exp_og);
 1537|       |
 1538|   124k|    if (cf.surpress_recovery()) {
  ------------------
  |  Branch (1538:9): [True: 0, False: 124k]
  ------------------
 1539|      0|        try_recovery = false;
 1540|      0|    }
 1541|       |
 1542|       |    // Special case: if offset is 0, just return null.  Some PDF writers, in particular
 1543|       |    // "Mac OS X 10.7.5 Quartz PDFContext", may store deleted objects in the xref table as
 1544|       |    // "0000000000 00000 n", which is not correct, but it won't hurt anything for us to ignore
 1545|       |    // these.
 1546|   124k|    if (offset == 0) {
  ------------------
  |  Branch (1546:9): [True: 436, False: 123k]
  ------------------
 1547|    436|        warn(damagedPDF(
 1548|    436|            -1,
 1549|    436|            "object has offset 0 - a common error handled correctly by qpdf and most other "
 1550|    436|            "applications"));
 1551|    436|        return;
 1552|    436|    }
 1553|       |
 1554|   123k|    try {
 1555|   123k|        og = read_object_start(offset);
 1556|   123k|        if (exp_og != og) {
  ------------------
  |  Branch (1556:13): [True: 341, False: 123k]
  ------------------
 1557|    341|            QPDFExc e = damagedPDF(offset, "expected " + exp_og.unparse(' ') + " obj");
 1558|    341|            if (try_recovery) {
  ------------------
  |  Branch (1558:17): [True: 341, False: 0]
  ------------------
 1559|       |                // Will be retried below
 1560|    341|                throw e;
 1561|    341|            } else {
 1562|       |                // We can try reading the object anyway even if the ID doesn't match.
 1563|      0|                warn(e);
 1564|      0|            }
 1565|    341|        }
 1566|   123k|    } catch (QPDFExc& e) {
 1567|  5.56k|        if (!try_recovery) {
  ------------------
  |  Branch (1567:13): [True: 0, False: 5.56k]
  ------------------
 1568|      0|            throw;
 1569|      0|        }
 1570|       |        // Try again after reconstructing xref table
 1571|  5.56k|        reconstruct_xref(e);
 1572|  5.56k|        if (m->xref_table.contains(exp_og) && m->xref_table[exp_og].getType() == 1) {
  ------------------
  |  Branch (1572:13): [True: 23, False: 5.54k]
  |  Branch (1572:47): [True: 23, False: 0]
  ------------------
 1573|     23|            qpdf_offset_t new_offset = m->xref_table[exp_og].getOffset();
 1574|     23|            readObjectAtOffset(false, new_offset, description, exp_og);
 1575|     23|            return;
 1576|     23|        }
 1577|  5.54k|        warn(damagedPDF(
 1578|  5.54k|            "",
 1579|  5.54k|            -1,
 1580|  5.54k|            ("object " + exp_og.unparse(' ') +
 1581|  5.54k|             " not found in file after regenerating cross reference table")));
 1582|  5.54k|        return;
 1583|  5.56k|    }
 1584|       |
 1585|   117k|    if (auto oh = readObject(description, og)) {
  ------------------
  |  Branch (1585:14): [True: 96.5k, False: 21.0k]
  ------------------
 1586|       |        // Determine the end offset of this object before and after white space.  We use these
 1587|       |        // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1588|       |        // the end of an object to be anywhere between these values.
 1589|  96.5k|        qpdf_offset_t end_before_space = m->file->tell();
 1590|       |
 1591|       |        // skip over spaces
 1592|   210k|        while (true) {
  ------------------
  |  Branch (1592:16): [True: 210k, Folded]
  ------------------
 1593|   210k|            char ch;
 1594|   210k|            if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1594:17): [True: 792, False: 209k]
  ------------------
 1595|    792|                throw damagedPDF(m->file->tell(), "EOF after endobj");
 1596|    792|            }
 1597|   209k|            if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1597:17): [True: 95.7k, False: 114k]
  ------------------
 1598|  95.7k|                m->file->seek(-1, SEEK_CUR);
 1599|  95.7k|                break;
 1600|  95.7k|            }
 1601|   209k|        }
 1602|  95.7k|        m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1603|  95.7k|    }
 1604|   117k|}
_ZN4QPDF3Doc7Objects18readObjectAtOffsetExRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEb:
 1609|  8.75k|{
 1610|  8.75k|    auto og = read_object_start(offset);
 1611|  8.75k|    auto oh = readObject(description, og);
 1612|       |
 1613|  8.75k|    if (!oh || !m->objects.isUnresolved(og)) {
  ------------------
  |  Branch (1613:9): [True: 1.51k, False: 7.24k]
  |  Branch (1613:16): [True: 5.63k, False: 1.60k]
  ------------------
 1614|  5.70k|        return oh;
 1615|  5.70k|    }
 1616|       |
 1617|  3.05k|    if (skip_cache_if_in_xref && m->xref_table.contains(og)) {
  ------------------
  |  Branch (1617:9): [True: 1.60k, False: 1.44k]
  |  Branch (1617:34): [True: 54, False: 1.54k]
  ------------------
 1618|       |        // In the special case of the xref stream and linearization hint tables, the offset comes
 1619|       |        // from another source. For the specific case of xref streams, the xref stream is read and
 1620|       |        // loaded into the object cache very early in parsing. Ordinarily, when a file is updated by
 1621|       |        // appending, items inserted into the xref table in later updates take precedence over
 1622|       |        // earlier items. In the special case of reusing the object number previously used as the
 1623|       |        // xref stream, we have the following order of events:
 1624|       |        //
 1625|       |        // * reused object gets loaded into the xref table
 1626|       |        // * old object is read here while reading xref streams
 1627|       |        // * original xref entry is ignored (since already in xref table)
 1628|       |        //
 1629|       |        // It is the second step that causes a problem. Even though the xref table is correct in
 1630|       |        // this case, the old object is already in the cache and so effectively prevails over the
 1631|       |        // reused object. To work around this issue, we have a special case for the xref stream (via
 1632|       |        // the skip_cache_if_in_xref): if the object is already in the xref stream, don't cache what
 1633|       |        // we read here.
 1634|       |        //
 1635|       |        // It is likely that the same bug may exist for linearization hint tables, but the existing
 1636|       |        // code uses end_before_space and end_after_space from the cache, so fixing that would
 1637|       |        // require more significant rework. The chances of a linearization hint stream being reused
 1638|       |        // seems smaller because the xref stream is probably the highest object in the file and the
 1639|       |        // linearization hint stream would be some random place in the middle, so I'm leaving that
 1640|       |        // bug unfixed for now. If the bug were to be fixed, we could use !check_og in place of
 1641|       |        // skip_cache_if_in_xref.
 1642|     54|        QTC::TC("qpdf", "QPDF skipping cache for known unchecked object");
 1643|     54|        return oh;
 1644|     54|    }
 1645|       |
 1646|       |    // Determine the end offset of this object before and after white space.  We use these
 1647|       |    // numbers to validate linearization hint tables.  Offsets and lengths of objects may imply
 1648|       |    // the end of an object to be anywhere between these values.
 1649|  2.99k|    qpdf_offset_t end_before_space = m->file->tell();
 1650|       |
 1651|       |    // skip over spaces
 1652|  4.60k|    while (true) {
  ------------------
  |  Branch (1652:12): [True: 3.15k, Folded]
  ------------------
 1653|  3.15k|        char ch;
 1654|  3.15k|        if (!m->file->read(&ch, 1)) {
  ------------------
  |  Branch (1654:13): [True: 78, False: 3.07k]
  ------------------
 1655|     78|            throw damagedPDF(m->file->tell(), "EOF after endobj");
 1656|     78|        }
 1657|  3.07k|        if (!isspace(static_cast<unsigned char>(ch))) {
  ------------------
  |  Branch (1657:13): [True: 1.47k, False: 1.60k]
  ------------------
 1658|  1.47k|            m->file->seek(-1, SEEK_CUR);
 1659|  1.47k|            break;
 1660|  1.47k|        }
 1661|  3.07k|    }
 1662|  2.92k|    m->objects.updateCache(og, oh.obj_sp(), end_before_space, m->file->tell());
 1663|       |
 1664|  2.92k|    return oh;
 1665|  2.99k|}
_ZN4QPDF3Doc7Objects7resolveE10QPDFObjGen:
 1669|   993k|{
 1670|   993k|    if (!isUnresolved(og)) {
  ------------------
  |  Branch (1670:9): [True: 0, False: 993k]
  ------------------
 1671|      0|        return m->obj_cache[og].object;
 1672|      0|    }
 1673|       |
 1674|   993k|    if (m->resolving.contains(og)) {
  ------------------
  |  Branch (1674:9): [True: 241, False: 993k]
  ------------------
 1675|       |        // This can happen if an object references itself directly or indirectly in some key that
 1676|       |        // has to be resolved during object parsing, such as stream length.
 1677|    241|        warn(damagedPDF("", "loop detected resolving object " + og.unparse(' ')));
 1678|    241|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1679|    241|        return m->obj_cache[og].object;
 1680|    241|    }
 1681|   993k|    ResolveRecorder rr(qpdf, og);
 1682|       |
 1683|   993k|    if (m->xref_table.contains(og)) {
  ------------------
  |  Branch (1683:9): [True: 894k, False: 99.3k]
  ------------------
 1684|   894k|        QPDFXRefEntry const& entry = m->xref_table[og];
 1685|   894k|        try {
 1686|   894k|            switch (entry.getType()) {
 1687|   124k|            case 1:
  ------------------
  |  Branch (1687:13): [True: 124k, False: 770k]
  ------------------
 1688|       |                // Object stored in cache by readObjectAtOffset
 1689|   124k|                readObjectAtOffset(true, entry.getOffset(), "", og);
 1690|   124k|                break;
 1691|       |
 1692|   770k|            case 2:
  ------------------
  |  Branch (1692:13): [True: 770k, False: 124k]
  ------------------
 1693|   770k|                resolveObjectsInStream(entry.getObjStreamNumber());
 1694|   770k|                break;
 1695|       |
 1696|      7|            default:
  ------------------
  |  Branch (1696:13): [True: 7, False: 894k]
  ------------------
 1697|      7|                throw damagedPDF(
 1698|      7|                    "", -1, ("object " + og.unparse('/') + " has unexpected xref entry type"));
 1699|   894k|            }
 1700|   894k|        } catch (QPDFExc& e) {
 1701|  50.2k|            warn(e);
 1702|  50.2k|        } catch (std::exception& e) {
 1703|    708|            warn(damagedPDF(
 1704|    708|                "", -1, ("object " + og.unparse('/') + ": error reading object: " + e.what())));
 1705|    708|        }
 1706|   894k|    }
 1707|       |
 1708|   978k|    if (isUnresolved(og)) {
  ------------------
  |  Branch (1708:9): [True: 882k, False: 96.6k]
  ------------------
 1709|       |        // PDF spec says unknown objects resolve to the null object.
 1710|   882k|        updateCache(og, QPDFObject::create<QPDF_Null>(), -1, -1);
 1711|   882k|    }
 1712|       |
 1713|   978k|    auto& result(m->obj_cache[og].object);
 1714|   978k|    result->setDefaultDescription(&qpdf, og);
 1715|   978k|    return result;
 1716|   993k|}
_ZN4QPDF3Doc7Objects22resolveObjectsInStreamEi:
 1720|   770k|{
 1721|   770k|    auto damaged =
 1722|   770k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|   770k|        return {
 1724|   770k|            qpdf_e_damaged_pdf,
 1725|   770k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|   770k|            +"object " + std::to_string(id) + " 0",
 1727|   770k|            offset,
 1728|   770k|            msg,
 1729|   770k|            true};
 1730|   770k|    };
 1731|       |
 1732|   770k|    if (m->resolved_object_streams.contains(obj_stream_number)) {
  ------------------
  |  Branch (1732:9): [True: 736k, False: 34.1k]
  ------------------
 1733|   736k|        return;
 1734|   736k|    }
 1735|  34.1k|    m->resolved_object_streams.insert(obj_stream_number);
 1736|       |    // Force resolution of object stream
 1737|  34.1k|    Stream obj_stream = qpdf.getObject(obj_stream_number, 0);
 1738|  34.1k|    if (!obj_stream) {
  ------------------
  |  Branch (1738:9): [True: 29.7k, False: 4.39k]
  ------------------
 1739|  29.7k|        throw damagedPDF(
 1740|  29.7k|            "object " + std::to_string(obj_stream_number) + " 0",
 1741|  29.7k|            "supposed object stream " + std::to_string(obj_stream_number) + " is not a stream");
 1742|  29.7k|    }
 1743|       |
 1744|       |    // For linearization data in the object, use the data from the object stream for the objects in
 1745|       |    // the stream.
 1746|  4.39k|    QPDFObjGen stream_og(obj_stream_number, 0);
 1747|  4.39k|    qpdf_offset_t end_before_space = m->obj_cache[stream_og].end_before_space;
 1748|  4.39k|    qpdf_offset_t end_after_space = m->obj_cache[stream_og].end_after_space;
 1749|       |
 1750|  4.39k|    QPDFObjectHandle dict = obj_stream.getDict();
 1751|  4.39k|    if (!dict.isDictionaryOfType("/ObjStm")) {
  ------------------
  |  Branch (1751:9): [True: 1.10k, False: 3.29k]
  ------------------
 1752|  1.10k|        warn(damagedPDF(
 1753|  1.10k|            "object " + std::to_string(obj_stream_number) + " 0",
 1754|  1.10k|            "supposed object stream " + std::to_string(obj_stream_number) + " has wrong type"));
 1755|  1.10k|    }
 1756|       |
 1757|  4.39k|    unsigned int n{0};
 1758|  4.39k|    int first{0};
 1759|  4.39k|    if (!(dict.getKey("/N").getValueAsUInt(n) && dict.getKey("/First").getValueAsInt(first))) {
  ------------------
  |  Branch (1759:9): [True: 438, False: 3.95k]
  |  Branch (1759:11): [True: 1.68k, False: 2.70k]
  |  Branch (1759:50): [True: 1.62k, False: 62]
  ------------------
 1760|    438|        throw damagedPDF(
 1761|    438|            "object " + std::to_string(obj_stream_number) + " 0",
 1762|    438|            "object stream " + std::to_string(obj_stream_number) + " has incorrect keys");
 1763|    438|    }
 1764|       |
 1765|       |    // id, offset, size
 1766|  3.95k|    std::vector<std::tuple<int, qpdf_offset_t, size_t>> offsets;
 1767|       |
 1768|  3.95k|    auto stream_data = obj_stream.getStreamData(qpdf_dl_specialized);
 1769|       |
 1770|  3.95k|    is::OffsetBuffer input("", stream_data);
 1771|       |
 1772|  3.95k|    const auto b_size = stream_data.size();
 1773|  3.95k|    const auto end_offset = static_cast<qpdf_offset_t>(b_size);
 1774|  3.95k|    auto b_start = stream_data.data();
 1775|       |
 1776|  3.95k|    if (first >= end_offset) {
  ------------------
  |  Branch (1776:9): [True: 88, False: 3.86k]
  ------------------
 1777|     88|        throw damagedPDF(
 1778|     88|            "object " + std::to_string(obj_stream_number) + " 0",
 1779|     88|            "object stream " + std::to_string(obj_stream_number) + " has invalid /First entry");
 1780|     88|    }
 1781|       |
 1782|  3.86k|    int id = 0;
 1783|  3.86k|    long long last_offset = -1;
 1784|  3.86k|    bool is_first = true;
 1785|  63.7k|    for (unsigned int i = 0; i < n; ++i) {
  ------------------
  |  Branch (1785:30): [True: 60.1k, False: 3.67k]
  ------------------
 1786|  60.1k|        auto tnum = readToken(input);
 1787|  60.1k|        auto id_offset = input.getLastOffset();
 1788|  60.1k|        auto toffset = readToken(input);
 1789|  60.1k|        if (!(tnum.isInteger() && toffset.isInteger())) {
  ------------------
  |  Branch (1789:15): [True: 59.9k, False: 127]
  |  Branch (1789:35): [True: 59.9k, False: 66]
  ------------------
 1790|    193|            throw damaged(0, input.getLastOffset(), "expected integer in object stream header");
 1791|    193|        }
 1792|       |
 1793|  59.9k|        int num = QUtil::string_to_int(tnum.getValue().c_str());
 1794|  59.9k|        long long offset = QUtil::string_to_int(toffset.getValue().c_str());
 1795|       |
 1796|  59.9k|        if (num == obj_stream_number) {
  ------------------
  |  Branch (1796:13): [True: 321, False: 59.6k]
  ------------------
 1797|    321|            warn(damaged(num, id_offset, "object stream claims to contain itself"));
 1798|    321|            continue;
 1799|    321|        }
 1800|       |
 1801|  59.6k|        if (num < 1) {
  ------------------
  |  Branch (1801:13): [True: 558, False: 59.0k]
  ------------------
 1802|    558|            warn(damaged(num, id_offset, "object id is invalid"s));
 1803|    558|            continue;
 1804|    558|        }
 1805|       |
 1806|  59.0k|        if (offset <= last_offset) {
  ------------------
  |  Branch (1806:13): [True: 7.68k, False: 51.3k]
  ------------------
 1807|  7.68k|            warn(damaged(
 1808|  7.68k|                num,
 1809|  7.68k|                input.getLastOffset(),
 1810|  7.68k|                "offset " + std::to_string(offset) +
 1811|  7.68k|                    " is invalid (must be larger than previous offset " +
 1812|  7.68k|                    std::to_string(last_offset) + ")"));
 1813|  7.68k|            continue;
 1814|  7.68k|        }
 1815|       |
 1816|  51.3k|        if (num > m->xref_table_max_id) {
  ------------------
  |  Branch (1816:13): [True: 1.65k, False: 49.7k]
  ------------------
 1817|  1.65k|            continue;
 1818|  1.65k|        }
 1819|       |
 1820|  49.7k|        if (first + offset >= end_offset) {
  ------------------
  |  Branch (1820:13): [True: 9.80k, False: 39.9k]
  ------------------
 1821|  9.80k|            warn(damaged(
 1822|  9.80k|                num, input.getLastOffset(), "offset " + std::to_string(offset) + " is too large"));
 1823|  9.80k|            continue;
 1824|  9.80k|        }
 1825|       |
 1826|  39.9k|        if (is_first) {
  ------------------
  |  Branch (1826:13): [True: 1.23k, False: 38.6k]
  ------------------
 1827|  1.23k|            is_first = false;
 1828|  38.6k|        } else {
 1829|  38.6k|            offsets.emplace_back(
 1830|  38.6k|                id, last_offset + first, static_cast<size_t>(offset - last_offset));
 1831|  38.6k|        }
 1832|       |
 1833|  39.9k|        last_offset = offset;
 1834|  39.9k|        id = num;
 1835|  39.9k|    }
 1836|       |
 1837|  3.67k|    if (!is_first) {
  ------------------
  |  Branch (1837:9): [True: 1.07k, False: 2.59k]
  ------------------
 1838|       |        // We found at least one valid entry.
 1839|  1.07k|        offsets.emplace_back(
 1840|  1.07k|            id, last_offset + first, b_size - static_cast<size_t>(last_offset + first));
 1841|  1.07k|    }
 1842|       |
 1843|       |    // To avoid having to read the object stream multiple times, store all objects that would be
 1844|       |    // found here in the cache.  Remember that some objects stored here might have been overridden
 1845|       |    // by new objects appended to the file, so it is necessary to recheck the xref table and only
 1846|       |    // cache what would actually be resolved here.
 1847|  35.8k|    for (auto const& [obj_id, obj_offset, obj_size]: offsets) {
  ------------------
  |  Branch (1847:52): [True: 35.8k, False: 3.67k]
  ------------------
 1848|  35.8k|        QPDFObjGen og(obj_id, 0);
 1849|  35.8k|        auto entry = m->xref_table.find(og);
 1850|  35.8k|        if (entry != m->xref_table.end() && entry->second.getType() == 2 &&
  ------------------
  |  Branch (1850:13): [True: 34.5k, False: 1.30k]
  |  Branch (1850:13): [True: 33.7k, False: 2.09k]
  |  Branch (1850:45): [True: 34.2k, False: 360]
  ------------------
 1851|  34.2k|            entry->second.getObjStreamNumber() == obj_stream_number) {
  ------------------
  |  Branch (1851:13): [True: 33.7k, False: 432]
  ------------------
 1852|  33.7k|            is::OffsetBuffer in("", {b_start + obj_offset, obj_size}, obj_offset);
 1853|  33.7k|            if (auto oh = Parser::parse(in, obj_stream_number, obj_id, m->tokenizer, qpdf)) {
  ------------------
  |  Branch (1853:22): [True: 30.1k, False: 3.61k]
  ------------------
 1854|  30.1k|                updateCache(og, oh.obj_sp(), end_before_space, end_after_space);
 1855|  30.1k|            }
 1856|  33.7k|        } else {
 1857|  2.09k|            QTC::TC("qpdf", "QPDF not caching overridden objstm object");
 1858|  2.09k|        }
 1859|  35.8k|    }
 1860|  3.67k|}
_ZN4QPDF3Doc7Objects11newIndirectE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEE:
 1864|  3.23k|{
 1865|  3.23k|    obj->setDefaultDescription(&qpdf, og);
 1866|  3.23k|    return {obj};
 1867|  3.23k|}
_ZN4QPDF3Doc7Objects11updateCacheE10QPDFObjGenRKNSt3__110shared_ptrI10QPDFObjectEExxb:
 1876|  1.00M|{
 1877|  1.00M|    object->setObjGen(&qpdf, og);
 1878|  1.00M|    if (isCached(og)) {
  ------------------
  |  Branch (1878:9): [True: 248k, False: 761k]
  ------------------
 1879|   248k|        auto& cache = m->obj_cache[og];
 1880|   248k|        object->move_to(cache.object, destroy);
 1881|   248k|        cache.end_before_space = end_before_space;
 1882|   248k|        cache.end_after_space = end_after_space;
 1883|   761k|    } else {
 1884|   761k|        m->obj_cache[og] = ObjCache(object, end_before_space, end_after_space);
 1885|   761k|    }
 1886|  1.00M|}
_ZN4QPDF3Doc7Objects8isCachedE10QPDFObjGen:
 1890|  3.85M|{
 1891|  3.85M|    return m->obj_cache.contains(og);
 1892|  3.85M|}
_ZN4QPDF3Doc7Objects12isUnresolvedE10QPDFObjGen:
 1896|  2.84M|{
 1897|  2.84M|    return !isCached(og) || m->obj_cache[og].object->isUnresolved();
  ------------------
  |  Branch (1897:12): [True: 2.22M, False: 622k]
  |  Branch (1897:29): [True: 417k, False: 205k]
  ------------------
 1898|  2.84M|}
_ZN4QPDF3Doc7Objects10nextObjGenEv:
 1902|  3.25k|{
 1903|  3.25k|    int max_objid = toI(qpdf.getObjectCount());
 1904|  3.25k|    if (max_objid == std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (1904:9): [True: 0, False: 3.25k]
  ------------------
 1905|      0|        throw std::range_error("max object id is too high to create new objects");
 1906|      0|    }
 1907|  3.25k|    return {max_objid + 1, 0};
 1908|  3.25k|}
_ZN4QPDF3Doc7Objects26makeIndirectFromQPDFObjectERKNSt3__110shared_ptrI10QPDFObjectEE:
 1912|  3.25k|{
 1913|  3.25k|    QPDFObjGen next{nextObjGen()};
 1914|  3.25k|    m->obj_cache[next] = ObjCache(obj, -1, -1);
 1915|  3.25k|    return newIndirect(next, m->obj_cache[next].object);
 1916|  3.25k|}
_ZN4QPDF18makeIndirectObjectE16QPDFObjectHandle:
 1920|  3.25k|{
 1921|  3.25k|    if (!oh) {
  ------------------
  |  Branch (1921:9): [True: 0, False: 3.25k]
  ------------------
 1922|      0|        throw std::logic_error("attempted to make an uninitialized QPDFObjectHandle indirect");
 1923|      0|    }
 1924|  3.25k|    return m->objects.makeIndirectFromQPDFObject(oh.obj_sp());
 1925|  3.25k|}
_ZN4QPDF3Doc7Objects18getObjectForParserEiib:
 1929|   400k|{
 1930|       |    // This method is called by the parser and therefore must not resolve any objects.
 1931|   400k|    auto og = QPDFObjGen(id, gen);
 1932|   400k|    if (auto iter = m->obj_cache.find(og); iter != m->obj_cache.end()) {
  ------------------
  |  Branch (1932:44): [True: 158k, False: 241k]
  ------------------
 1933|   158k|        return iter->second.object;
 1934|   158k|    }
 1935|   241k|    if (m->xref_table.contains(og) || (!m->parsed && og.getObj() < m->xref_table_max_id)) {
  ------------------
  |  Branch (1935:9): [True: 85.1k, False: 156k]
  |  Branch (1935:40): [True: 114k, False: 41.9k]
  |  Branch (1935:54): [True: 111k, False: 3.14k]
  ------------------
 1936|   196k|        return m->obj_cache.insert({og, QPDFObject::create<QPDF_Unresolved>(&qpdf, og)})
 1937|   196k|            .first->second.object;
 1938|   196k|    }
 1939|  45.0k|    if (parse_pdf) {
  ------------------
  |  Branch (1939:9): [True: 45.0k, False: 0]
  ------------------
 1940|  45.0k|        return QPDFObject::create<QPDF_Null>();
 1941|  45.0k|    }
 1942|      0|    return m->obj_cache.insert({og, QPDFObject::create<QPDF_Null>(&qpdf, og)}).first->second.object;
 1943|  45.0k|}
_ZN4QPDF9getObjectE10QPDFObjGen:
 1961|   134k|{
 1962|   134k|    if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) {
  ------------------
  |  Branch (1962:42): [True: 61.3k, False: 72.7k]
  ------------------
 1963|  61.3k|        return {it->second.object};
 1964|  72.7k|    } else if (m->parsed && !m->xref_table.contains(og)) {
  ------------------
  |  Branch (1964:16): [True: 11.7k, False: 60.9k]
  |  Branch (1964:29): [True: 7.53k, False: 4.26k]
  ------------------
 1965|  7.53k|        return QPDFObject::create<QPDF_Null>();
 1966|  65.1k|    } else {
 1967|  65.1k|        auto result =
 1968|  65.1k|            m->obj_cache.try_emplace(og, QPDFObject::create<QPDF_Unresolved>(this, og), -1, -1);
 1969|  65.1k|        return {result.first->second.object};
 1970|  65.1k|    }
 1971|   134k|}
_ZN4QPDF12removeObjectE10QPDFObjGen:
 1990|  6.95k|{
 1991|  6.95k|    m->xref_table.erase(og);
 1992|  6.95k|    if (auto cached = m->obj_cache.find(og); cached != m->obj_cache.end()) {
  ------------------
  |  Branch (1992:46): [True: 1.62k, False: 5.32k]
  ------------------
 1993|       |        // Take care of any object handles that may be floating around.
 1994|  1.62k|        cached->second.object->assign_null();
 1995|  1.62k|        cached->second.object->setObjGen(nullptr, QPDFObjGen());
 1996|  1.62k|        m->obj_cache.erase(cached);
 1997|  1.62k|    }
 1998|  6.95k|}
_ZN4QPDF3Doc7Objects10table_sizeEv:
 2028|  8.57k|{
 2029|       |    // If obj_cache is dense, accommodate all object in tables,else accommodate only original
 2030|       |    // objects.
 2031|  8.57k|    auto max_xref = !m->xref_table.empty() ? m->xref_table.crbegin()->first.getObj() : 0;
  ------------------
  |  Branch (2031:21): [True: 8.07k, False: 496]
  ------------------
 2032|  8.57k|    auto max_obj = !m->obj_cache.empty() ? m->obj_cache.crbegin()->first.getObj() : 0;
  ------------------
  |  Branch (2032:20): [True: 8.57k, False: 0]
  ------------------
 2033|  8.57k|    auto max_id = std::numeric_limits<int>::max() - 1;
 2034|  8.57k|    if (max_obj >= max_id || max_xref >= max_id) {
  ------------------
  |  Branch (2034:9): [True: 0, False: 8.57k]
  |  Branch (2034:30): [True: 0, False: 8.57k]
  ------------------
 2035|       |        // Temporary fix. Long-term solution is
 2036|       |        // - QPDFObjGen to enforce objgens are valid and sensible
 2037|       |        // - xref table and obj cache to protect against insertion of impossibly large obj ids
 2038|      0|        stopOnError("Impossibly large object id encountered.");
 2039|      0|    }
 2040|  8.57k|    if (max_obj < 1.1 * std::max(toI(m->obj_cache.size()), max_xref)) {
  ------------------
  |  Branch (2040:9): [True: 7.70k, False: 869]
  ------------------
 2041|  7.70k|        return toS(++max_obj);
 2042|  7.70k|    }
 2043|    869|    return toS(++max_xref);
 2044|  8.57k|}
_ZN4QPDF3Doc7Objects16compressible_setEv:
 2054|    980|{
 2055|    980|    return compressible<bool>();
 2056|    980|}
_ZN4QPDF3Doc7Objects13PatternFinderC2ERS1_MS1_FbvE:
  147|  73.5k|        o(o),
  148|  73.5k|        checker(checker)
  149|  73.5k|    {
  150|  73.5k|    }
_ZN4QPDF3Doc7Objects13PatternFinder5checkEv:
  154|  43.6k|    {
  155|  43.6k|        return (this->o.*checker)();
  156|  43.6k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects16reconstruct_xrefER7QPDFExcbENK3$_0clEv:
  324|  1.67M|    auto check_warnings = [this, max_warnings]() {
  325|  1.67M|        if (m->warnings.size() > max_warnings) {
  ------------------
  |  Branch (325:13): [True: 0, False: 1.67M]
  ------------------
  326|      0|            throw damagedPDF("", -1, "too many errors while reconstructing cross-reference table");
  327|      0|        }
  328|  1.67M|    };
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects17processXRefStreamExR16QPDFObjectHandlebENK3$_0clENSt3__117basic_string_viewIcNS5_11char_traitsIcEEEE:
 1037|  4.78k|    auto damaged = [this, xref_offset](std::string_view msg) -> QPDFExc {
 1038|  4.78k|        return damagedPDF("xref stream", xref_offset, msg.data());
 1039|  4.78k|    };
_ZN4QPDF15ResolveRecorderC2ERS_RK10QPDFObjGen:
  129|   993k|        qpdf(qpdf),
  130|   993k|        iter(qpdf.m->resolving.insert(og).first)
  131|   993k|    {
  132|   993k|    }
_ZN4QPDF15ResolveRecorderD2Ev:
  134|   993k|    {
  135|   993k|        qpdf.m->resolving.erase(iter);
  136|   993k|    }
QPDF_objects.cc:_ZZN4QPDF3Doc7Objects22resolveObjectsInStreamEiENK3$_0clEixRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
 1722|  18.5k|        [this, obj_stream_number](int id, qpdf_offset_t offset, std::string const& msg) -> QPDFExc {
 1723|  18.5k|        return {
 1724|  18.5k|            qpdf_e_damaged_pdf,
 1725|  18.5k|            m->file->getName() + " object stream " + std::to_string(obj_stream_number),
 1726|  18.5k|            +"object " + std::to_string(id) + " 0",
 1727|  18.5k|            offset,
 1728|  18.5k|            msg,
 1729|  18.5k|            true};
 1730|  18.5k|    };
_ZN4QPDF3Doc7Objects12compressibleIbEENSt3__16vectorIT_NS3_9allocatorIS5_EEEEv:
 2061|    980|{
 2062|       |    // Return a list of objects that are allowed to be in object streams.  Walk through the objects
 2063|       |    // by traversing the document from the root, including a traversal of the pages tree.  This
 2064|       |    // makes that objects that are on the same page are more likely to be in the same object stream,
 2065|       |    // which is slightly more efficient, particularly with linearized files.  This is better than
 2066|       |    // iterating through the xref table since it avoids preserving orphaned items.
 2067|       |
 2068|       |    // Exclude encryption dictionary, if any
 2069|    980|    QPDFObjectHandle encryption_dict = m->trailer.getKey("/Encrypt");
 2070|    980|    QPDFObjGen encryption_dict_og = encryption_dict.getObjGen();
 2071|       |
 2072|    980|    const size_t max_obj = qpdf.getObjectCount();
 2073|    980|    std::vector<bool> visited(max_obj, false);
 2074|    980|    std::vector<QPDFObjectHandle> queue;
 2075|    980|    queue.reserve(512);
 2076|    980|    queue.emplace_back(m->trailer);
 2077|    980|    std::vector<T> result;
 2078|       |    if constexpr (std::is_same_v<T, QPDFObjGen>) {
 2079|       |        result.reserve(m->obj_cache.size());
 2080|    980|    } else {
 2081|    980|        qpdf_static_expect(std::is_same_v<T, bool>);
  ------------------
  |  |   19|    980|#define qpdf_static_expect static_assert
  ------------------
 2082|    980|        result.resize(max_obj + 1U, false);
 2083|    980|    }
 2084|  18.9M|    while (!queue.empty()) {
  ------------------
  |  Branch (2084:12): [True: 18.9M, False: 980]
  ------------------
 2085|  18.9M|        auto obj = queue.back();
 2086|  18.9M|        queue.pop_back();
 2087|  18.9M|        if (obj.getObjectID() > 0) {
  ------------------
  |  Branch (2087:13): [True: 60.5k, False: 18.8M]
  ------------------
 2088|  60.5k|            QPDFObjGen og = obj.getObjGen();
 2089|  60.5k|            const size_t id = toS(og.getObj() - 1);
 2090|  60.5k|            if (id >= max_obj) {
  ------------------
  |  Branch (2090:17): [True: 0, False: 60.5k]
  ------------------
 2091|      0|                throw std::logic_error(
 2092|      0|                    "unexpected object id encountered in getCompressibleObjGens");
 2093|      0|            }
 2094|  60.5k|            if (visited[id]) {
  ------------------
  |  Branch (2094:17): [True: 17.4k, False: 43.0k]
  ------------------
 2095|  17.4k|                continue;
 2096|  17.4k|            }
 2097|       |
 2098|       |            // Check whether this is the current object. If not, remove it (which changes it into a
 2099|       |            // direct null and therefore stops us from revisiting it) and move on to the next object
 2100|       |            // in the queue.
 2101|  43.0k|            auto upper = m->obj_cache.upper_bound(og);
 2102|  43.0k|            if (upper != m->obj_cache.end() && upper->first.getObj() == og.getObj()) {
  ------------------
  |  Branch (2102:17): [True: 42.8k, False: 225]
  |  Branch (2102:17): [True: 974, False: 42.1k]
  |  Branch (2102:48): [True: 974, False: 41.8k]
  ------------------
 2103|    974|                qpdf.removeObject(og);
 2104|    974|                continue;
 2105|    974|            }
 2106|       |
 2107|  42.1k|            visited[id] = true;
 2108|       |
 2109|  42.1k|            if (og == encryption_dict_og) {
  ------------------
  |  Branch (2109:17): [True: 4, False: 42.1k]
  ------------------
 2110|      4|                QTC::TC("qpdf", "QPDF exclude encryption dictionary");
 2111|  42.1k|            } else if (!(obj.isStream() ||
  ------------------
  |  Branch (2111:24): [True: 36.8k, False: 5.25k]
  |  Branch (2111:26): [True: 5.25k, False: 36.8k]
  ------------------
 2112|  36.8k|                         (obj.isDictionaryOfType("/Sig") && obj.hasKey("/ByteRange") &&
  ------------------
  |  Branch (2112:27): [True: 17, False: 36.8k]
  |  Branch (2112:61): [True: 7, False: 10]
  ------------------
 2113|  36.8k|                          obj.hasKey("/Contents")))) {
  ------------------
  |  Branch (2113:27): [True: 7, False: 0]
  ------------------
 2114|       |                if constexpr (std::is_same_v<T, QPDFObjGen>) {
 2115|       |                    result.push_back(og);
 2116|  36.8k|                } else if constexpr (std::is_same_v<T, bool>) {
 2117|  36.8k|                    result[id + 1U] = true;
 2118|  36.8k|                }
 2119|  36.8k|            }
 2120|  42.1k|        }
 2121|  18.9M|        if (obj.isStream()) {
  ------------------
  |  Branch (2121:13): [True: 5.25k, False: 18.9M]
  ------------------
 2122|  5.25k|            auto dict = obj.getDict().as_dictionary();
 2123|  5.25k|            auto end = dict.crend();
 2124|  38.5k|            for (auto iter = dict.crbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (2124:46): [True: 33.3k, False: 5.25k]
  ------------------
 2125|  33.3k|                std::string const& key = iter->first;
 2126|  33.3k|                QPDFObjectHandle const& value = iter->second;
 2127|  33.3k|                if (!value.null()) {
  ------------------
  |  Branch (2127:21): [True: 31.7k, False: 1.54k]
  ------------------
 2128|  31.7k|                    if (key == "/Length") {
  ------------------
  |  Branch (2128:25): [True: 4.73k, False: 27.0k]
  ------------------
 2129|       |                        // omit stream lengths
 2130|  4.73k|                        if (value.isIndirect()) {
  ------------------
  |  Branch (2130:29): [True: 154, False: 4.58k]
  ------------------
 2131|    154|                            QTC::TC("qpdf", "QPDF exclude indirect length");
 2132|    154|                        }
 2133|  27.0k|                    } else {
 2134|  27.0k|                        queue.emplace_back(value);
 2135|  27.0k|                    }
 2136|  31.7k|                }
 2137|  33.3k|            }
 2138|  18.9M|        } else if (obj.isDictionary()) {
  ------------------
  |  Branch (2138:20): [True: 24.1k, False: 18.8M]
  ------------------
 2139|  24.1k|            auto dict = obj.as_dictionary();
 2140|  24.1k|            auto end = dict.crend();
 2141|   184k|            for (auto iter = dict.crbegin(); iter != end; ++iter) {
  ------------------
  |  Branch (2141:46): [True: 160k, False: 24.1k]
  ------------------
 2142|   160k|                if (!iter->second.null()) {
  ------------------
  |  Branch (2142:21): [True: 96.9k, False: 63.5k]
  ------------------
 2143|  96.9k|                    queue.emplace_back(iter->second);
 2144|  96.9k|                }
 2145|   160k|            }
 2146|  18.8M|        } else if (auto items = obj.as_array()) {
  ------------------
  |  Branch (2146:25): [True: 18.8M, False: 0]
  ------------------
 2147|  18.8M|            queue.insert(queue.end(), items.crbegin(), items.crend());
 2148|  18.8M|        }
 2149|  18.9M|    }
 2150|       |
 2151|    980|    return result;
 2152|    980|}

_ZN4QPDF3Doc5Pages5cacheEv:
   53|  16.8k|{
   54|       |    // Note that pushInheritedAttributesToPage may also be used to initialize m->all_pages.
   55|  16.8k|    if (all_pages.empty() && !invalid_page_found) {
  ------------------
  |  Branch (55:9): [True: 15.5k, False: 1.30k]
  |  Branch (55:30): [True: 14.6k, False: 863]
  ------------------
   56|  14.6k|        ever_called_get_all_pages_ = true;
   57|  14.6k|        auto root = qpdf.getRoot();
   58|  14.6k|        QPDFObjGen::set visited;
   59|  14.6k|        QPDFObjGen::set seen;
   60|  14.6k|        QPDFObjectHandle pages = root.getKey("/Pages");
   61|  14.6k|        bool warned = false;
   62|  14.6k|        bool changed_pages = false;
   63|  14.9k|        while (pages.isDictionary() && pages.hasKey("/Parent")) {
  ------------------
  |  Branch (63:16): [True: 10.3k, False: 4.61k]
  |  Branch (63:16): [True: 343, False: 14.6k]
  |  Branch (63:40): [True: 343, False: 9.99k]
  ------------------
   64|    343|            if (!seen.add(pages)) {
  ------------------
  |  Branch (64:17): [True: 82, False: 261]
  ------------------
   65|       |                // loop -- will be detected again and reported later
   66|     82|                break;
   67|     82|            }
   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|    261|            if (!warned) {
  ------------------
  |  Branch (70:17): [True: 186, False: 75]
  ------------------
   71|    186|                root.warn(
   72|    186|                    "document page tree root (root -> /Pages) doesn't point"
   73|    186|                    " to the root of the page tree; attempting to correct");
   74|    186|                warned = true;
   75|    186|            }
   76|    261|            changed_pages = true;
   77|    261|            pages = pages.getKey("/Parent");
   78|    261|        }
   79|  14.6k|        if (changed_pages) {
  ------------------
  |  Branch (79:13): [True: 185, False: 14.5k]
  ------------------
   80|    185|            root.replaceKey("/Pages", pages);
   81|    185|        }
   82|  14.6k|        seen.clear();
   83|  14.6k|        if (!pages.hasKey("/Kids")) {
  ------------------
  |  Branch (83:13): [True: 150, False: 14.5k]
  ------------------
   84|       |            // Ensure we actually found a /Pages object.
   85|    150|            throw QPDFExc(
   86|    150|                qpdf_e_pages, m->file->getName(), "", 0, "root of pages tree has no /Kids array");
   87|    150|        }
   88|  14.5k|        try {
   89|  14.5k|            getAllPagesInternal(pages, 0, visited, seen, false, false);
   90|  14.5k|        } catch (...) {
   91|     91|            all_pages.clear();
   92|     91|            invalid_page_found = false;
   93|     91|            throw;
   94|     91|        }
   95|  9.96k|        if (invalid_page_found) {
  ------------------
  |  Branch (95:13): [True: 2.16k, False: 7.79k]
  ------------------
   96|  2.16k|            flattenPagesTree();
   97|  2.16k|            invalid_page_found = false;
   98|  2.16k|        }
   99|  9.96k|    }
  100|  12.1k|    return all_pages;
  101|  16.8k|}
_ZN4QPDF3Doc5Pages19getAllPagesInternalE16QPDFObjectHandlejRN10QPDFObjGen3setES5_bb:
  111|  10.9k|{
  112|  10.9k|    static uint32_t constexpr max_level = 100;
  113|  10.9k|    if (++level > max_level) {
  ------------------
  |  Branch (113:9): [True: 0, False: 10.9k]
  ------------------
  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|  10.9k|    if (!visited.add(cur_node)) {
  ------------------
  |  Branch (121:9): [True: 25, False: 10.9k]
  ------------------
  122|     25|        throw QPDFExc(
  123|     25|            qpdf_e_pages,
  124|     25|            m->file->getName(),
  125|     25|            "object " + cur_node.getObjGen().unparse(' '),
  126|     25|            0,
  127|     25|            "Loop detected in /Pages structure (getAllPages)");
  128|     25|    }
  129|  10.9k|    if (!cur_node.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (129:9): [True: 9.07k, False: 1.86k]
  ------------------
  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|  9.07k|        cur_node.warn("/Type key should be /Pages but is not; overriding");
  134|  9.07k|        cur_node.replaceKey("/Type", Name("/Pages"));
  135|  9.07k|    }
  136|  10.9k|    if (!media_box) {
  ------------------
  |  Branch (136:9): [True: 10.8k, False: 111]
  ------------------
  137|  10.8k|        media_box = cur_node.getKey("/MediaBox").isRectangle();
  138|  10.8k|        QTC::TC("qpdf", "QPDF inherit mediabox", media_box ? 0 : 1);
  ------------------
  |  Branch (138:50): [True: 1.64k, False: 9.18k]
  ------------------
  139|  10.8k|    }
  140|  10.9k|    if (!resources) {
  ------------------
  |  Branch (140:9): [True: 10.8k, False: 140]
  ------------------
  141|  10.8k|        resources = cur_node.getKey("/Resources").isDictionary();
  142|  10.8k|    }
  143|  10.9k|    auto kids = cur_node.getKey("/Kids");
  144|  10.9k|    if (!visited.add(kids)) {
  ------------------
  |  Branch (144:9): [True: 15, False: 10.9k]
  ------------------
  145|     15|        throw QPDFExc(
  146|     15|            qpdf_e_pages,
  147|     15|            m->file->getName(),
  148|     15|            "object " + cur_node.getObjGen().unparse(' '),
  149|     15|            0,
  150|     15|            "Loop detected in /Pages structure (getAllPages)");
  151|     15|    }
  152|  10.9k|    int i = -1;
  153|  35.6k|    for (auto& kid: kids.as_array()) {
  ------------------
  |  Branch (153:19): [True: 35.6k, False: 10.9k]
  ------------------
  154|  35.6k|        ++i;
  155|  35.6k|        int errors = 0;
  156|       |
  157|  35.6k|        if (!kid.isDictionary()) {
  ------------------
  |  Branch (157:13): [True: 19.4k, False: 16.1k]
  ------------------
  158|  19.4k|            kid.warn("Pages tree includes non-dictionary object; ignoring");
  159|  19.4k|            invalid_page_found = true;
  160|  19.4k|            continue;
  161|  19.4k|        }
  162|  16.1k|        if (!kid.isIndirect()) {
  ------------------
  |  Branch (162:13): [True: 2.60k, False: 13.5k]
  ------------------
  163|  2.60k|            cur_node.warn(
  164|  2.60k|                "kid " + std::to_string(i) + " (from 0) is direct; converting to indirect");
  165|  2.60k|            kid = qpdf.makeIndirectObject(kid);
  166|  2.60k|            ++errors;
  167|  2.60k|        }
  168|  16.1k|        if (kid.hasKey("/Kids")) {
  ------------------
  |  Branch (168:13): [True: 908, False: 15.2k]
  ------------------
  169|    908|            getAllPagesInternal(kid, level, visited, seen, media_box, resources);
  170|  15.2k|        } else {
  171|  15.2k|            if (!media_box && !kid.getKey("/MediaBox").isRectangle()) {
  ------------------
  |  Branch (171:17): [True: 12.4k, False: 2.74k]
  |  Branch (171:17): [True: 7.99k, False: 7.23k]
  |  Branch (171:31): [True: 7.99k, False: 4.49k]
  ------------------
  172|  7.99k|                kid.warn(
  173|  7.99k|                    "kid " + std::to_string(i) +
  174|  7.99k|                    " (from 0) MediaBox is undefined; setting to letter / ANSI A");
  175|  7.99k|                kid.replaceKey(
  176|  7.99k|                    "/MediaBox",
  177|  7.99k|                    QPDFObjectHandle::newArray(QPDFObjectHandle::Rectangle(0, 0, 612, 792)));
  178|  7.99k|                ++errors;
  179|  7.99k|            }
  180|  15.2k|            if (!resources) {
  ------------------
  |  Branch (180:17): [True: 13.6k, False: 1.58k]
  ------------------
  181|  13.6k|                auto res = kid.getKey("/Resources");
  182|       |
  183|  13.6k|                if (!res.isDictionary()) {
  ------------------
  |  Branch (183:21): [True: 9.61k, False: 4.02k]
  ------------------
  184|  9.61k|                    ++errors;
  185|  9.61k|                    kid.warn(
  186|  9.61k|                        "kid " + std::to_string(i) +
  187|  9.61k|                        " (from 0) Resources is missing or invalid; repairing");
  188|  9.61k|                    kid.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
  189|  9.61k|                }
  190|  13.6k|            }
  191|  15.2k|            auto annots = kid.getKey("/Annots");
  192|  15.2k|            if (!annots.null()) {
  ------------------
  |  Branch (192:17): [True: 1.28k, False: 13.9k]
  ------------------
  193|  1.28k|                if (!annots.isArray()) {
  ------------------
  |  Branch (193:21): [True: 46, False: 1.23k]
  ------------------
  194|     46|                    kid.warn(
  195|     46|                        "kid " + std::to_string(i) + " (from 0) Annots is not an array; removing");
  196|     46|                    kid.removeKey("/Annots");
  197|     46|                    ++errors;
  198|  1.23k|                } else {
  199|  1.23k|                    QPDFObjGen::set seen_annots;
  200|  27.6k|                    for (auto& annot: annots.as_array()) {
  ------------------
  |  Branch (200:37): [True: 27.6k, False: 1.23k]
  ------------------
  201|  27.6k|                        if (!seen_annots.add(annot)) {
  ------------------
  |  Branch (201:29): [True: 453, False: 27.1k]
  ------------------
  202|    453|                            kid.warn(
  203|    453|                                "kid " + std::to_string(i) +
  204|    453|                                " (from 0) Annots has duplicate entry for annotation " +
  205|    453|                                annot.id_gen().unparse(' '));
  206|    453|                            ++errors;
  207|    453|                        }
  208|  27.6k|                    }
  209|  1.23k|                }
  210|  1.28k|            }
  211|       |
  212|  15.2k|            if (!seen.add(kid)) {
  ------------------
  |  Branch (212:17): [True: 1.64k, False: 13.5k]
  ------------------
  213|       |                // Make a copy of the page. This does the same as shallowCopyPage in
  214|       |                // QPDFPageObjectHelper.
  215|  1.64k|                if (!m->reconstructed_xref) {
  ------------------
  |  Branch (215:21): [True: 81, False: 1.56k]
  ------------------
  216|     81|                    cur_node.warn(
  217|     81|                        "kid " + std::to_string(i) +
  218|     81|                        " (from 0) appears more than once in the pages tree;"
  219|     81|                        " creating a new page object as a copy");
  220|       |                    // This needs to be fixed. shallowCopy does not necessarily produce a valid
  221|       |                    // page.
  222|     81|                    kid = qpdf.makeIndirectObject(QPDFObjectHandle(kid).shallowCopy());
  223|     81|                    seen.add(kid);
  224|  1.56k|                } else {
  225|  1.56k|                    cur_node.warn(
  226|  1.56k|                        "kid " + std::to_string(i) +
  227|  1.56k|                        " (from 0) appears more than once in the pages tree; ignoring duplicate");
  228|  1.56k|                    invalid_page_found = true;
  229|  1.56k|                    kid = QPDFObjectHandle::newNull();
  230|  1.56k|                    continue;
  231|  1.56k|                }
  232|     81|                if (!kid.getKey("/Parent").isSameObjectAs(cur_node)) {
  ------------------
  |  Branch (232:21): [True: 67, False: 14]
  ------------------
  233|       |                    // Consider fixing and adding an information message.
  234|     67|                    ++errors;
  235|     67|                }
  236|     81|            }
  237|  13.6k|            if (!kid.isDictionaryOfType("/Page")) {
  ------------------
  |  Branch (237:17): [True: 7.14k, False: 6.51k]
  ------------------
  238|  7.14k|                kid.warn("/Type key should be /Page but is not; overriding");
  239|  7.14k|                kid.replaceKey("/Type", Name("/Page"));
  240|  7.14k|                ++errors;
  241|  7.14k|            }
  242|  13.6k|            if (m->reconstructed_xref && errors > 2) {
  ------------------
  |  Branch (242:17): [True: 11.6k, False: 2.03k]
  |  Branch (242:42): [True: 682, False: 10.9k]
  ------------------
  243|    682|                cur_node.warn(
  244|    682|                    "kid " + std::to_string(i) + " (from 0) has too many errors; ignoring page");
  245|    682|                invalid_page_found = true;
  246|    682|                kid = QPDFObjectHandle::newNull();
  247|    682|                continue;
  248|    682|            }
  249|  12.9k|            all_pages.emplace_back(kid);
  250|  12.9k|        }
  251|  16.1k|    }
  252|  10.9k|}
_ZN4QPDF3Doc5Pages16flattenPagesTreeEv:
  274|  2.16k|{
  275|       |    // If not already done, flatten the /Pages structure and initialize pageobj_to_pages_pos.
  276|       |
  277|  2.16k|    if (!pageobj_to_pages_pos.empty()) {
  ------------------
  |  Branch (277:9): [True: 0, False: 2.16k]
  ------------------
  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|  2.16k|    pushInheritedAttributesToPage(true, true);
  284|       |
  285|  2.16k|    QPDFObjectHandle pages = qpdf.getRoot().getKey("/Pages");
  286|       |
  287|  2.16k|    size_t const len = all_pages.size();
  288|  5.86k|    for (size_t pos = 0; pos < len; ++pos) {
  ------------------
  |  Branch (288:26): [True: 3.69k, False: 2.16k]
  ------------------
  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|  3.69k|        insertPageobjToPage(all_pages.at(pos), toI(pos), true);
  293|  3.69k|        all_pages.at(pos).replaceKey("/Parent", pages);
  294|  3.69k|    }
  295|       |
  296|  2.16k|    pages.replaceKey("/Kids", Array(all_pages));
  297|       |    // /Count has not changed
  298|  2.16k|    if (pages.getKey("/Count").getUIntValue() != len) {
  ------------------
  |  Branch (298:9): [True: 1.36k, False: 808]
  ------------------
  299|  1.36k|        if (invalid_page_found && pages.getKey("/Count").getUIntValue() > len) {
  ------------------
  |  Branch (299:13): [True: 1.36k, False: 0]
  |  Branch (299:13): [True: 1.28k, False: 77]
  |  Branch (299:35): [True: 1.28k, False: 77]
  ------------------
  300|  1.28k|            pages.replaceKey("/Count", Integer(len));
  301|  1.28k|        } else {
  302|     77|            throw std::runtime_error("/Count is wrong after flattening pages tree");
  303|     77|        }
  304|  1.36k|    }
  305|  2.16k|}
_ZN4QPDF3Doc5Pages29pushInheritedAttributesToPageEbb:
  316|  2.16k|{
  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|  2.16k|    if (pushed_inherited_attributes_to_pages && !warn_skipped_keys) {
  ------------------
  |  Branch (321:9): [True: 0, False: 2.16k]
  |  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|  2.16k|    (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|  2.16k|    std::map<std::string, std::vector<QPDFObjectHandle>> key_ancestors;
  332|  2.16k|    pushInheritedAttributesToPageInternal(
  333|  2.16k|        m->trailer.getKey("/Root").getKey("/Pages"),
  334|  2.16k|        key_ancestors,
  335|  2.16k|        allow_changes,
  336|  2.16k|        warn_skipped_keys);
  337|  2.16k|    util::assertion(
  338|  2.16k|        key_ancestors.empty(),
  339|  2.16k|        "key_ancestors not empty after pushing inherited attributes to pages");
  340|  2.16k|    pushed_inherited_attributes_to_pages = true;
  341|  2.16k|    ever_pushed_inherited_attributes_to_pages_ = true;
  342|  2.16k|}
_ZN4QPDF3Doc5Pages37pushInheritedAttributesToPageInternalE16QPDFObjectHandleRNSt3__13mapINS3_12basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS3_6vectorIS2_NS8_IS2_EEEENS3_4lessISA_EENS8_INS3_4pairIKSA_SD_EEEEEEbb:
  350|  2.88k|{
  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|  2.88k|    std::set<std::string> inheritable_keys;
  356|  14.3k|    for (auto const& key: cur_pages.getKeys()) {
  ------------------
  |  Branch (356:25): [True: 14.3k, False: 2.88k]
  ------------------
  357|  14.3k|        if (key == "/MediaBox" || key == "/CropBox" || key == "/Resources" || key == "/Rotate") {
  ------------------
  |  Branch (357:13): [True: 471, False: 13.8k]
  |  Branch (357:35): [True: 156, False: 13.7k]
  |  Branch (357:56): [True: 188, False: 13.5k]
  |  Branch (357:79): [True: 196, False: 13.3k]
  ------------------
  358|  1.01k|            if (!allow_changes) {
  ------------------
  |  Branch (358:17): [True: 0, False: 1.01k]
  ------------------
  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.01k|            inheritable_keys.insert(key);
  370|  1.01k|            auto oh = cur_pages[key];
  371|  1.01k|            QTC::TC("qpdf", "QPDF opt direct pages resource", oh.indirect() ? 0 : 1);
  ------------------
  |  Branch (371:63): [True: 61, False: 950]
  ------------------
  372|  1.01k|            if (!oh.indirect()) {
  ------------------
  |  Branch (372:17): [True: 950, False: 61]
  ------------------
  373|    950|                if (!oh.isScalar()) {
  ------------------
  |  Branch (373:21): [True: 574, False: 376]
  ------------------
  374|       |                    // Replace shared direct object non-scalar resources with indirect objects to
  375|       |                    // avoid copying large structures around.
  376|    574|                    cur_pages.replaceKey(key, qpdf.makeIndirectObject(oh));
  377|    574|                    oh = cur_pages[key];
  378|    574|                } else {
  379|       |                    // It's okay to copy scalars.
  380|    376|                }
  381|    950|            }
  382|  1.01k|            key_ancestors[key].emplace_back(oh);
  383|  1.01k|            if (key_ancestors[key].size() > 1) {
  ------------------
  |  Branch (383:17): [True: 193, False: 818]
  ------------------
  384|    193|            }
  385|       |            // Remove this resource from this node.  It will be reattached at the page level.
  386|  1.01k|            cur_pages.erase(key);
  387|  13.3k|        } else if (!(key == "/Type" || key == "/Parent" || key == "/Kids" || key == "/Count")) {
  ------------------
  |  Branch (387:22): [True: 2.87k, False: 10.4k]
  |  Branch (387:40): [True: 217, False: 10.2k]
  |  Branch (387:60): [True: 2.88k, False: 7.35k]
  |  Branch (387:78): [True: 1.58k, False: 5.76k]
  ------------------
  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|  5.76k|            if (warn_skipped_keys && cur_pages.contains("/Parent")) {
  ------------------
  |  Branch (390:17): [True: 5.76k, False: 0]
  |  Branch (390:17): [True: 1.19k, False: 4.57k]
  |  Branch (390:38): [True: 1.19k, False: 4.57k]
  ------------------
  391|  1.19k|                warn(
  392|  1.19k|                    qpdf_e_pages,
  393|  1.19k|                    "Pages object: object " + cur_pages.id_gen().unparse(' '),
  394|  1.19k|                    cur_pages.offset(),
  395|  1.19k|                    ("Unknown key " + key +
  396|  1.19k|                     " in /Pages object is being discarded as a result of flattening the /Pages "
  397|  1.19k|                     "tree"));
  398|  1.19k|            }
  399|  5.76k|        }
  400|  14.3k|    }
  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|  22.8k|    for (auto& kid: Array(cur_pages["/Kids"])) {
  ------------------
  |  Branch (405:19): [True: 22.8k, False: 2.88k]
  ------------------
  406|  22.8k|        if (kid.isDictionaryOfType("/Pages")) {
  ------------------
  |  Branch (406:13): [True: 718, False: 22.0k]
  ------------------
  407|    718|            pushInheritedAttributesToPageInternal(
  408|    718|                kid, key_ancestors, allow_changes, warn_skipped_keys);
  409|  22.0k|        } else {
  410|       |            // Add all available inheritable attributes not present in this object to this object.
  411|  22.0k|            for (auto const& [key, values]: key_ancestors) {
  ------------------
  |  Branch (411:43): [True: 5.52k, False: 22.0k]
  ------------------
  412|  5.52k|                if (!kid.contains(key)) {
  ------------------
  |  Branch (412:21): [True: 4.57k, False: 950]
  ------------------
  413|  4.57k|                    kid.replaceKey(key, values.back());
  414|  4.57k|                } else {
  415|    950|                    QTC::TC("qpdf", "QPDF opt page resource hides ancestor");
  416|    950|                }
  417|  5.52k|            }
  418|  22.0k|        }
  419|  22.8k|    }
  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|  2.88k|    if (!inheritable_keys.empty()) {
  ------------------
  |  Branch (425:9): [True: 494, False: 2.39k]
  ------------------
  426|    788|        for (auto const& key: inheritable_keys) {
  ------------------
  |  Branch (426:29): [True: 788, False: 494]
  ------------------
  427|    788|            key_ancestors[key].pop_back();
  428|    788|            if (key_ancestors[key].empty()) {
  ------------------
  |  Branch (428:17): [True: 608, False: 180]
  ------------------
  429|    608|                key_ancestors.erase(key);
  430|    608|            }
  431|    788|        }
  432|  2.39k|    } else {
  433|  2.39k|        QTC::TC("qpdf", "QPDF opt no inheritable keys");
  434|  2.39k|    }
  435|  2.88k|}
_ZN4QPDF3Doc5Pages19insertPageobjToPageERK16QPDFObjectHandleib:
  439|  3.69k|{
  440|  3.69k|    QPDFObjGen og(obj.getObjGen());
  441|  3.69k|    if (check_duplicate) {
  ------------------
  |  Branch (441:9): [True: 3.69k, False: 0]
  ------------------
  442|  3.69k|        if (!pageobj_to_pages_pos.insert(std::make_pair(og, pos)).second) {
  ------------------
  |  Branch (442:13): [True: 0, False: 3.69k]
  ------------------
  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|  3.69k|    } else {
  452|      0|        pageobj_to_pages_pos[og] = pos;
  453|      0|    }
  454|  3.69k|}

_ZN5QUtil13int_to_stringExi:
  331|  85.3k|{
  332|  85.3k|    return int_to_string_base(num, 10, length);
  333|  85.3k|}
_ZN5QUtil18int_to_string_baseExii:
  343|   132k|{
  344|   132k|    return int_to_string_base_internal(num, base, length);
  345|   132k|}
_ZN5QUtil16double_to_stringEdib:
  355|  31.9k|{
  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|  31.9k|    if (decimal_places <= 0) {
  ------------------
  |  Branch (359:9): [True: 31.9k, False: 0]
  ------------------
  360|  31.9k|        decimal_places = 6;
  361|  31.9k|    }
  362|  31.9k|    std::ostringstream buf;
  363|  31.9k|    buf.imbue(std::locale::classic());
  364|  31.9k|    buf << std::setprecision(decimal_places) << std::fixed << num;
  365|  31.9k|    std::string result = buf.str();
  366|  31.9k|    if (trim_trailing_zeroes) {
  ------------------
  |  Branch (366:9): [True: 31.9k, False: 0]
  ------------------
  367|   223k|        while ((result.length() > 1) && (result.back() == '0')) {
  ------------------
  |  Branch (367:16): [True: 223k, False: 0]
  |  Branch (367:41): [True: 191k, False: 31.9k]
  ------------------
  368|   191k|            result.pop_back();
  369|   191k|        }
  370|  31.9k|        if ((result.length() > 1) && (result.back() == '.')) {
  ------------------
  |  Branch (370:13): [True: 31.9k, False: 0]
  |  Branch (370:38): [True: 31.9k, False: 0]
  ------------------
  371|  31.9k|            result.pop_back();
  372|  31.9k|        }
  373|  31.9k|    }
  374|  31.9k|    return result;
  375|  31.9k|}
_ZN5QUtil12string_to_llEPKc:
  379|  3.23M|{
  380|  3.23M|    errno = 0;
  381|       |#ifdef _MSC_VER
  382|       |    long long result = _strtoi64(str, 0, 10);
  383|       |#else
  384|  3.23M|    long long result = strtoll(str, nullptr, 10);
  385|  3.23M|#endif
  386|  3.23M|    if (errno == ERANGE) {
  ------------------
  |  Branch (386:9): [True: 901, False: 3.23M]
  ------------------
  387|    901|        throw std::range_error(
  388|    901|            std::string("overflow/underflow converting ") + str + " to 64-bit integer");
  389|    901|    }
  390|  3.23M|    return result;
  391|  3.23M|}
_ZN5QUtil13string_to_intEPKc:
  395|   692k|{
  396|       |    // QIntC::to_int does range checking
  397|   692k|    return QIntC::to_int(string_to_ll(str));
  398|   692k|}
_ZN5QUtil21unsigned_char_pointerERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  447|   136k|{
  448|   136k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str.c_str()));
  449|   136k|}
_ZN5QUtil21unsigned_char_pointerEPKc:
  453|  5.42k|{
  454|  5.42k|    return reinterpret_cast<unsigned char*>(const_cast<char*>(str));
  455|  5.42k|}
_ZN5QUtil16make_unique_cstrERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  717|  5.42k|{
  718|  5.42k|    auto result = std::make_unique<char[]>(str.length() + 1);
  719|       |    // Use memcpy in case string contains nulls
  720|  5.42k|    result.get()[str.length()] = '\0';
  721|  5.42k|    memcpy(result.get(), str.c_str(), str.length());
  722|  5.42k|    return result;
  723|  5.42k|}
_ZN5QUtil10hex_encodeERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  727|  8.38k|{
  728|  8.38k|    static auto constexpr hexchars = "0123456789abcdef";
  729|  8.38k|    std::string result;
  730|  8.38k|    result.reserve(2 * input.length());
  731|   134k|    for (const char c: input) {
  ------------------
  |  Branch (731:22): [True: 134k, False: 8.38k]
  ------------------
  732|   134k|        result += hexchars[static_cast<unsigned char>(c) >> 4];
  733|   134k|        result += hexchars[c & 0x0f];
  734|   134k|    }
  735|  8.38k|    return result;
  736|  8.38k|}
_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|}
_ZN5QUtil21getRandomDataProviderEv:
 1126|    335|{
 1127|    335|    return getRandomDataProviderProvider()->getProvider();
 1128|    335|}
_ZN5QUtil25initializeWithRandomBytesEPhm:
 1132|    335|{
 1133|    335|    getRandomDataProvider()->provideRandomData(data, len);
 1134|    335|}
QUtil.cc:_ZL29getRandomDataProviderProviderv:
 1112|    335|{
 1113|       |    // Thread-safe static initializer
 1114|    335|    static RandomDataProviderProvider rdpp;
 1115|    335|    return &rdpp;
 1116|    335|}
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|    335|{
 1101|    335|    return this->current_provider;
 1102|    335|}
QUtil.cc:_ZL27int_to_string_base_internalIxENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEET_ii:
  300|   132k|{
  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|   132k|    if (!((base == 8) || (base == 10) || (base == 16))) {
  ------------------
  |  Branch (304:11): [True: 46.8k, False: 85.3k]
  |  Branch (304:26): [True: 85.3k, 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|   132k|    std::string cvt;
  308|   132k|    if (base == 10) {
  ------------------
  |  Branch (308:9): [True: 85.3k, False: 46.8k]
  ------------------
  309|       |        // Use the more efficient std::to_string when possible
  310|  85.3k|        cvt = std::to_string(num);
  311|  85.3k|    } else {
  312|  46.8k|        std::ostringstream buf;
  313|  46.8k|        buf.imbue(std::locale::classic());
  314|  46.8k|        buf << std::setbase(base) << std::nouppercase << num;
  315|  46.8k|        cvt = buf.str();
  316|  46.8k|    }
  317|   132k|    std::string result;
  318|   132k|    int str_length = QIntC::to_int(cvt.length());
  319|   132k|    if ((length > 0) && (str_length < length)) {
  ------------------
  |  Branch (319:9): [True: 132k, False: 0]
  |  Branch (319:25): [True: 97.3k, False: 34.8k]
  ------------------
  320|  97.3k|        result.append(QIntC::to_size(length - str_length), '0');
  321|  97.3k|    }
  322|   132k|    result += cvt;
  323|   132k|    if ((length < 0) && (str_length < -length)) {
  ------------------
  |  Branch (323:9): [True: 0, False: 132k]
  |  Branch (323:25): [True: 0, False: 0]
  ------------------
  324|      0|        result.append(QIntC::to_size(-length - str_length), ' ');
  325|      0|    }
  326|   132k|    return result;
  327|   132k|}

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

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

_ZN17SF_FlateLzwDecode14setDecodeParmsE16QPDFObjectHandle:
   13|  19.1k|{
   14|  19.1k|    if (decode_parms.null()) {
  ------------------
  |  Branch (14:9): [True: 15.2k, False: 3.84k]
  ------------------
   15|  15.2k|        return true;
   16|  15.2k|    }
   17|       |
   18|  3.84k|    auto memory_limit = Pl_Flate::memory_limit();
   19|       |
   20|  3.84k|    std::set<std::string> keys = decode_parms.getKeys();
   21|  10.0k|    for (auto const& key: keys) {
  ------------------
  |  Branch (21:25): [True: 10.0k, False: 3.68k]
  ------------------
   22|  10.0k|        QPDFObjectHandle value = decode_parms.getKey(key);
   23|  10.0k|        if (key == "/Predictor") {
  ------------------
  |  Branch (23:13): [True: 2.41k, False: 7.60k]
  ------------------
   24|  2.41k|            if (value.isInteger()) {
  ------------------
  |  Branch (24:17): [True: 2.40k, False: 10]
  ------------------
   25|  2.40k|                predictor = value.getIntValueAsInt();
   26|  2.40k|                if (!(predictor == 1 || predictor == 2 || (predictor >= 10 && predictor <= 15))) {
  ------------------
  |  Branch (26:23): [True: 66, False: 2.34k]
  |  Branch (26:41): [True: 609, False: 1.73k]
  |  Branch (26:60): [True: 1.69k, False: 42]
  |  Branch (26:79): [True: 1.66k, False: 24]
  ------------------
   27|     66|                    return false;
   28|     66|                }
   29|  2.40k|            } else {
   30|     10|                return false;
   31|     10|            }
   32|  7.60k|        } else if (key == "/Columns" || key == "/Colors" || key == "/BitsPerComponent") {
  ------------------
  |  Branch (32:20): [True: 1.36k, False: 6.24k]
  |  Branch (32:41): [True: 578, False: 5.66k]
  |  Branch (32:61): [True: 447, False: 5.21k]
  ------------------
   33|  2.38k|            if (value.isInteger()) {
  ------------------
  |  Branch (33:17): [True: 2.37k, False: 10]
  ------------------
   34|  2.37k|                int val = value.getIntValueAsInt();
   35|  2.37k|                if (memory_limit && static_cast<unsigned int>(val) > memory_limit) {
  ------------------
  |  Branch (35:21): [True: 2.37k, False: 1]
  |  Branch (35:37): [True: 24, False: 2.35k]
  ------------------
   36|     24|                    QPDFLogger::defaultLogger()->warn(
   37|     24|                        "SF_FlateLzwDecode parameter exceeds PL_Flate memory limit\n");
   38|     24|                    return false;
   39|     24|                }
   40|  2.35k|                if (key == "/Columns") {
  ------------------
  |  Branch (40:21): [True: 1.35k, False: 1.00k]
  ------------------
   41|  1.35k|                    columns = val;
   42|  1.35k|                } else if (key == "/Colors") {
  ------------------
  |  Branch (42:28): [True: 555, False: 446]
  ------------------
   43|    555|                    colors = val;
   44|    555|                } else if (key == "/BitsPerComponent") {
  ------------------
  |  Branch (44:28): [True: 445, False: 1]
  ------------------
   45|    445|                    bits_per_component = val;
   46|    445|                }
   47|  2.35k|            } else {
   48|     10|                return false;
   49|     10|            }
   50|  5.21k|        } else if (lzw && (key == "/EarlyChange")) {
  ------------------
  |  Branch (50:20): [True: 4.90k, False: 311]
  |  Branch (50:27): [True: 173, False: 4.73k]
  ------------------
   51|    173|            if (value.isInteger()) {
  ------------------
  |  Branch (51:17): [True: 170, False: 3]
  ------------------
   52|    170|                int earlychange = value.getIntValueAsInt();
   53|    170|                early_code_change = (earlychange == 1);
   54|    170|                if (!(earlychange == 0 || earlychange == 1)) {
  ------------------
  |  Branch (54:23): [True: 63, False: 107]
  |  Branch (54:43): [True: 64, False: 43]
  ------------------
   55|     43|                    return false;
   56|     43|                }
   57|    170|            } else {
   58|      3|                return false;
   59|      3|            }
   60|    173|        }
   61|  10.0k|    }
   62|       |
   63|  3.68k|    if (predictor > 1 && columns == 0) {
  ------------------
  |  Branch (63:9): [True: 2.27k, False: 1.40k]
  |  Branch (63:26): [True: 3, False: 2.27k]
  ------------------
   64|      3|        return false;
   65|      3|    }
   66|       |
   67|  3.68k|    return true;
   68|  3.68k|}
_ZN17SF_FlateLzwDecode17getDecodePipelineEP8Pipeline:
   72|  18.9k|{
   73|  18.9k|    std::unique_ptr<Pipeline> pipeline;
   74|  18.9k|    if (predictor >= 10 && predictor <= 15) {
  ------------------
  |  Branch (74:9): [True: 1.64k, False: 17.2k]
  |  Branch (74:28): [True: 1.64k, False: 0]
  ------------------
   75|  1.64k|        QTC::TC("qpdf", "SF_FlateLzwDecode PNG filter");
   76|  1.64k|        pipeline = std::make_unique<Pl_PNGFilter>(
   77|  1.64k|            "png decode",
   78|  1.64k|            next,
   79|  1.64k|            Pl_PNGFilter::a_decode,
   80|  1.64k|            QIntC::to_uint(columns),
   81|  1.64k|            QIntC::to_uint(colors),
   82|  1.64k|            QIntC::to_uint(bits_per_component));
   83|  1.64k|        next = pipeline.get();
   84|  1.64k|        pipelines.push_back(std::move(pipeline));
   85|  17.2k|    } else if (predictor == 2) {
  ------------------
  |  Branch (85:16): [True: 603, False: 16.6k]
  ------------------
   86|    603|        QTC::TC("qpdf", "SF_FlateLzwDecode TIFF predictor");
   87|    603|        pipeline = std::make_unique<Pl_TIFFPredictor>(
   88|    603|            "tiff decode",
   89|    603|            next,
   90|    603|            Pl_TIFFPredictor::a_decode,
   91|    603|            QIntC::to_uint(columns),
   92|    603|            QIntC::to_uint(colors),
   93|    603|            QIntC::to_uint(bits_per_component));
   94|    603|        next = pipeline.get();
   95|    603|        pipelines.push_back(std::move(pipeline));
   96|    603|    }
   97|       |
   98|  18.9k|    if (lzw) {
  ------------------
  |  Branch (98:9): [True: 2.55k, False: 16.3k]
  ------------------
   99|  2.55k|        pipeline = std::make_unique<Pl_LZWDecoder>("lzw decode", next, early_code_change);
  100|  16.3k|    } else {
  101|  16.3k|        pipeline = std::make_unique<Pl_Flate>("stream inflate", next, Pl_Flate::a_inflate);
  102|  16.3k|    }
  103|  18.9k|    next = pipeline.get();
  104|  18.9k|    pipelines.push_back(std::move(pipeline));
  105|  18.9k|    return next;
  106|  18.9k|}

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

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

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

_ZN17ContentNormalizerC2Ev:
    9|  45.5k|    ContentNormalizer() = default;
_ZNK17ContentNormalizer12anyBadTokensEv:
   15|  17.3k|    {
   16|  17.3k|        return any_bad_tokens;
   17|  17.3k|    }
_ZNK17ContentNormalizer15lastTokenWasBadEv:
   20|    731|    {
   21|    731|        return last_token_was_bad;
   22|    731|    }

_ZN4qpdf2is12OffsetBufferD2Ev:
   42|  37.6k|        ~OffsetBuffer() final = default;
_ZNK4qpdf2is12OffsetBuffer7getNameEv:
   48|     28|        {
   49|     28|            return description;
   50|     28|        }
_ZN4qpdf2is12OffsetBuffer4tellEv:
   54|  25.5M|        {
   55|  25.5M|            return pos + global_offset;
   56|  25.5M|        }
_ZN4qpdf2is12OffsetBufferC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_17basic_string_viewIcS5_EEx:
   21|  37.7k|            description(description),
   22|  37.7k|            view_(view),
   23|  37.7k|            global_offset(global_offset)
   24|  37.7k|        {
   25|  37.7k|            if (global_offset < 0) {
  ------------------
  |  Branch (25:17): [True: 41, False: 37.6k]
  ------------------
   26|     41|                throw std::logic_error("is::OffsetBuffer constructed with negative offset");
   27|     41|            }
   28|  37.6k|            last_offset = global_offset;
   29|  37.6k|        }
_ZN11InputSource4readERNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEmx:
   87|  56.5k|{
   88|  56.5k|    if (at >= 0) {
  ------------------
  |  Branch (88:9): [True: 45.4k, False: 11.0k]
  ------------------
   89|       |        seek(at, SEEK_SET);
   90|  45.4k|    }
   91|  56.5k|    str.resize(count);
   92|  56.5k|    str.resize(read(str.data(), count));
   93|  56.5k|    return str.size();
   94|  56.5k|}
_ZN11InputSource4readEmx:
   98|  45.4k|{
   99|  45.4k|    std::string result(count, '\0');
  100|  45.4k|    (void)read(result, count, at);
  101|  45.4k|    return result;
  102|  45.4k|}
_ZN11InputSource10loadBufferEv:
  106|  2.64M|{
  107|  2.64M|    buf_idx = 0;
  108|  2.64M|    buf_len = qpdf_offset_t(read(buffer, buf_size));
  109|       |    // NB read sets last_offset
  110|  2.64M|    buf_start = last_offset;
  111|  2.64M|}
_ZN11InputSource8fastTellEv:
  115|  35.7M|{
  116|  35.7M|    if (buf_len == 0) {
  ------------------
  |  Branch (116:9): [True: 95.7k, False: 35.6M]
  ------------------
  117|  95.7k|        loadBuffer();
  118|  35.6M|    } else {
  119|  35.6M|        auto curr = tell();
  120|  35.6M|        if (curr < buf_start || curr >= (buf_start + buf_len)) {
  ------------------
  |  Branch (120:13): [True: 55.5k, False: 35.5M]
  |  Branch (120:33): [True: 2.48M, False: 33.0M]
  ------------------
  121|  2.54M|            loadBuffer();
  122|  33.0M|        } else {
  123|  33.0M|            last_offset = curr;
  124|  33.0M|            buf_idx = curr - buf_start;
  125|  33.0M|        }
  126|  35.6M|    }
  127|  35.7M|    return last_offset;
  128|  35.7M|}
_ZN11InputSource8fastReadERc:
  132|   317M|{
  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|   317M|    if (buf_idx < buf_len) {
  ------------------
  |  Branch (135:9): [True: 315M, False: 2.19M]
  ------------------
  136|   315M|        ch = buffer[buf_idx];
  137|   315M|        ++(buf_idx);
  138|   315M|        ++(last_offset);
  139|   315M|        return true;
  140|       |
  141|   315M|    } else if (buf_len == 0) {
  ------------------
  |  Branch (141:16): [True: 46.1k, False: 2.14M]
  ------------------
  142|  46.1k|        return false;
  143|  2.14M|    } else {
  144|       |        seek(buf_start + buf_len, SEEK_SET);
  145|  2.14M|        fastTell();
  146|  2.14M|        return fastRead(ch);
  147|  2.14M|    }
  148|   317M|}
_ZN11InputSource10fastUnreadEb:
  152|  33.5M|{
  153|  33.5M|    last_offset -= back ? 1 : 0;
  ------------------
  |  Branch (153:20): [True: 31.9M, False: 1.64M]
  ------------------
  154|       |    seek(last_offset, SEEK_SET);
  155|  33.5M|}

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

_ZN8ObjTableIN10QPDFWriter6ObjectEEC2Ev:
   32|  8.57k|    ObjTable() = default;
_ZN8ObjTableIN10QPDFWriter9NewObjectEEC2Ev:
   32|  8.57k|    ObjTable() = default;
_ZN8ObjTableIN10QPDFWriter9NewObjectEEixEi:
   80|   369k|    {
   81|   369k|        return element(static_cast<size_t>(id));
   82|   369k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE7elementEm:
  148|   369k|    {
  149|   369k|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (149:13): [True: 358k, False: 11.3k]
  ------------------
  150|   358k|            return std::vector<T>::operator[](idx);
  151|   358k|        }
  152|  11.3k|        return large_element(idx);
  153|   369k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE13large_elementEm:
  158|  11.3k|    {
  159|  11.3k|        static const size_t max_size = std::vector<T>::max_size();
  160|  11.3k|        if (idx < min_sparse) {
  ------------------
  |  Branch (160:13): [True: 70, False: 11.3k]
  ------------------
  161|     70|            min_sparse = idx;
  162|     70|        }
  163|  11.3k|        if (idx < max_size) {
  ------------------
  |  Branch (163:13): [True: 11.3k, False: 0]
  ------------------
  164|  11.3k|            return sparse_elements[idx];
  165|  11.3k|        }
  166|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  167|      0|        return element(0); // doesn't return
  168|  11.3k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEEixE10QPDFObjGen:
   86|   975k|    {
   87|   975k|        return element(static_cast<size_t>(og.getObj()));
   88|   975k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE7elementEm:
  148|  1.12M|    {
  149|  1.12M|        if (idx < std::vector<T>::size()) {
  ------------------
  |  Branch (149:13): [True: 1.06M, False: 60.2k]
  ------------------
  150|  1.06M|            return std::vector<T>::operator[](idx);
  151|  1.06M|        }
  152|  60.2k|        return large_element(idx);
  153|  1.12M|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE13large_elementEm:
  158|  60.2k|    {
  159|  60.2k|        static const size_t max_size = std::vector<T>::max_size();
  160|  60.2k|        if (idx < min_sparse) {
  ------------------
  |  Branch (160:13): [True: 1.12k, False: 59.1k]
  ------------------
  161|  1.12k|            min_sparse = idx;
  162|  1.12k|        }
  163|  60.2k|        if (idx < max_size) {
  ------------------
  |  Branch (163:13): [True: 60.2k, False: 0]
  ------------------
  164|  60.2k|            return sparse_elements[idx];
  165|  60.2k|        }
  166|      0|        throw std::runtime_error("Impossibly large object id encountered accessing ObjTable");
  167|      0|        return element(0); // doesn't return
  168|  60.2k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEEixE16QPDFObjectHandle:
   92|   145k|    {
   93|   145k|        return element(static_cast<size_t>(oh.getObjectID()));
   94|   145k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE6resizeEm:
  116|  8.57k|    {
  117|  8.57k|        std::vector<T>::resize(a_size);
  118|  8.57k|        if (a_size > min_sparse) {
  ------------------
  |  Branch (118:13): [True: 0, False: 8.57k]
  ------------------
  119|      0|            auto it = sparse_elements.begin();
  120|      0|            auto end = sparse_elements.end();
  121|      0|            while (it != end && it->first < a_size) {
  ------------------
  |  Branch (121:20): [True: 0, False: 0]
  |  Branch (121:33): [True: 0, False: 0]
  ------------------
  122|      0|                std::vector<T>::operator[](it->first) = std::move(it->second);
  123|      0|                it = sparse_elements.erase(it);
  124|      0|            }
  125|      0|            min_sparse = (it == end) ? std::numeric_limits<size_t>::max() : it->first;
  ------------------
  |  Branch (125:26): [True: 0, False: 0]
  ------------------
  126|      0|        }
  127|  8.57k|    }
_ZN8ObjTableIN10QPDFWriter9NewObjectEE6resizeEm:
  116|  8.57k|    {
  117|  8.57k|        std::vector<T>::resize(a_size);
  118|  8.57k|        if (a_size > min_sparse) {
  ------------------
  |  Branch (118:13): [True: 0, False: 8.57k]
  ------------------
  119|      0|            auto it = sparse_elements.begin();
  120|      0|            auto end = sparse_elements.end();
  121|      0|            while (it != end && it->first < a_size) {
  ------------------
  |  Branch (121:20): [True: 0, False: 0]
  |  Branch (121:33): [True: 0, False: 0]
  ------------------
  122|      0|                std::vector<T>::operator[](it->first) = std::move(it->second);
  123|      0|                it = sparse_elements.erase(it);
  124|      0|            }
  125|      0|            min_sparse = (it == end) ? std::numeric_limits<size_t>::max() : it->first;
  ------------------
  |  Branch (125:26): [True: 0, False: 0]
  ------------------
  126|      0|        }
  127|  8.57k|    }
_ZN8ObjTableIN10QPDFWriter6ObjectEE7forEachENSt3__18functionIFviRKS1_EEE:
  131|    980|    {
  132|    980|        int i = 0;
  133|  3.17M|        for (auto const& item: *this) {
  ------------------
  |  Branch (133:30): [True: 3.17M, False: 980]
  ------------------
  134|  3.17M|            fn(i++, item);
  135|  3.17M|        }
  136|    980|        for (auto const& [id, item]: sparse_elements) {
  ------------------
  |  Branch (136:36): [True: 749, False: 980]
  ------------------
  137|    749|            fn(QIntC::to_int(id), item);
  138|    749|        }
  139|    980|    }

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

_ZN4qpdf2pl6StringC2ERNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   23|  8.03k|            Pipeline("", nullptr),
   24|  8.03k|            str(str)
   25|  8.03k|        {
   26|  8.03k|        }
_ZN4qpdf2pl6String5writeEPKhm:
   32|  7.18M|        {
   33|  7.18M|            if (len) {
  ------------------
  |  Branch (33:17): [True: 7.18M, False: 336]
  ------------------
   34|  7.18M|                str.append(reinterpret_cast<char const*>(buf), len);
   35|  7.18M|            }
   36|  7.18M|        }
_ZN4qpdf2pl6String6finishEv:
   40|  7.64k|        {
   41|  7.64k|        }
_ZN4qpdf2pl6StringC2EPKcP8PipelineRNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEE:
   17|  2.79k|            Pipeline(identifier, nullptr),
   18|  2.79k|            str(str)
   19|  2.79k|        {
   20|  2.79k|        }
_ZN4qpdf2pl5CountC2EmP8Pipeline:
   53|  20.3k|            Pipeline("", next),
   54|  20.3k|            id_(id),
   55|  20.3k|            pass_immediately_to_next(next)
   56|  20.3k|        {
   57|  20.3k|        }
_ZN4qpdf2pl5CountC2EmRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_10unique_ptrI8PipelineNS2_14default_deleteISB_EEEE:
   62|  44.5k|            Pipeline("", link.get()),
   63|  44.5k|            str(&str),
   64|  44.5k|            link(std::move(link)),
   65|  44.5k|            id_(id)
   66|  44.5k|        {
   67|  44.5k|        }
_ZN4qpdf2pl5Count5writeEPKhm:
   73|  8.03M|        {
   74|  8.03M|            if (len) {
  ------------------
  |  Branch (74:17): [True: 8.01M, False: 12.2k]
  ------------------
   75|  8.01M|                Count::write(std::string_view(reinterpret_cast<char const*>(buf), len));
   76|  8.01M|            }
   77|  8.03M|        }
_ZN4qpdf2pl5Count5writeENSt3__117basic_string_viewIcNS2_11char_traitsIcEEEE:
   81|  49.6M|        {
   82|  49.6M|            if (sv.size()) {
  ------------------
  |  Branch (82:17): [True: 49.6M, False: 11.2k]
  ------------------
   83|  49.6M|                if (str) {
  ------------------
  |  Branch (83:21): [True: 39.4M, False: 10.2M]
  ------------------
   84|  39.4M|                    str->append(sv);
   85|  39.4M|                    return;
   86|  39.4M|                }
   87|  10.2M|                count += static_cast<qpdf_offset_t>(sv.size());
   88|  10.2M|                if (pass_immediately_to_next) {
  ------------------
  |  Branch (88:21): [True: 10.1M, False: 55.8k]
  ------------------
   89|  10.1M|                    next()->write(reinterpret_cast<char const*>(sv.data()), sv.size());
   90|  10.1M|                }
   91|  10.2M|            }
   92|  49.6M|        }
_ZN4qpdf2pl5Count6finishEv:
  111|   102k|        {
  112|   102k|            if (next()) {
  ------------------
  |  Branch (112:17): [True: 25.4k, False: 76.9k]
  ------------------
  113|  25.4k|                if (!pass_immediately_to_next) {
  ------------------
  |  Branch (113:21): [True: 0, False: 25.4k]
  ------------------
  114|      0|                    next()->write(reinterpret_cast<unsigned char const*>(str->data()), str->size());
  115|      0|                }
  116|  25.4k|                next()->finish();
  117|  25.4k|            }
  118|   102k|        }
_ZNK4qpdf2pl5Count8getCountEv:
  122|   270k|        {
  123|   270k|            return str ? static_cast<qpdf_offset_t>(str->size()) : count;
  ------------------
  |  Branch (123:20): [True: 18.6k, False: 251k]
  ------------------
  124|   270k|        }
_ZNK4qpdf2pl5Count2idEv:
  128|  56.2k|        {
  129|  56.2k|            return id_;
  130|  56.2k|        }
_ZN4qpdf2pl5CountD2Ev:
   69|  64.8k|        ~Count() final = default;

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

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

_ZN6Pl_MD512getHexDigestEv:
   35|  8.38k|    {
   36|  8.38k|        qpdf::util::assertion(enabled, "digest requested for a disabled MD5 Pipeline");
   37|  8.38k|        in_progress = false;
   38|  8.38k|        return md5.unparse();
   39|  8.38k|    }
_ZN6Pl_MD56enableEb:
   45|  8.38k|    {
   46|  8.38k|        enabled = val;
   47|  8.38k|    }
_ZN6Pl_MD5D2Ev:
   21|  8.50k|    ~Pl_MD5() final = default;
_ZN6Pl_MD5C2EPKcP8Pipeline:
   17|  8.50k|        Pipeline(identifier, next)
   18|  8.50k|    {
   19|  8.50k|    }
_ZN6Pl_MD519persistAcrossFinishEb:
   52|  8.50k|    {
   53|  8.50k|        persist_across_finish = val;
   54|  8.50k|    }
_ZN6Pl_MD56finishEv:
   25|  8.50k|    {
   26|  8.50k|        if (next()) {
  ------------------
  |  Branch (26:13): [True: 8.50k, False: 0]
  ------------------
   27|  8.50k|            next()->finish();
   28|  8.50k|        }
   29|  8.50k|        if (!persist_across_finish) {
  ------------------
  |  Branch (29:13): [True: 0, False: 8.50k]
  ------------------
   30|      0|            in_progress = false;
   31|      0|        }
   32|  8.50k|    }

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

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

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

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

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

_ZNK4qpdf10BaseHandle13raw_type_codeEv:
  933|   961M|    {
  934|   961M|        return obj ? static_cast<qpdf_object_type_e>(obj->value.index()) : ::ot_uninitialized;
  ------------------
  |  Branch (934:16): [True: 961M, False: 0]
  ------------------
  935|   961M|    }
_ZNK4qpdf10BaseHandle4qpdfEv:
  927|  1.02M|    {
  928|  1.02M|        return obj ? obj->qpdf : nullptr;
  ------------------
  |  Branch (928:16): [True: 1.02M, False: 0]
  ------------------
  929|  1.02M|    }
_ZNK4qpdf10BaseHandle6offsetEv:
  921|  99.2k|    {
  922|  99.2k|        return obj ? obj->parsed_offset : -1;
  ------------------
  |  Branch (922:16): [True: 99.2k, False: 0]
  ------------------
  923|  99.2k|    }
_ZNK4qpdf10BaseHandle9type_codeEv:
  951|  64.4M|    {
  952|  64.4M|        if (!obj) {
  ------------------
  |  Branch (952:13): [True: 187k, False: 64.2M]
  ------------------
  953|   187k|            return ::ot_uninitialized;
  954|   187k|        }
  955|  64.2M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (955:13): [True: 231k, False: 64.0M]
  ------------------
  956|   231k|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  957|   231k|        }
  958|  64.0M|        if (raw_type_code() == ::ot_reference) {
  ------------------
  |  Branch (958:13): [True: 0, False: 64.0M]
  ------------------
  959|      0|            return std::get<QPDF_Reference>(obj->value).obj->getTypeCode();
  960|      0|        }
  961|  64.0M|        return raw_type_code();
  962|  64.0M|    }
_ZNK4qpdf10BaseHandle8indirectEv:
  860|   213M|    {
  861|   213M|        return obj ? obj->og.isIndirect() : false;
  ------------------
  |  Branch (861:16): [True: 213M, False: 0]
  ------------------
  862|   213M|    }
_ZNK4qpdf10BaseHandle4nullEv:
  907|  4.15M|    {
  908|  4.15M|        return !obj || type_code() == ::ot_null;
  ------------------
  |  Branch (908:16): [True: 60.9k, False: 4.08M]
  |  Branch (908:24): [True: 874k, False: 3.21M]
  ------------------
  909|  4.15M|    }
_ZN4qpdf5ArrayC2ERK16QPDFObjectHandle:
   57|   173M|            BaseHandle(oh.resolved_type_code() == ::ot_array ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (57:24): [True: 533k, False: 172M]
  ------------------
   58|   173M|        {
   59|   173M|        }
_ZNK4qpdf10BaseHandle18resolved_type_codeEv:
  939|   365M|    {
  940|   365M|        if (!obj) {
  ------------------
  |  Branch (940:13): [True: 19.5k, False: 365M]
  ------------------
  941|  19.5k|            return ::ot_uninitialized;
  942|  19.5k|        }
  943|   365M|        if (raw_type_code() == ::ot_unresolved) {
  ------------------
  |  Branch (943:13): [True: 196, False: 365M]
  ------------------
  944|    196|            return QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)->getTypeCode();
  945|    196|        }
  946|   365M|        return raw_type_code();
  947|   365M|    }
_ZN4qpdf10BaseHandleC2ERK16QPDFObjectHandle:
  788|   346M|        obj(oh.obj)
  789|   346M|    {
  790|   346M|    }
_ZN4qpdf10DictionaryC2ERK16QPDFObjectHandle:
  268|   172M|            BaseDictionary(oh)
  269|   172M|        {
  270|   172M|        }
_ZN4qpdf14BaseDictionaryC2ERK16QPDFObjectHandle:
  238|   172M|            BaseHandle(oh.resolved_type_code() == ::ot_dictionary ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (238:24): [True: 1.11M, False: 171M]
  ------------------
  239|   172M|        {
  240|   172M|        }
_ZN4qpdf14BaseDictionary5beginEv:
  141|   172M|        {
  142|   172M|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (142:22): [True: 970k, False: 171M]
  ------------------
  143|   970k|                return d->items.begin();
  144|   970k|            }
  145|   171M|            return {};
  146|   172M|        }
_ZNK4qpdf10BaseHandle2asI15QPDF_DictionaryEEPT_v:
  770|   346M|    {
  771|   346M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 343M, False: 3.14M]
  ------------------
  772|   343M|            return nullptr;
  773|   343M|        }
  774|  3.14M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 3.13M, False: 5.26k]
  ------------------
  775|  3.13M|            return &std::get<T>(obj->value);
  776|  3.13M|        }
  777|  5.26k|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 113, False: 5.15k]
  ------------------
  778|    113|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|    113|        }
  780|  5.15k|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 5.15k]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  5.15k|        return nullptr;
  785|  5.15k|    }
_ZN4qpdf14BaseDictionary3endEv:
  150|   172M|        {
  151|   172M|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (151:22): [True: 970k, False: 171M]
  ------------------
  152|   970k|                return d->items.end();
  153|   970k|            }
  154|   171M|            return {};
  155|   172M|        }
_ZNK4qpdf10BaseHandle6id_genEv:
  854|  55.2k|    {
  855|  55.2k|        return obj ? obj->og : QPDFObjGen();
  ------------------
  |  Branch (855:16): [True: 55.2k, False: 0]
  ------------------
  856|  55.2k|    }
_ZNK4qpdf6Stream7getDictEv:
  554|   156k|        {
  555|   156k|            return {stream()->stream_dict};
  556|   156k|        }
_ZNK4qpdf6Stream6streamEv:
  697|   413k|        {
  698|   413k|            if (auto s = as<QPDF_Stream>()) {
  ------------------
  |  Branch (698:22): [True: 413k, False: 0]
  ------------------
  699|   413k|                if (auto ptr = s->m.get()) {
  ------------------
  |  Branch (699:26): [True: 413k, False: 2]
  ------------------
  700|   413k|                    return ptr;
  701|   413k|                }
  702|      2|                throw std::logic_error("QPDF_Stream: unexpected nullptr");
  703|   413k|            }
  704|      0|            throw std::runtime_error("operation for stream attempted on non-stream object");
  705|      0|            return nullptr; // unreachable
  706|   413k|        }
_ZNK4qpdf10BaseHandle2asI11QPDF_StreamEEPT_v:
  770|   413k|    {
  771|   413k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 413k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   413k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 413k, False: 0]
  ------------------
  775|   413k|            return &std::get<T>(obj->value);
  776|   413k|        }
  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|   130k|            BaseHandle(oh.type_code() == ::ot_integer ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (319:24): [True: 113k, False: 17.0k]
  ------------------
  320|   130k|        {
  321|   130k|        }
_ZNK4qpdf7IntegercvbEv:
  330|  51.0k|        {
  331|  51.0k|            return obj != nullptr;
  332|  51.0k|        }
_ZN4qpdfeqERKNS_4NameENSt3__117basic_string_viewIcNS3_11char_traitsIcEEEE:
  473|   328k|        {
  474|   328k|            return lhs && lhs.value() == rhs;
  ------------------
  |  Branch (474:20): [True: 171k, False: 157k]
  |  Branch (474:27): [True: 41.3k, False: 129k]
  ------------------
  475|   328k|        }
_ZN4qpdf4NameC2ERK16QPDFObjectHandle:
  449|   342k|            BaseHandle(oh.type_code() == ::ot_name ? oh : QPDFObjectHandle())
  ------------------
  |  Branch (449:24): [True: 182k, False: 159k]
  ------------------
  450|   342k|        {
  451|   342k|        }
_ZNK4qpdf10BaseHandle2ohEv:
  805|  54.4k|    {
  806|  54.4k|        return {obj};
  807|  54.4k|    }
_ZN10QPDFObject6createI9QPDF_NullJEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.13M|{
  989|  1.13M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.13M|}
_ZNK4qpdf7Integer5valueITkNSt3__18integralEiEET_v:
  361|  39.4k|        {
  362|  39.4k|            try {
  363|  39.4k|                return static_cast<T>(*this);
  364|  39.4k|            } catch (std::underflow_error&) {
  365|     85|                if constexpr (std::is_same_v<T, int>) {
  366|     85|                    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|     85|                return std::numeric_limits<T>::min();
  377|     85|            } catch (std::overflow_error&) {
  378|     47|                if constexpr (std::is_same_v<T, int>) {
  379|     47|                    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|     47|                return std::numeric_limits<T>::max();
  388|     47|            }
  389|  39.4k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEiEEv:
  339|  39.4k|        {
  340|  39.4k|            auto v = value();
  341|       |
  342|  39.4k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 47, False: 39.4k]
  ------------------
  343|     47|                throw std::overflow_error("Integer conversion overflow");
  344|     47|            }
  345|  39.4k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 85, False: 39.3k]
  ------------------
  346|     85|                throw std::underflow_error("Integer conversion underflow");
  347|     85|            }
  348|  39.3k|            return static_cast<T>(v);
  349|  39.4k|        }
_ZN4qpdf5ArrayC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
   47|  18.9M|            BaseHandle(obj)
   48|  18.9M|        {
   49|  18.9M|        }
_ZN4qpdf5ArrayC2EONSt3__110shared_ptrI10QPDFObjectEE:
   52|  33.6k|            BaseHandle(std::move(obj))
   53|  33.6k|        {
   54|  33.6k|        }
_ZN4qpdf5ArrayC2EO16QPDFObjectHandle:
   69|    106|            BaseHandle(oh.resolved_type_code() == ::ot_array ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (69:24): [True: 67, False: 39]
  ------------------
   70|    106|        {
   71|    106|        }
_ZN4qpdf14BaseDictionary7crbeginEv:
  195|  29.3k|        {
  196|  29.3k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (196:22): [True: 29.3k, False: 0]
  ------------------
  197|  29.3k|                return d->items.crbegin();
  198|  29.3k|            }
  199|      0|            return {};
  200|  29.3k|        }
_ZN4qpdf14BaseDictionary5crendEv:
  204|  29.3k|        {
  205|  29.3k|            if (auto d = as<QPDF_Dictionary>()) {
  ------------------
  |  Branch (205:22): [True: 29.3k, False: 0]
  ------------------
  206|  29.3k|                return d->items.crend();
  207|  29.3k|            }
  208|      0|            return {};
  209|  29.3k|        }
_ZN4qpdf14BaseDictionaryC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  225|   199k|            BaseHandle(obj)
  226|   199k|        {
  227|   199k|        }
_ZN4qpdf14BaseDictionaryC2EO16QPDFObjectHandle:
  243|  41.0k|            BaseHandle(
  244|  41.0k|                oh.resolved_type_code() == ::ot_dictionary ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (244:17): [True: 41.0k, False: 0]
  ------------------
  245|  41.0k|        {
  246|  41.0k|        }
_ZN4qpdf10DictionaryC2EO16QPDFObjectHandle:
  280|  41.0k|            BaseDictionary(std::move(oh))
  281|  41.0k|        {
  282|  41.0k|        }
_ZNKR4qpdf4NamecvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  461|  13.8k|        {
  462|  13.8k|            return value();
  463|  13.8k|        }
_ZN4qpdf4NullC2Ev:
  483|      2|            BaseHandle(QPDFObject::create<QPDF_Null>())
  484|      2|        {
  485|      2|        }
_ZN4qpdf6StreamC2ERKNSt3__110shared_ptrI10QPDFObjectEE:
  515|   284k|            BaseHandle(obj)
  516|   284k|        {
  517|   284k|        }
_ZN4qpdf6StreamC2EONSt3__110shared_ptrI10QPDFObjectEE:
  520|   792k|            BaseHandle(std::move(obj))
  521|   792k|        {
  522|   792k|        }
_ZN4qpdf6StreamC2EO16QPDFObjectHandle:
  537|  34.1k|            BaseHandle(oh.type_code() == ::ot_stream ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (537:24): [True: 2.28k, False: 31.8k]
  ------------------
  538|  34.1k|        {
  539|  34.1k|        }
_ZNK4qpdf6Stream4TypeEv:
  601|  81.4k|        {
  602|  81.4k|            return {getDict()["/Type"]};
  603|  81.4k|        }
_ZNK4qpdf6Stream14isDataModifiedEv:
  607|  24.1k|        {
  608|  24.1k|            return !stream()->token_filters.empty();
  609|  24.1k|        }
_ZN4qpdf6Stream16setFilterOnWriteEb:
  612|  13.4k|        {
  613|  13.4k|            stream()->filter_on_write = val;
  614|  13.4k|        }
_ZNK4qpdf6Stream16getFilterOnWriteEv:
  617|  24.1k|        {
  618|  24.1k|            return stream()->filter_on_write;
  619|  24.1k|        }
_ZN4qpdf6StringC2EO16QPDFObjectHandle:
  737|  15.8k|            BaseHandle(oh.type_code() == ::ot_string ? std::move(oh) : QPDFObjectHandle())
  ------------------
  |  Branch (737:24): [True: 8.11k, False: 7.73k]
  ------------------
  738|  15.8k|        {
  739|  15.8k|        }
_ZNKR4qpdf6StringcvNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEEv:
  746|    657|        {
  747|    657|            return value();
  748|    657|        }
_ZNK4qpdf10BaseHandle6obj_spEv:
  799|   130k|    {
  800|   130k|        return obj;
  801|   130k|    }
_ZNK4qpdf10BaseHandle3getERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  901|   358k|    {
  902|   358k|        return (*this)[key];
  903|   358k|    }
_ZN9QPDF_Null6createENSt3__110shared_ptrI10QPDFObjectEERKNS0_17basic_string_viewIcNS0_11char_traitsIcEEEENS0_12basic_stringIcS6_NS0_9allocatorIcEEEE:
  974|   170k|{
  975|   170k|    auto n = QPDFObject::create<QPDF_Null>();
  976|   170k|    n->setChildDescription(parent->getQPDF(), parent, static_descr, var_descr);
  977|   170k|    return n;
  978|   170k|}
_ZNK16QPDFObjectHandle8as_arrayEN4qpdf5typedE:
 1006|  19.0M|{
 1007|  19.0M|    if (options & qpdf::error) {
  ------------------
  |  Branch (1007:9): [True: 0, False: 19.0M]
  ------------------
 1008|      0|        assertType("array", false);
 1009|      0|    }
 1010|  19.0M|    if (options & qpdf::any_flag || type_code() == ::ot_array ||
  ------------------
  |  Branch (1010:9): [True: 18.9M, False: 51.0k]
  |  Branch (1010:37): [True: 17.4k, False: 33.6k]
  ------------------
 1011|  18.9M|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1011:10): [True: 0, False: 33.6k]
  |  Branch (1011:38): [True: 0, False: 0]
  ------------------
 1012|  18.9M|        return qpdf::Array(obj);
 1013|  18.9M|    }
 1014|  33.6k|    return qpdf::Array(std::shared_ptr<QPDFObject>());
 1015|  19.0M|}
_ZNK16QPDFObjectHandle13as_dictionaryEN4qpdf5typedE:
 1019|   199k|{
 1020|   199k|    if (options & qpdf::any_flag || type_code() == ::ot_dictionary ||
  ------------------
  |  Branch (1020:9): [True: 131k, False: 67.6k]
  |  Branch (1020:37): [True: 63.7k, False: 3.94k]
  ------------------
 1021|   195k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1021:10): [True: 0, False: 3.94k]
  |  Branch (1021:38): [True: 0, False: 0]
  ------------------
 1022|   195k|        return qpdf::Dictionary(obj);
 1023|   195k|    }
 1024|  3.94k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 3.94k]
  ------------------
 1025|      0|        assertType("dictionary", false);
 1026|      0|    }
 1027|  3.94k|    return qpdf::Dictionary(std::shared_ptr<QPDFObject>());
 1028|   199k|}
_ZNK16QPDFObjectHandle9as_streamEN4qpdf5typedE:
 1032|  1.07M|{
 1033|  1.07M|    if (options & qpdf::any_flag || type_code() == ::ot_stream ||
  ------------------
  |  Branch (1033:9): [True: 0, False: 1.07M]
  |  Branch (1033:37): [True: 286k, False: 792k]
  ------------------
 1034|   792k|        (options & qpdf::optional && type_code() == ::ot_null)) {
  ------------------
  |  Branch (1034:10): [True: 0, False: 792k]
  |  Branch (1034:38): [True: 0, False: 0]
  ------------------
 1035|   284k|        return qpdf::Stream(obj);
 1036|   284k|    }
 1037|   794k|    if (options & qpdf::error) {
  ------------------
  |  Branch (1037:9): [True: 38, False: 794k]
  ------------------
 1038|     38|        assertType("stream", false);
 1039|     38|    }
 1040|   794k|    return qpdf::Stream(std::shared_ptr<QPDFObject>());
 1041|  1.07M|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRKNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  56.7k|{
  989|  56.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  56.7k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   183k|{
  989|   183k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   183k|}
_ZN4qpdf10BaseHandleC2EO16QPDFObjectHandle:
  793|  89.0k|        obj(std::move(oh.obj))
  794|  89.0k|    {
  795|  89.0k|    }
_ZN10QPDFObject6createI9QPDF_BoolJRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|    137|{
  989|    137|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|    137|}
_ZN10QPDFObject6createI12QPDF_IntegerJRxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  1.72M|{
  989|  1.72M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.72M|}
_ZN10QPDFObject6createI9QPDF_RealJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  4.41k|{
  989|  4.41k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  4.41k|}
_ZN10QPDFObject6createI11QPDF_StringJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  20.5k|{
  989|  20.5k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  20.5k|}
_ZN10QPDFObject6createI9QPDF_NameJRNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  10.7k|{
  989|  10.7k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  10.7k|}
_ZN10QPDFObject6createI10QPDF_ArrayJS1_EEENSt3__110shared_ptrIS_EEDpOT0_:
  988|     25|{
  989|     25|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|     25|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEbEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  1.67k|{
  989|  1.67k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  1.67k|}
_ZN10QPDFObject6createI15QPDF_DictionaryJRNSt3__13mapINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE16QPDFObjectHandleNS2_4lessIS9_EENS7_INS2_4pairIKS9_SA_EEEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  8.12k|{
  989|  8.12k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  8.12k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_BoolEEPT_v:
  770|      1|    {
  771|      1|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 1]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|      1|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1, False: 0]
  ------------------
  775|      1|            return &std::get<T>(obj->value);
  776|      1|        }
  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|   114k|    {
  771|   114k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 1.05k, False: 113k]
  ------------------
  772|  1.05k|            return nullptr;
  773|  1.05k|        }
  774|   113k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 113k, False: 0]
  ------------------
  775|   113k|            return &std::get<T>(obj->value);
  776|   113k|        }
  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|  18.3k|        {
  340|  18.3k|            auto v = value();
  341|       |
  342|  18.3k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 18.3k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  18.3k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 0, False: 18.3k]
  ------------------
  346|      0|                throw std::underflow_error("Integer conversion underflow");
  347|      0|            }
  348|  18.3k|            return static_cast<T>(v);
  349|  18.3k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEyEET_v:
  361|  32.1k|        {
  362|  32.1k|            try {
  363|  32.1k|                return static_cast<T>(*this);
  364|  32.1k|            } 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|    138|                } else if constexpr (std::is_same_v<T, unsigned long long>) {
  370|    138|                    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|    138|                return std::numeric_limits<T>::min();
  377|    138|            } 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|  32.1k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEyEEv:
  339|  32.1k|        {
  340|  32.1k|            auto v = value();
  341|       |
  342|  32.1k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 0, False: 32.1k]
  ------------------
  343|      0|                throw std::overflow_error("Integer conversion overflow");
  344|      0|            }
  345|  32.1k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 138, False: 31.9k]
  ------------------
  346|    138|                throw std::underflow_error("Integer conversion underflow");
  347|    138|            }
  348|  31.9k|            return static_cast<T>(v);
  349|  32.1k|        }
_ZNK4qpdf7Integer5valueITkNSt3__18integralEjEET_v:
  361|  7.50k|        {
  362|  7.50k|            try {
  363|  7.50k|                return static_cast<T>(*this);
  364|  7.50k|            } 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|    117|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  368|    117|                    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|    117|                return std::numeric_limits<T>::min();
  377|    117|            } 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|    108|                } else if constexpr (std::is_same_v<T, unsigned int>) {
  381|    108|                    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|    108|                return std::numeric_limits<T>::max();
  388|    108|            }
  389|  7.50k|        }
_ZNK4qpdf7IntegercvT_ITkNSt3__18integralEjEEv:
  339|  7.50k|        {
  340|  7.50k|            auto v = value();
  341|       |
  342|  7.50k|            if (std::cmp_greater(v, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (342:17): [True: 108, False: 7.39k]
  ------------------
  343|    108|                throw std::overflow_error("Integer conversion overflow");
  344|    108|            }
  345|  7.39k|            if (std::cmp_less(v, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (345:17): [True: 117, False: 7.28k]
  ------------------
  346|    117|                throw std::underflow_error("Integer conversion underflow");
  347|    117|            }
  348|  7.28k|            return static_cast<T>(v);
  349|  7.39k|        }
_ZN10QPDFObject6createI9QPDF_NameJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  23.9M|{
  989|  23.9M|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  23.9M|}
_ZN10QPDFObject6createI9QPDF_NameJNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  18.9k|{
  989|  18.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  18.9k|}
_ZNK4qpdf10BaseHandle2asI9QPDF_NameEEPT_v:
  770|   205k|    {
  771|   205k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 205k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|   205k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 205k, False: 0]
  ------------------
  775|   205k|            return &std::get<T>(obj->value);
  776|   205k|        }
  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|    }
_ZN10QPDFObject6createI11QPDF_StringJRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   129k|{
  989|   129k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   129k|}
_ZNK4qpdf10BaseHandle2asI11QPDF_StringEEPT_v:
  770|  8.11k|    {
  771|  8.11k|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 0, False: 8.11k]
  ------------------
  772|      0|            return nullptr;
  773|      0|        }
  774|  8.11k|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 8.11k, False: 0]
  ------------------
  775|  8.11k|            return &std::get<T>(obj->value);
  776|  8.11k|        }
  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|  80.6k|{
  989|  80.6k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  80.6k|}
_ZN10QPDFObject6createI9QPDF_RealJRdRiRbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  31.9k|{
  989|  31.9k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  31.9k|}
_ZN9QPDF_RealC2Edib:
  981|  31.9k|    val(QUtil::double_to_string(value, decimal_places, trim_trailing_zeroes))
  982|  31.9k|{
  983|  31.9k|}
_ZN10QPDFObject6createI10QPDF_ArrayJRKNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  10.0k|{
  989|  10.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  10.0k|}
_ZN10QPDFObject6createI10QPDF_ArrayJRNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|  3.17k|{
  989|  3.17k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  3.17k|}
_ZN15QPDF_DictionaryC2EONSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  967|   183k|    items(std::move(items))
  968|   183k|{
  969|   183k|}
_ZN10QPDFObject6createI9QPDF_BoolJbEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  12.0k|{
  989|  12.0k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  12.0k|}
_ZN10QPDFObject6createI12QPDF_IntegerJxEEENSt3__110shared_ptrIS_EEDpOT0_:
  988|  9.89k|{
  989|  9.89k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|  9.89k|}
_ZN10QPDFObject6createI10QPDF_ArrayJNSt3__16vectorI16QPDFObjectHandleNS2_9allocatorIS4_EEEEEEENS2_10shared_ptrIS_EEDpOT0_:
  988|   104k|{
  989|   104k|    return std::make_shared<QPDFObject>(std::forward<T>(T(std::forward<Args>(args)...)));
  990|   104k|}
_ZN4qpdfeqITkNSt3__18integralEiEEbRKNS_7IntegerET_:
  395|  24.1k|        {
  396|  24.1k|            return lhs && std::cmp_equal(lhs.value(), rhs);
  ------------------
  |  Branch (396:20): [True: 16.7k, False: 7.44k]
  |  Branch (396:27): [True: 58, False: 16.6k]
  ------------------
  397|  24.1k|        }
_ZNK4qpdf10BaseHandle2asI10QPDF_ArrayEEPT_v:
  770|  39.0M|    {
  771|  39.0M|        if (!obj) {
  ------------------
  |  Branch (771:13): [True: 50.9k, False: 38.9M]
  ------------------
  772|  50.9k|            return nullptr;
  773|  50.9k|        }
  774|  38.9M|        if (std::holds_alternative<T>(obj->value)) {
  ------------------
  |  Branch (774:13): [True: 1.25M, False: 37.7M]
  ------------------
  775|  1.25M|            return &std::get<T>(obj->value);
  776|  1.25M|        }
  777|  37.7M|        if (std::holds_alternative<QPDF_Unresolved>(obj->value)) {
  ------------------
  |  Branch (777:13): [True: 0, False: 37.7M]
  ------------------
  778|      0|            return BaseHandle(QPDF::Doc::Resolver::resolved(obj->qpdf, obj->og)).as<T>();
  779|      0|        }
  780|  37.7M|        if (std::holds_alternative<QPDF_Reference>(obj->value)) {
  ------------------
  |  Branch (780:13): [True: 0, False: 37.7M]
  ------------------
  781|       |            // see comment in QPDF_Reference.
  782|      0|            return BaseHandle(std::get<QPDF_Reference>(obj->value).obj).as<T>();
  783|      0|        }
  784|  37.7M|        return nullptr;
  785|  37.7M|    }
_ZN4qpdf7IntegerC2ITkNSt3__18integralEmEET_:
  307|  1.28k|            Integer(static_cast<long long>(value))
  308|  1.28k|        {
  309|       |            if constexpr (std::cmp_greater(
  310|       |                              std::numeric_limits<decltype(value)>::max(),
  311|  1.28k|                              std::numeric_limits<long long>::max())) {
  312|  1.28k|                if (std::cmp_greater(value, std::numeric_limits<long long>::max())) {
  ------------------
  |  Branch (312:21): [True: 0, False: 1.28k]
  ------------------
  313|      0|                    throw std::overflow_error("overflow constructing Integer");
  314|      0|                }
  315|  1.28k|            }
  316|  1.28k|        }

_ZNK10QPDFObject11getTypeCodeEv:
  329|   920k|    {
  330|   920k|        return static_cast<qpdf_object_type_e>(value.index());
  331|   920k|    }
_ZN10QPDFObjectC2I9QPDF_NullEEOT_:
  300|  1.13M|        value(std::forward<T>(value))
  301|  1.13M|    {
  302|  1.13M|    }
_ZN10QPDF_ArrayC2ERKNSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   67|  13.1k|        elements(items)
   68|  13.1k|    {
   69|  13.1k|    }
_ZN10QPDF_ArrayC2EONSt3__16vectorI16QPDFObjectHandleNS0_9allocatorIS2_EEEE:
   73|   104k|        elements(std::move(items))
   74|   104k|    {
   75|   104k|    }
_ZNK10QPDF_Array4sizeEv:
   79|  16.0k|    {
   80|  16.0k|        return sp ? sp->size : elements.size();
  ------------------
  |  Branch (80:16): [True: 241, False: 15.8k]
  ------------------
   81|  16.0k|    }
_ZN9QPDF_BoolC2Eb:
   94|  12.2k|        val(val)
   95|  12.2k|    {
   96|  12.2k|    }
_ZN15QPDF_DictionaryC2ERKNSt3__13mapINS0_12basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE16QPDFObjectHandleNS0_4lessIS7_EENS5_INS0_4pairIKS7_S8_EEEEEE:
  111|  64.8k|        items(items)
  112|  64.8k|    {
  113|  64.8k|    }
_ZN12QPDF_IntegerC2Ex:
  140|  1.73M|        val(val)
  141|  1.73M|    {
  142|  1.73M|    }
_ZN9QPDF_NameC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  154|  23.9M|        name(std::move(name))
  155|  23.9M|    {
  156|  23.9M|    }
_ZN9QPDF_RealC2ENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  193|  85.0k|        val(std::move(val))
  194|  85.0k|    {
  195|  85.0k|    }
_ZN11QPDF_Stream7MembersC2E16QPDFObjectHandlem:
  232|  47.8k|            stream_dict(std::move(stream_dict)),
  233|  47.8k|            length(length)
  234|  47.8k|        {
  235|  47.8k|        }
_ZN11QPDF_StreamC2E16QPDFObjectHandlem:
  254|  47.8k|        m(std::make_unique<Members>(stream_dict, length))
  255|  47.8k|    {
  256|  47.8k|        if (!stream_dict.isDictionary()) {
  ------------------
  |  Branch (256:13): [True: 0, False: 47.8k]
  ------------------
  257|      0|            throw std::logic_error(
  258|      0|                "stream object instantiated with non-dictionary object for dictionary");
  259|      0|        }
  260|  47.8k|    }
_ZN11QPDF_StringC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  279|   166k|        val(val)
  280|   166k|    {
  281|   166k|    }
_ZN11QPDF_StringC2EONSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE:
  283|     15|        val(std::move(val))
  284|     15|    {
  285|     15|    }
_ZN10QPDFObject11assign_nullEv:
  334|  1.62k|    {
  335|  1.62k|        value = QPDF_Null();
  336|  1.62k|        qpdf = nullptr;
  337|  1.62k|        og = QPDFObjGen();
  338|  1.62k|        object_description = nullptr;
  339|  1.62k|        parsed_offset = -1;
  340|  1.62k|    }
_ZN10QPDFObject7move_toERNSt3__110shared_ptrIS_EEb:
  343|   248k|    {
  344|   248k|        o->value = std::move(value);
  345|   248k|        o->qpdf = qpdf;
  346|   248k|        o->og = og;
  347|   248k|        o->object_description = object_description;
  348|   248k|        o->parsed_offset = parsed_offset;
  349|   248k|        if (!destroy) {
  ------------------
  |  Branch (349:13): [True: 0, False: 248k]
  ------------------
  350|      0|            value = QPDF_Reference(o);
  351|      0|        }
  352|   248k|    }
_ZN10QPDFObject9setObjGenEP4QPDF10QPDFObjGen:
  364|  1.01M|    {
  365|  1.01M|        qpdf = a_qpdf;
  366|  1.01M|        og = a_og;
  367|  1.01M|    }
_ZNK10QPDFObject12isUnresolvedEv:
  371|   622k|    {
  372|   622k|        return getTypeCode() == ::ot_unresolved;
  373|   622k|    }
_ZN10QPDFObject10ChildDescrC2ENSt3__110shared_ptrIS_EERKNS1_17basic_string_viewIcNS1_11char_traitsIcEEEENS1_12basic_stringIcS6_NS1_9allocatorIcEEEE:
  393|   170k|            parent(parent),
  394|   170k|            static_descr(static_descr),
  395|   170k|            var_descr(var_descr)
  396|   170k|        {
  397|   170k|        }
_ZN10QPDFObject14ObjStreamDescrC2Eii:
  407|  33.7k|            stream_id(stream_id),
  408|  33.7k|            obj_id(obj_id) {};
_ZN10QPDFObject14setDescriptionEP4QPDFRNSt3__110shared_ptrINS2_7variantIJNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS_10JSON_DescrENS_10ChildDescrENS_14ObjStreamDescrEEEEEEx:
  419|  26.1M|    {
  420|  26.1M|        qpdf = qpdf_p;
  421|  26.1M|        object_description = description;
  422|  26.1M|        setParsedOffset(offset);
  423|  26.1M|    }
_ZN10QPDFObject21setDefaultDescriptionEP4QPDFRK10QPDFObjGen:
  426|   982k|    {
  427|   982k|        qpdf = a_qpdf;
  428|   982k|        og = a_og;
  429|   982k|    }
_ZN10QPDFObject19setChildDescriptionEP4QPDFNSt3__110shared_ptrIS_EERKNS2_17basic_string_viewIcNS2_11char_traitsIcEEEENS2_12basic_stringIcS7_NS2_9allocatorIcEEEE:
  436|   170k|    {
  437|   170k|        object_description =
  438|   170k|            std::make_shared<Description>(ChildDescr(parent, static_descr, var_descr));
  439|   170k|        qpdf = a_qpdf;
  440|   170k|    }
_ZN10QPDFObject14hasDescriptionEv:
  444|  47.8k|    {
  445|  47.8k|        return object_description || og.isIndirect();
  ------------------
  |  Branch (445:16): [True: 47.8k, False: 0]
  |  Branch (445:38): [True: 0, False: 0]
  ------------------
  446|  47.8k|    }
_ZN10QPDFObject15setParsedOffsetEx:
  449|  26.1M|    {
  450|  26.1M|        if (parsed_offset < 0) {
  ------------------
  |  Branch (450:13): [True: 26.1M, False: 0]
  ------------------
  451|  26.1M|            parsed_offset = offset;
  452|  26.1M|        }
  453|  26.1M|    }
_ZN10QPDFObject7getQPDFEv:
  456|   269k|    {
  457|   269k|        return qpdf;
  458|   269k|    }
_ZN10QPDFObject9getObjGenEv:
  461|  39.7M|    {
  462|  39.7M|        return og;
  463|  39.7M|    }
_ZN10QPDF_ArrayC2Ev:
   52|     25|    QPDF_Array() = default;
_ZN10QPDFObjectC2I15QPDF_DictionaryEEOT_:
  300|   247k|        value(std::forward<T>(value))
  301|   247k|    {
  302|   247k|    }
_ZN10QPDFObjectC2I9QPDF_BoolEEOT_:
  300|  12.2k|        value(std::forward<T>(value))
  301|  12.2k|    {
  302|  12.2k|    }
_ZN10QPDFObjectC2I12QPDF_IntegerEEOT_:
  300|  1.73M|        value(std::forward<T>(value))
  301|  1.73M|    {
  302|  1.73M|    }
_ZN10QPDFObjectC2I9QPDF_RealEEOT_:
  300|   117k|        value(std::forward<T>(value))
  301|   117k|    {
  302|   117k|    }
_ZN10QPDFObjectC2I11QPDF_StringEEOT_:
  300|   149k|        value(std::forward<T>(value))
  301|   149k|    {
  302|   149k|    }
_ZN10QPDFObjectC2I9QPDF_NameEEOT_:
  300|  23.9M|        value(std::forward<T>(value))
  301|  23.9M|    {
  302|  23.9M|    }
_ZN10QPDFObjectC2I10QPDF_ArrayEEOT_:
  300|   119k|        value(std::forward<T>(value))
  301|   119k|    {
  302|   119k|    }
_ZN10QPDF_ArrayC2EOS_:
   58|   120k|    QPDF_Array(QPDF_Array&&) = default;
_ZN10QPDFObject6createI11QPDF_StreamJ16QPDFObjectHandleRmEEENSt3__110shared_ptrIS_EEP4QPDF10QPDFObjGenDpOT0_:
  318|  47.8k|    {
  319|  47.8k|        return std::make_shared<QPDFObject>(
  320|  47.8k|            qpdf, og, std::forward<T>(T(std::forward<Args>(args)...)));
  321|  47.8k|    }
_ZN10QPDFObjectC2I11QPDF_StreamEEP4QPDF10QPDFObjGenOT_:
  306|  47.8k|        value(std::forward<T>(value)),
  307|  47.8k|        qpdf(qpdf),
  308|  47.8k|        og(og)
  309|  47.8k|    {
  310|  47.8k|    }
_ZN10QPDF_ArrayaSEOS_:
   59|     39|    QPDF_Array& operator=(QPDF_Array&&) = default;
_ZN10QPDFObject6createI15QPDF_UnresolvedJEEENSt3__110shared_ptrIS_EEP4QPDF10QPDFObjGenDpOT0_:
  318|   262k|    {
  319|   262k|        return std::make_shared<QPDFObject>(
  320|   262k|            qpdf, og, std::forward<T>(T(std::forward<Args>(args)...)));
  321|   262k|    }
_ZN10QPDFObjectC2I15QPDF_UnresolvedEEP4QPDF10QPDFObjGenOT_:
  306|   262k|        value(std::forward<T>(value)),
  307|   262k|        qpdf(qpdf),
  308|   262k|        og(og)
  309|   262k|    {
  310|   262k|    }

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

_ZNK4qpdf9Tokenizer7getTypeEv:
   64|  30.3M|        {
   65|  30.3M|            return this->type;
   66|  30.3M|        }
_ZNK4qpdf9Tokenizer8getValueEv:
   69|  28.3M|        {
   70|  28.3M|            return (this->type == QPDFTokenizer::tt_name || this->type == QPDFTokenizer::tt_string)
  ------------------
  |  Branch (70:21): [True: 24.8M, False: 3.55M]
  |  Branch (70:61): [True: 82.7k, False: 3.47M]
  ------------------
   71|  28.3M|                ? this->val
   72|  28.3M|                : this->raw_val;
   73|  28.3M|        }
_ZNK4qpdf9Tokenizer15getErrorMessageEv:
   81|  38.9k|        {
   82|  38.9k|            return this->error_message;
   83|  38.9k|        }

_ZNK4qpdf6Writer6Config5usageERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  285|  8.57k|            {
  286|  8.57k|                if (!permissive_) {
  ------------------
  |  Branch (286:21): [True: 0, False: 8.57k]
  ------------------
  287|      0|                    throw QPDFUsage(msg);
  288|      0|                }
  289|  8.57k|            }
_ZN4qpdf6Writer6Config17normalize_contentEb:
  242|  8.57k|            {
  243|  8.57k|                normalize_content_ = val;
  244|  8.57k|                normalize_content_set_ = true;
  245|  8.57k|                return *this;
  246|  8.57k|            }
_ZN4qpdf6Writer6Config16deterministic_idEb:
  256|  8.57k|            {
  257|  8.57k|                deterministic_id_ = val;
  258|  8.57k|                return *this;
  259|  8.57k|            }
_ZN4qpdf6Writer6Config19preserve_encryptionEb:
   68|  8.57k|            {
   69|  8.57k|                preserve_encryption_ = val;
   70|  8.57k|                return *this;
   71|  8.57k|            }
_ZNK4qpdf6Writer6Config3qdfEv:
  228|  40.0M|            {
  229|  40.0M|                return qdf_;
  230|  40.0M|            }
_ZNK4qpdf6Writer6Config9linearizeEv:
   41|   192M|            {
   42|   192M|                return linearize_;
   43|   192M|            }
_ZNK4qpdf6Writer6Config21direct_stream_lengthsEv:
  126|   234k|            {
  127|   234k|                return direct_stream_lengths_;
  128|   234k|            }
_ZNK4qpdf6Writer6Config16deterministic_idEv:
  250|  33.6k|            {
  251|  33.6k|                return deterministic_id_;
  252|  33.6k|            }
_ZNK4qpdf6Writer6Config12decode_levelEv:
   97|  24.1k|            {
   98|  24.1k|                return decode_level_;
   99|  24.1k|            }
_ZNK4qpdf6Writer6Config16compress_streamsEv:
  118|  73.1k|            {
  119|  73.1k|                return compress_streams_;
  120|  73.1k|            }
_ZNK4qpdf6Writer6Config17normalize_contentEv:
  236|  32.6k|            {
  237|  32.6k|                return normalize_content_;
  238|  32.6k|            }
_ZNK4qpdf6Writer6Config24newline_before_endstreamEv:
  132|  27.2k|            {
  133|  27.2k|                return newline_before_endstream_;
  134|  27.2k|            }
_ZNK4qpdf6Writer6Config22no_original_object_idsEv:
  215|   102k|            {
  216|   102k|                return no_original_object_ids_;
  217|   102k|            }
_ZNK4qpdf6Writer6Config9static_idEv:
  263|  8.38k|            {
  264|  8.38k|                return static_id_;
  265|  8.38k|            }
_ZNK4qpdf6Writer6Config21preserve_unreferencedEv:
  202|  17.0k|            {
  203|  17.0k|                return preserve_unreferenced_;
  204|  17.0k|            }
_ZNK4qpdf6Writer6Config4pclmEv:
  276|  25.5k|            {
  277|  25.5k|                return pclm_;
  278|  25.5k|            }
_ZNK4qpdf6Writer6Config19preserve_encryptionEv:
   62|  8.57k|            {
   63|  8.57k|                return preserve_encryption_;
   64|  8.57k|            }
_ZNK4qpdf6Writer6Config18forced_pdf_versionEv:
  160|  17.1k|            {
  161|  17.1k|                return forced_pdf_version_;
  162|  17.1k|            }
_ZNK4qpdf6Writer6Config14object_streamsEv:
  105|  8.57k|            {
  106|  8.57k|                return object_streams_;
  107|  8.57k|            }
_ZN4qpdf6Writer6Config17extra_header_textEv:
  194|  8.50k|            {
  195|  8.50k|                return extra_header_text_;
  196|  8.50k|            }
_ZN4qpdf6Writer6ConfigC2Eb:
   35|  8.57k|                permissive_(permissive)
   36|  8.57k|            {
   37|  8.57k|            }
_ZN4qpdf6Writer6ConfigD2Ev:
   32|  8.57k|            ~Config() = default;

_ZN4QPDF3DocC2ERS_PNS_7MembersE:
  357|  22.0k|        qpdf(qpdf),
  358|  22.0k|        m(m)
  359|  22.0k|    {
  360|  22.0k|    }
_ZN4qpdf3Doc6ConfigC2Ev:
   43|  22.0k|                log_(QPDFLogger::defaultLogger())
   44|  22.0k|            {
   45|  22.0k|            }
_ZN4QPDF3Doc6CommonC2ERS_PNS_7MembersE:
 1334|  96.9k|    qpdf(qpdf),
 1335|  96.9k|    m(m),
 1336|  96.9k|    cf(m->cf),
 1337|  96.9k|    pages(m->pages),
 1338|  96.9k|    objects(m->objects)
 1339|  96.9k|{
 1340|  96.9k|}
_ZN4QPDF3Doc13LinearizationC2ERS0_:
  607|  22.0k|        Common(doc)
  608|  22.0k|    {
  609|  22.0k|    }
_ZN4QPDF3Doc6CommonC2ERS0_:
 1343|  74.8k|    Common(doc.qpdf, doc.m)
 1344|  74.8k|{
 1345|  74.8k|}
_ZN4QPDF3Doc7ObjectsC2ERS0_:
 1044|  22.0k|        Common(doc),
 1045|  22.0k|        foreign_(*this),
 1046|  22.0k|        streams_(*this)
 1047|  22.0k|    {
 1048|  22.0k|    }
_ZN4QPDF3Doc7Objects7ForeignC2ERNS0_6CommonE:
  959|  22.0k|            Common(common)
  960|  22.0k|        {
  961|  22.0k|        }
_ZN4QPDF3Doc7Objects7ForeignD2Ev:
  968|  22.0k|        ~Foreign() = default;
_ZN4QPDF3Doc5PagesC2ERS0_:
 1187|  22.0k|        Common(doc)
 1188|  22.0k|    {
 1189|  22.0k|    }
_ZN4QPDF3Doc5PagesD2Ev:
 1184|  22.0k|    ~Pages() = default;
_ZN4QPDF3Doc7ObjectsD2Ev:
 1041|  22.0k|    ~Objects() = default;
_ZN4QPDF3Doc7Objects7StreamsD2Ev:
  997|  22.0k|        ~Streams() = default;
_ZN4QPDF3Doc13LinearizationD2Ev:
  604|  22.0k|    ~Linearization() = default;
_ZN4QPDF3DocD2Ev:
  354|  22.0k|    ~Doc() = default;
_ZN4qpdf3Doc6Config12max_warningsEm:
  107|  8.57k|            {
  108|  8.57k|                max_warnings_ = val;
  109|  8.57k|                return *this;
  110|  8.57k|            }
_ZNK4qpdf3Doc6Config3logEv:
   75|   780k|            {
   76|   780k|                return log_;
   77|   780k|            }
_ZNK4qpdf3Doc6Config12max_warningsEv:
  101|  1.49M|            {
  102|  1.49M|                return max_warnings_;
  103|  1.49M|            }
_ZNK4qpdf3Doc6Config17suppress_warningsEv:
   88|   780k|            {
   89|   780k|                return suppress_warnings_;
   90|   780k|            }
_ZN4QPDF3docEv:
 1373|  17.1k|{
 1374|  17.1k|    return *m;
 1375|  17.1k|}
_ZN4QPDF3Doc8Resolver8resolvedEPS_10QPDFObjGen:
 1328|   232k|    {
 1329|   232k|        return qpdf->m->objects.resolve(og);
 1330|   232k|    }
_ZNK4QPDF3Doc7Objects12root_checkedEv:
 1076|  54.4k|    {
 1077|  54.4k|        return root_checked_;
 1078|  54.4k|    }
_ZN4QPDF3Doc7Objects12root_checkedEb:
 1082|  10.2k|    {
 1083|  10.2k|        root_checked_ = val;
 1084|  10.2k|    }
_ZN4QPDF20EncryptionParametersC2Ev:
  191|  22.0k|    EncryptionParameters() = default;
_ZN4QPDF7MembersD2Ev:
 1287|  22.0k|    ~Members() = default;
_ZN4QPDF15StringDecrypter13decryptStringERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  240|  19.4k|    {
  241|  19.4k|        qpdf->decryptString(val, og);
  242|  19.4k|    }
_ZNK4qpdf3Doc6Config19password_is_hex_keyEv:
   49|  1.01k|            {
   50|  1.01k|                return password_is_hex_key_;
   51|  1.01k|            }
_ZNK4qpdf3Doc6Config19ignore_xref_streamsEv:
   62|  8.78k|            {
   63|  8.78k|                return ignore_xref_streams_;
   64|  8.78k|            }
_ZNK4qpdf3Doc6Config17surpress_recoveryEv:
  114|   181k|            {
  115|   181k|                return surpress_recovery_;
  116|   181k|            }
_ZN4QPDF8ObjCacheC2ENSt3__110shared_ptrI10QPDFObjectEExx:
  175|  1.02M|        object(std::move(object)),
  176|  1.02M|        end_before_space(end_before_space),
  177|  1.02M|        end_after_space(end_after_space)
  178|  1.02M|    {
  179|  1.02M|    }
_ZN4QPDF20EncryptionParameters1REv:
  204|  7.62k|    {
  205|  7.62k|        return R_;
  206|  7.62k|    }
_ZN4QPDF3Doc10EncryptionC2EiiiiRKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEESA_SA_SA_SA_SA_b:
  496|  1.01k|        V(V),
  497|  1.01k|        R(R),
  498|  1.01k|        Length_bytes(Length_bytes),
  499|  1.01k|        P(static_cast<unsigned long long>(P)),
  500|  1.01k|        O(O),
  501|  1.01k|        U(U),
  502|  1.01k|        OE(OE),
  503|  1.01k|        UE(UE),
  504|  1.01k|        Perms(Perms),
  505|  1.01k|        id1(id1),
  506|  1.01k|        encrypt_metadata(encrypt_metadata)
  507|  1.01k|    {
  508|  1.01k|    }
_ZN4QPDF3Doc7Objects7Streams14pipeStreamDataEPS_10QPDFObjGenxm16QPDFObjectHandlebP8Pipelinebb:
 1011|  45.4k|        {
 1012|  45.4k|            return qpdf->pipeStreamData(
 1013|  45.4k|                og,
 1014|  45.4k|                offset,
 1015|  45.4k|                length,
 1016|  45.4k|                dict,
 1017|  45.4k|                is_root_metadata,
 1018|  45.4k|                pipeline,
 1019|  45.4k|                suppress_warnings,
 1020|  45.4k|                will_retry);
 1021|  45.4k|        }
_ZN4QPDF3Doc5Pages3allEv:
 1193|  39.8k|    {
 1194|  39.8k|        return !all_pages.empty() ? all_pages : cache();
  ------------------
  |  Branch (1194:16): [True: 25.2k, False: 14.6k]
  ------------------
 1195|  39.8k|    }
_ZN4QPDF3Doc5Pages5emptyEv:
 1199|  22.7k|    {
 1200|  22.7k|        return all().empty();
 1201|  22.7k|    }
_ZN4QPDF3Doc5Pages5beginEv:
 1211|  8.57k|    {
 1212|  8.57k|        return all().cbegin();
 1213|  8.57k|    }
_ZN4QPDF3Doc5Pages3endEv:
 1217|  8.57k|    {
 1218|  8.57k|        return all().cend();
 1219|  8.57k|    }
_ZN4QPDF3Doc13linearizationEv:
 1349|  8.57k|{
 1350|  8.57k|    return m->lin;
 1351|  8.57k|};
_ZN4QPDF3Doc6Common3toOImEExRKT_:
  319|  1.53M|        {
  320|  1.53M|            return QIntC::to_offset(i);
  321|  1.53M|        }
_ZN4QPDF3Doc6Common3toIIxEEiRKT_:
  331|  6.72M|        {
  332|  6.72M|            return QIntC::to_int(i);
  333|  6.72M|        }
_ZN4QPDF8ObjCacheC2Ev:
  170|   764k|    ObjCache() = default;
_ZN4QPDF3Doc6Common3toIImEEiRKT_:
  331|  15.5k|        {
  332|  15.5k|            return QIntC::to_int(i);
  333|  15.5k|        }
_ZN4QPDF3Doc6Common3toSIiEEmRKT_:
  325|  79.3k|        {
  326|  79.3k|            return QIntC::to_size(i);
  327|  79.3k|        }
_ZN4QPDF3Doc6Common3toIIlEEiRKT_:
  331|  8.17k|        {
  332|  8.17k|            return QIntC::to_int(i);
  333|  8.17k|        }
_ZN4QPDF3Doc6Common3toSIyEEmRKT_:
  325|  28.6k|        {
  326|  28.6k|            return QIntC::to_size(i);
  327|  28.6k|        }
_ZN4QPDF3Doc6Common3toSIxEEmRKT_:
  325|  28.7k|        {
  326|  28.7k|            return QIntC::to_size(i);
  327|  28.7k|        }

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

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

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

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

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

_ZN4qpdf4util17internal_error_ifIRA29_KcEEvbOT_:
   36|  4.21M|    {
   37|  4.21M|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 4.21M]
  ------------------
   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|  4.21M|    }
_ZN4qpdf4util9assertionIRA44_KcEEvbOT_:
   27|   125k|    {
   28|   125k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 125k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   125k|    }
_ZN4qpdf4util17internal_error_ifIRA28_KcEEvbOT_:
   36|   697k|    {
   37|   697k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 0, False: 697k]
  ------------------
   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|   697k|    }
_ZN4qpdf4util15hex_decode_charEc:
   99|   765k|    {
  100|   765k|        return digit <= '9' && digit >= '0'
  ------------------
  |  Branch (100:16): [True: 612k, False: 153k]
  |  Branch (100:32): [True: 229k, False: 382k]
  ------------------
  101|   765k|            ? char(digit - '0')
  102|   765k|            : (digit >= 'a' ? char(digit - 'a' + 10)
  ------------------
  |  Branch (102:16): [True: 76.1k, False: 460k]
  ------------------
  103|   536k|                            : (digit >= 'A' ? char(digit - 'A' + 10) : '\20'));
  ------------------
  |  Branch (103:32): [True: 55.9k, False: 404k]
  ------------------
  104|   765k|    }
_ZN4qpdf4util8is_spaceEc:
  114|  41.2M|    {
  115|  41.2M|        return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v';
  ------------------
  |  Branch (115:16): [True: 5.36M, False: 35.8M]
  |  Branch (115:29): [True: 852k, False: 34.9M]
  |  Branch (115:43): [True: 488k, False: 34.5M]
  |  Branch (115:57): [True: 107k, False: 34.3M]
  |  Branch (115:71): [True: 592k, False: 33.8M]
  |  Branch (115:85): [True: 102k, False: 33.7M]
  ------------------
  116|  41.2M|    }
_ZN4qpdf4util8is_digitEc:
  120|  19.0M|    {
  121|  19.0M|        return (ch >= '0' && ch <= '9');
  ------------------
  |  Branch (121:17): [True: 15.1M, False: 3.86M]
  |  Branch (121:30): [True: 15.0M, False: 121k]
  ------------------
  122|  19.0M|    }
_ZN4qpdf4util15hex_encode_charEc:
  127|  1.79M|    {
  128|  1.79M|        static auto constexpr hexchars = "0123456789abcdef";
  129|  1.79M|        return {'#', hexchars[static_cast<unsigned char>(c) >> 4], hexchars[c & 0x0f]};
  130|  1.79M|    }
_ZN4qpdf4util9incrementERNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEi:
  135|  37.2k|    {
  136|  37.2k|        auto end = s.rend();
  137|  41.1k|        for (auto it = s.rbegin() + tail; it != end; ++it) {
  ------------------
  |  Branch (137:43): [True: 40.6k, False: 456]
  ------------------
  138|  40.6k|            ++*it;
  139|  40.6k|            if (*it != ':') {
  ------------------
  |  Branch (139:17): [True: 36.7k, False: 3.88k]
  ------------------
  140|  36.7k|                return;
  141|  36.7k|            }
  142|  3.88k|            *it = '0';
  143|  3.88k|        }
  144|    456|        s.insert(0, 1, '1');
  145|    456|    }
_ZN4qpdf4util9assertionIRA57_KcEEvbOT_:
   27|  2.35k|    {
   28|  2.35k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.35k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.35k|    }
_ZN4qpdf4util9assertionIRA51_KcEEvbOT_:
   27|    865|    {
   28|    865|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 865]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    865|    }
_ZN4qpdf4util9assertionIRA41_KcEEvbOT_:
   27|  8.57k|    {
   28|  8.57k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 8.57k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  8.57k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralElQsr3stdE8integralIT_EEEbT0_:
   63|  22.0k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  22.0k|                          std::numeric_limits<T>::min())) {
   67|  22.0k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 22.0k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  22.0k|        }
   71|       |        if constexpr (std::cmp_greater(
   72|       |                          std::numeric_limits<decltype(val)>::max(),
   73|  22.0k|                          std::numeric_limits<T>::max())) {
   74|  22.0k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 22.0k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  22.0k|        }
   78|  22.0k|        return true;
   79|  22.0k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEiQsr3stdE8integralIT_EEEbT0_:
   63|  22.0k|    {
   64|       |        if constexpr (std::cmp_less(
   65|       |                          std::numeric_limits<decltype(val)>::min(),
   66|  22.0k|                          std::numeric_limits<T>::min())) {
   67|  22.0k|            if (std::cmp_less(val, std::numeric_limits<T>::min())) {
  ------------------
  |  Branch (67:17): [True: 0, False: 22.0k]
  ------------------
   68|      0|                return false;
   69|      0|            }
   70|  22.0k|        }
   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|  22.0k|        return true;
   79|  22.0k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEyQsr3stdE8integralIT_EEEbT0_:
   63|  92.7k|    {
   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|  92.7k|                          std::numeric_limits<T>::max())) {
   74|  92.7k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 6, False: 92.7k]
  ------------------
   75|      6|                return false;
   76|      6|            }
   77|  92.7k|        }
   78|  92.7k|        return true;
   79|  92.7k|    }
_ZN4qpdf4util9assertionIRA45_KcEEvbOT_:
   27|  1.25M|    {
   28|  1.25M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 1.25M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  1.25M|    }
_ZN4qpdf4util9assertionIRA121_KcEEvbOT_:
   27|   789k|    {
   28|   789k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 789k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   789k|    }
_ZN4qpdf4util4fitsIiTkNSt3__18integralEmQsr3stdE8integralIT_EEEbT0_:
   63|  8.54k|    {
   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|  8.54k|                          std::numeric_limits<T>::max())) {
   74|  8.54k|            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
  ------------------
  |  Branch (74:17): [True: 0, False: 8.54k]
  ------------------
   75|      0|                return false;
   76|      0|            }
   77|  8.54k|        }
   78|  8.54k|        return true;
   79|  8.54k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA58_KcEEvbOT_:
   48|  1.61k|    {
   49|  1.61k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.61k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.61k|    }
_ZN4qpdf4util9assertionINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   27|   282k|    {
   28|   282k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 282k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   282k|    }
_ZN4qpdf4util9assertionIRA54_KcEEvbOT_:
   27|   841k|    {
   28|   841k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 841k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   841k|    }
_ZN4qpdf4util9assertionIRA53_KcEEvbOT_:
   27|  20.4k|    {
   28|  20.4k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 20.4k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  20.4k|    }
_ZN4qpdf4util9assertionIRA35_KcEEvbOT_:
   27|  3.97k|    {
   28|  3.97k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 3.97k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  3.97k|    }
_ZN4qpdf4util17internal_error_ifIRA34_KcEEvbOT_:
   36|   352k|    {
   37|   352k|        if (cond) {
  ------------------
  |  Branch (37:13): [True: 1, False: 352k]
  ------------------
   38|      1|            throw std::logic_error("INTERNAL ERROR: "s.append(std::forward<T>(msg))
   39|      1|                                       .append(
   40|      1|                                           "\nThis is a qpdf bug. Please report at "
   41|      1|                                           "https://github.com/qpdf/qpdf/issues"));
   42|      1|        }
   43|   352k|    }
_ZN4qpdf4util9assertionIRA68_KcEEvbOT_:
   27|  2.02k|    {
   28|  2.02k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.02k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.02k|    }
_ZN4qpdf4util9assertionIRA83_KcEEvbOT_:
   27|   101k|    {
   28|   101k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 101k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   101k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA51_KcEEvbOT_:
   48|  1.57M|    {
   49|  1.57M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 22, False: 1.57M]
  ------------------
   50|     22|            throw std::runtime_error(std::forward<T>(msg));
   51|     22|        }
   52|  1.57M|    }
_ZN4qpdf4util9assertionIRA50_KcEEvbOT_:
   27|   280k|    {
   28|   280k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 280k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|   280k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA23_KcEEvbOT_:
   48|  1.36M|    {
   49|  1.36M|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 273, False: 1.36M]
  ------------------
   50|    273|            throw std::runtime_error(std::forward<T>(msg));
   51|    273|        }
   52|  1.36M|    }
_ZN4qpdf4util9assertionIRA43_KcEEvbOT_:
   27|  15.6k|    {
   28|  15.6k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 15.6k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  15.6k|    }
_ZN4qpdf4util9assertionIRA52_KcEEvbOT_:
   27|  37.2M|    {
   28|  37.2M|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 37.2M]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  37.2M|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA44_KcEEvbOT_:
   48|  20.2k|    {
   49|  20.2k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 48, False: 20.2k]
  ------------------
   50|     48|            throw std::runtime_error(std::forward<T>(msg));
   51|     48|        }
   52|  20.2k|    }
_ZN4qpdf4util9assertionIRA58_KcEEvbOT_:
   27|  2.06k|    {
   28|  2.06k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 2.06k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  2.06k|    }
_ZN4qpdf4util9assertionIRA48_KcEEvbOT_:
   27|  16.2k|    {
   28|  16.2k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 16.2k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  16.2k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA73_KcEEvbOT_:
   48|  10.8k|    {
   49|  10.8k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 10.8k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  10.8k|    }
_ZN4qpdf4util9assertionIRA46_KcEEvbOT_:
   27|  10.3k|    {
   28|  10.3k|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 10.3k]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|  10.3k|    }
_ZN4qpdf4util17no_ci_rt_error_ifINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEEvbOT_:
   48|  39.5k|    {
   49|  39.5k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 39.5k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  39.5k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA69_KcEEvbOT_:
   48|  17.9k|    {
   49|  17.9k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 17.8k]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|  17.9k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA59_KcEEvbOT_:
   48|   165k|    {
   49|   165k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 165k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|   165k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA42_KcEEvbOT_:
   48|  19.8k|    {
   49|  19.8k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 19.8k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  19.8k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA49_KcEEvbOT_:
   48|  2.22k|    {
   49|  2.22k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 11, False: 2.21k]
  ------------------
   50|     11|            throw std::runtime_error(std::forward<T>(msg));
   51|     11|        }
   52|  2.22k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA88_KcEEvbOT_:
   48|  1.61k|    {
   49|  1.61k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 1.61k]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|  1.61k|    }
_ZN4qpdf4util4fitsIjTkNSt3__18integralEjQsr3stdE8integralIT_EEEbT0_:
   63|  1.61k|    {
   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|       |                          std::numeric_limits<T>::max())) {
   74|       |            if (std::cmp_greater(val, std::numeric_limits<T>::max())) {
   75|       |                return false;
   76|       |            }
   77|       |        }
   78|  1.61k|        return true;
   79|  1.61k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA45_KcEEvbOT_:
   48|  1.61k|    {
   49|  1.61k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 3, False: 1.61k]
  ------------------
   50|      3|            throw std::runtime_error(std::forward<T>(msg));
   51|      3|        }
   52|  1.61k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA32_KcEEvbOT_:
   48|  1.61k|    {
   49|  1.61k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 16, False: 1.59k]
  ------------------
   50|     16|            throw std::runtime_error(std::forward<T>(msg));
   51|     16|        }
   52|  1.61k|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA35_KcEEvbOT_:
   48|  39.8k|    {
   49|  39.8k|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 5, False: 39.8k]
  ------------------
   50|      5|            throw std::runtime_error(std::forward<T>(msg));
   51|      5|        }
   52|  39.8k|    }
_ZN4qpdf4util9assertionIRA47_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|    }
_ZN4qpdf4util9assertionIRA56_KcEEvbOT_:
   27|    603|    {
   28|    603|        if (!cond) {
  ------------------
  |  Branch (28:13): [True: 0, False: 603]
  ------------------
   29|      0|            throw std::logic_error(std::forward<T>(msg));
   30|      0|        }
   31|    603|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA53_KcEEvbOT_:
   48|    603|    {
   49|    603|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 12, False: 591]
  ------------------
   50|     12|            throw std::runtime_error(std::forward<T>(msg));
   51|     12|        }
   52|    603|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA92_KcEEvbOT_:
   48|    581|    {
   49|    581|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 0, False: 581]
  ------------------
   50|      0|            throw std::runtime_error(std::forward<T>(msg));
   51|      0|        }
   52|    581|    }
_ZN4qpdf4util17no_ci_rt_error_ifIRA36_KcEEvbOT_:
   48|    578|    {
   49|    578|        if (cond) {
  ------------------
  |  Branch (49:13): [True: 21, False: 557]
  ------------------
   50|     21|            throw std::runtime_error(std::forward<T>(msg));
   51|     21|        }
   52|    578|    }

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

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

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

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

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

sph_sha224:
  173|  44.9k|{
  174|  44.9k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  44.9k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  44.9k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  44.9k|        unsigned current;
  176|  44.9k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  44.9k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   95|  44.9k|#define SPH_BLEN     64U
  ------------------
  |  Branch (181:13): [True: 2.81k, False: 42.1k]
  ------------------
  182|  2.81k|                SPH_XCAT(HASH, _short)(cc, data, len);
  ------------------
  |  |   85|  2.81k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.81k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  183|  2.81k|                return;
  184|  2.81k|        }
  185|  42.1k|        sc = cc;
  186|  42.1k|#if SPH_64
  187|  42.1k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  42.1k|#define SPH_BLEN     64U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  42.1k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 42.1k]
  ------------------
  192|      0|                unsigned t;
  193|       |
  194|      0|                t = SPH_BLEN - current;
  ------------------
  |  |   95|      0|#define SPH_BLEN     64U
  ------------------
  195|      0|                SPH_XCAT(HASH, _short)(cc, data, t);
  ------------------
  |  |   85|      0|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|      0|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  196|      0|                data = (const unsigned char *)data + t;
  197|      0|                len -= t;
  198|      0|        }
  199|       |#if !SPH_UNALIGNED
  200|       |        if (((SPH_UPTR)data & (SPH_WLEN - 1U)) != 0) {
  201|       |                SPH_XCAT(HASH, _short)(cc, data, len);
  202|       |                return;
  203|       |        }
  204|       |#endif
  205|  42.1k|        orig_len = len;
  206|  2.96M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   95|  2.96M|#define SPH_BLEN     64U
  ------------------
  |  Branch (206:16): [True: 2.92M, False: 42.1k]
  ------------------
  207|  2.92M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  647|  2.92M|#define RFUN   sha2_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  2.92M|#define SPH_VAL   sc->val
  ------------------
  208|  2.92M|                len -= SPH_BLEN;
  ------------------
  |  |   95|  2.92M|#define SPH_BLEN     64U
  ------------------
  209|  2.92M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   95|  2.92M|#define SPH_BLEN     64U
  ------------------
  210|  2.92M|        }
  211|  42.1k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 42.1k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  42.1k|#if SPH_64
  214|  42.1k|        sc->count += (sph_u64)orig_len;
  215|       |#else
  216|       |        clow = sc->count_low;
  217|       |        clow2 = SPH_T32(clow + orig_len);
  218|       |        sc->count_low = clow2;
  219|       |        if (clow2 < clow)
  220|       |                sc->count_high ++;
  221|       |        /*
  222|       |         * This code handles the improbable situation where "size_t" is
  223|       |         * greater than 32 bits, and yet we do not have a 64-bit type.
  224|       |         */
  225|       |        orig_len >>= 12;
  226|       |        orig_len >>= 10;
  227|       |        orig_len >>= 10;
  228|       |        sc->count_high += orig_len;
  229|       |#endif
  230|  42.1k|}
sha2.c:sha224_short:
  131|  2.81k|{
  132|  2.81k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  2.81k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  2.81k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  133|  2.81k|        unsigned current;
  134|       |
  135|  2.81k|        sc = cc;
  136|  2.81k|#if SPH_64
  137|  2.81k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  2.81k|#define SPH_BLEN     64U
  ------------------
  138|       |#else
  139|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  140|       |#endif
  141|  5.63k|        while (len > 0) {
  ------------------
  |  Branch (141:16): [True: 2.81k, False: 2.81k]
  ------------------
  142|  2.81k|                unsigned clen;
  143|       |#if !SPH_64
  144|       |                sph_u32 clow, clow2;
  145|       |#endif
  146|       |
  147|  2.81k|                clen = SPH_BLEN - current;
  ------------------
  |  |   95|  2.81k|#define SPH_BLEN     64U
  ------------------
  148|  2.81k|                if (clen > len)
  ------------------
  |  Branch (148:21): [True: 2.81k, False: 0]
  ------------------
  149|  2.81k|                        clen = (unsigned)len;
  150|  2.81k|                memcpy(sc->buf + current, data, clen);
  151|  2.81k|                data = (const unsigned char *)data + clen;
  152|  2.81k|                current += clen;
  153|  2.81k|                len -= clen;
  154|  2.81k|                if (current == SPH_BLEN) {
  ------------------
  |  |   95|  2.81k|#define SPH_BLEN     64U
  ------------------
  |  Branch (154:21): [True: 0, False: 2.81k]
  ------------------
  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.81k|#if SPH_64
  159|  2.81k|                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.81k|        }
  168|  2.81k|}
sha2.c:sha224_close:
  345|  44.0k|{
  346|  44.0k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  44.0k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  44.0k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  44.0k|}
sha2.c:sha224_addbits_and_close:
  242|  44.0k|{
  243|  44.0k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  44.0k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  44.0k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  44.0k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  44.0k|        sc = cc;
  250|  44.0k|#if SPH_64
  251|  44.0k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   95|  44.0k|#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|  44.0k|        {
  259|  44.0k|                unsigned z;
  260|       |
  261|  44.0k|                z = 0x80U >> n;
  262|  44.0k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  44.0k|        }
  264|  44.0k|#endif
  265|  44.0k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  44.0k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  44.0k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  44.0k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 870, False: 43.1k]
  ------------------
  266|    870|                memset(sc->buf + current, 0, SPH_BLEN - current);
  ------------------
  |  |   95|    870|#define SPH_BLEN     64U
  ------------------
  267|    870|                RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|    870|#define RFUN   sha2_round
  ------------------
                              RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|    870|#define SPH_VAL   sc->val
  ------------------
  268|    870|                memset(sc->buf, 0, SPH_MAXPAD);
  ------------------
  |  |  110|    870|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|    870|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|    870|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  269|  43.1k|        } else {
  270|  43.1k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  43.1k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  43.1k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  43.1k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  271|  43.1k|        }
  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|  44.0k|#if SPH_64
  303|  44.0k|#ifdef BE32
  304|  44.0k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD,
  ------------------
  |  |  110|  44.0k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   95|  44.0k|#define SPH_BLEN     64U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   96|  44.0k|#define SPH_WLEN      4U
  |  |  ------------------
  ------------------
  305|  44.0k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  44.0k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  44.0k|#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|  44.0k|#endif
  323|  44.0k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  647|  44.0k|#define RFUN   sha2_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  44.0k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   396k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 352k, False: 44.0k]
  ------------------
  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|   352k|        }
  340|  44.0k|#endif
  341|  44.0k|}
sph_sha384:
  173|  88.7k|{
  174|  88.7k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  88.7k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  88.7k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  175|  88.7k|        unsigned current;
  176|  88.7k|        size_t orig_len;
  177|       |#if !SPH_64
  178|       |        sph_u32 clow, clow2;
  179|       |#endif
  180|       |
  181|  88.7k|        if (len < (2 * SPH_BLEN)) {
  ------------------
  |  |   92|  88.7k|#define SPH_BLEN    128U
  ------------------
  |  Branch (181:13): [True: 0, False: 88.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|  88.7k|        sc = cc;
  186|  88.7k|#if SPH_64
  187|  88.7k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  88.7k|#define SPH_BLEN    128U
  ------------------
  188|       |#else
  189|       |        current = (unsigned)sc->count_low & (SPH_BLEN - 1U);
  190|       |#endif
  191|  88.7k|        if (current > 0) {
  ------------------
  |  Branch (191:13): [True: 0, False: 88.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|  88.7k|        orig_len = len;
  206|  3.10M|        while (len >= SPH_BLEN) {
  ------------------
  |  |   92|  3.10M|#define SPH_BLEN    128U
  ------------------
  |  Branch (206:16): [True: 3.01M, False: 88.7k]
  ------------------
  207|  3.01M|                RFUN(data, SPH_VAL);
  ------------------
  |  |  202|  3.01M|#define RFUN   sha3_round
  ------------------
                              RFUN(data, SPH_VAL);
  ------------------
  |  |  119|  3.01M|#define SPH_VAL   sc->val
  ------------------
  208|  3.01M|                len -= SPH_BLEN;
  ------------------
  |  |   92|  3.01M|#define SPH_BLEN    128U
  ------------------
  209|  3.01M|                data = (const unsigned char *)data + SPH_BLEN;
  ------------------
  |  |   92|  3.01M|#define SPH_BLEN    128U
  ------------------
  210|  3.01M|        }
  211|  88.7k|        if (len > 0)
  ------------------
  |  Branch (211:13): [True: 0, False: 88.7k]
  ------------------
  212|      0|                memcpy(sc->buf, data, len);
  213|  88.7k|#if SPH_64
  214|  88.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|  88.7k|}
sha2big.c:sha384_close:
  345|  88.7k|{
  346|  88.7k|        SPH_XCAT(HASH, _addbits_and_close)(cc, 0, 0, dst, rnum);
  ------------------
  |  |   85|  88.7k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  88.7k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  347|  88.7k|}
sha2big.c:sha384_addbits_and_close:
  242|  88.7k|{
  243|  88.7k|        SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
  ------------------
  |  |   85|  88.7k|#define SPH_XCAT(a, b)     SPH_XCAT_(a, b)
  |  |  ------------------
  |  |  |  |   87|  88.7k|#define SPH_XCAT_(a, b)    a ## b
  |  |  ------------------
  ------------------
  244|  88.7k|        unsigned current, u;
  245|       |#if !SPH_64
  246|       |        sph_u32 low, high;
  247|       |#endif
  248|       |
  249|  88.7k|        sc = cc;
  250|  88.7k|#if SPH_64
  251|  88.7k|        current = (unsigned)sc->count & (SPH_BLEN - 1U);
  ------------------
  |  |   92|  88.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|  88.7k|        {
  259|  88.7k|                unsigned z;
  260|       |
  261|  88.7k|                z = 0x80U >> n;
  262|  88.7k|                sc->buf[current ++] = ((ub & -z) | z) & 0xFF;
  263|  88.7k|        }
  264|  88.7k|#endif
  265|  88.7k|        if (current > SPH_MAXPAD) {
  ------------------
  |  |  110|  88.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  88.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  88.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  |  Branch (265:13): [True: 0, False: 88.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|  88.7k|        } else {
  270|  88.7k|                memset(sc->buf + current, 0, SPH_MAXPAD - current);
  ------------------
  |  |  110|  88.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  88.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  88.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  271|  88.7k|        }
  272|  88.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|  88.7k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD, sc->count >> 61);
  ------------------
  |  |  110|  88.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  88.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  88.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
  284|  88.7k|        sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |  110|  88.7k|#define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   92|  88.7k|#define SPH_BLEN    128U
  |  |  ------------------
  |  |               #define SPH_MAXPAD   (SPH_BLEN - (SPH_WLEN << 1))
  |  |  ------------------
  |  |  |  |   93|  88.7k|#define SPH_WLEN      8U
  |  |  ------------------
  ------------------
                      sph_enc64be_aligned(sc->buf + SPH_MAXPAD + SPH_WLEN,
  ------------------
  |  |   93|  88.7k|#define SPH_WLEN      8U
  ------------------
  285|  88.7k|                SPH_T64(sc->count << 3) + (sph_u64)n);
  ------------------
  |  |  944|  88.7k|#define SPH_T64(x)    ((x) & SPH_C64(0xFFFFFFFFFFFFFFFF))
  |  |  ------------------
  |  |  |  |  854|  88.7k|#define SPH_C64(x)    ((sph_u64)(x))
  |  |  ------------------
  ------------------
  286|  88.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|  88.7k|        RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  202|  88.7k|#define RFUN   sha3_round
  ------------------
                      RFUN(sc->buf, SPH_VAL);
  ------------------
  |  |  119|  88.7k|#define SPH_VAL   sc->val
  ------------------
  324|       |#ifdef SPH_NO_OUTPUT
  325|       |        (void)dst;
  326|       |        (void)rnum;
  327|       |        (void)u;
  328|       |#else
  329|   708k|        for (u = 0; u < rnum; u ++) {
  ------------------
  |  Branch (329:21): [True: 620k, False: 88.7k]
  ------------------
  330|   620k|#if defined BE64
  331|   620k|                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|   620k|        }
  340|  88.7k|#endif
  341|  88.7k|}

sha2.c:sph_dec32be_aligned:
 1471|  47.5M|{
 1472|  47.5M|#if SPH_LITTLE_ENDIAN
 1473|  47.5M|        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|  47.5M|}
sha2.c:sph_bswap32:
 1220|  47.9M|{
 1221|  47.9M|        __asm__ __volatile__ ("bswapl %0" : "=r" (x) : "0" (x));
 1222|  47.9M|        return x;
 1223|  47.9M|}
sha2.c:sph_enc64be_aligned:
 1706|  44.0k|{
 1707|  44.0k|#if SPH_LITTLE_ENDIAN
 1708|  44.0k|        *(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|  44.0k|}
sha2.c:sph_bswap64:
 1229|  44.0k|{
 1230|  44.0k|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  44.0k|        return x;
 1232|  44.0k|}
sha2.c:sph_enc32be:
 1374|   352k|{
 1375|   352k|#if defined SPH_UPTR
 1376|   352k|#if SPH_UNALIGNED
 1377|   352k|#if SPH_LITTLE_ENDIAN
 1378|   352k|        val = sph_bswap32(val);
 1379|   352k|#endif
 1380|   352k|        *(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|   352k|}
sha2big.c:sph_dec64be_aligned:
 1778|  49.7M|{
 1779|  49.7M|#if SPH_LITTLE_ENDIAN
 1780|  49.7M|        return sph_bswap64(*(const sph_u64 *)src);
 1781|       |#elif SPH_BIG_ENDIAN
 1782|       |        return *(const sph_u64 *)src;
 1783|       |#else
 1784|       |        return ((sph_u64)(((const unsigned char *)src)[0]) << 56)
 1785|       |                | ((sph_u64)(((const unsigned char *)src)[1]) << 48)
 1786|       |                | ((sph_u64)(((const unsigned char *)src)[2]) << 40)
 1787|       |                | ((sph_u64)(((const unsigned char *)src)[3]) << 32)
 1788|       |                | ((sph_u64)(((const unsigned char *)src)[4]) << 24)
 1789|       |                | ((sph_u64)(((const unsigned char *)src)[5]) << 16)
 1790|       |                | ((sph_u64)(((const unsigned char *)src)[6]) << 8)
 1791|       |                | (sph_u64)(((const unsigned char *)src)[7]);
 1792|       |#endif
 1793|  49.7M|}
sha2big.c:sph_bswap64:
 1229|  50.5M|{
 1230|  50.5M|        __asm__ __volatile__ ("bswapq %0" : "=r" (x) : "0" (x));
 1231|  50.5M|        return x;
 1232|  50.5M|}
sha2big.c:sph_enc64be_aligned:
 1706|   177k|{
 1707|   177k|#if SPH_LITTLE_ENDIAN
 1708|   177k|        *(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|   177k|}
sha2big.c:sph_enc64be:
 1661|   620k|{
 1662|   620k|#if defined SPH_UPTR
 1663|   620k|#if SPH_UNALIGNED
 1664|   620k|#if SPH_LITTLE_ENDIAN
 1665|   620k|        val = sph_bswap64(val);
 1666|   620k|#endif
 1667|   620k|        *(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|   620k|}

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

inflate_fast:
   50|  56.1k|void ZLIB_INTERNAL inflate_fast(z_streamp strm, unsigned start) {
   51|  56.1k|    struct inflate_state FAR *state;
   52|  56.1k|    z_const unsigned char FAR *in;      /* local strm->next_in */
   53|  56.1k|    z_const unsigned char FAR *last;    /* have enough input while in < last */
   54|  56.1k|    unsigned char FAR *out;     /* local strm->next_out */
   55|  56.1k|    unsigned char FAR *beg;     /* inflate()'s initial strm->next_out */
   56|  56.1k|    unsigned char FAR *end;     /* while out < end, enough space available */
   57|       |#ifdef INFLATE_STRICT
   58|       |    unsigned dmax;              /* maximum distance from zlib header */
   59|       |#endif
   60|  56.1k|    unsigned wsize;             /* window size or zero if not using window */
   61|  56.1k|    unsigned whave;             /* valid bytes in the window */
   62|  56.1k|    unsigned wnext;             /* window write index */
   63|  56.1k|    unsigned char FAR *window;  /* allocated sliding window, if wsize != 0 */
   64|  56.1k|    unsigned long hold;         /* local strm->hold */
   65|  56.1k|    unsigned bits;              /* local strm->bits */
   66|  56.1k|    code const FAR *lcode;      /* local strm->lencode */
   67|  56.1k|    code const FAR *dcode;      /* local strm->distcode */
   68|  56.1k|    unsigned lmask;             /* mask for first level of length codes */
   69|  56.1k|    unsigned dmask;             /* mask for first level of distance codes */
   70|  56.1k|    code const *here;           /* retrieved table entry */
   71|  56.1k|    unsigned op;                /* code bits, operation, extra bits, or */
   72|       |                                /*  window position, window bytes to copy */
   73|  56.1k|    unsigned len;               /* match length, unused bytes */
   74|  56.1k|    unsigned dist;              /* match distance */
   75|  56.1k|    unsigned char FAR *from;    /* where to copy match from */
   76|       |
   77|       |    /* copy state to local variables */
   78|  56.1k|    state = (struct inflate_state FAR *)strm->state;
   79|  56.1k|    in = strm->next_in;
   80|  56.1k|    last = in + (strm->avail_in - 5);
   81|  56.1k|    out = strm->next_out;
   82|  56.1k|    beg = out - (start - strm->avail_out);
   83|  56.1k|    end = out + (strm->avail_out - 257);
   84|       |#ifdef INFLATE_STRICT
   85|       |    dmax = state->dmax;
   86|       |#endif
   87|  56.1k|    wsize = state->wsize;
   88|  56.1k|    whave = state->whave;
   89|  56.1k|    wnext = state->wnext;
   90|  56.1k|    window = state->window;
   91|  56.1k|    hold = state->hold;
   92|  56.1k|    bits = state->bits;
   93|  56.1k|    lcode = state->lencode;
   94|  56.1k|    dcode = state->distcode;
   95|  56.1k|    lmask = (1U << state->lenbits) - 1;
   96|  56.1k|    dmask = (1U << state->distbits) - 1;
   97|       |
   98|       |    /* decode literals and length/distances until end-of-block or not enough
   99|       |       input data or output space */
  100|  6.88M|    do {
  101|  6.88M|        if (bits < 15) {
  ------------------
  |  Branch (101:13): [True: 3.23M, False: 3.65M]
  ------------------
  102|  3.23M|            hold += (unsigned long)(*in++) << bits;
  103|  3.23M|            bits += 8;
  104|  3.23M|            hold += (unsigned long)(*in++) << bits;
  105|  3.23M|            bits += 8;
  106|  3.23M|        }
  107|  6.88M|        here = lcode + (hold & lmask);
  108|  7.17M|      dolen:
  109|  7.17M|        op = (unsigned)(here->bits);
  110|  7.17M|        hold >>= op;
  111|  7.17M|        bits -= op;
  112|  7.17M|        op = (unsigned)(here->op);
  113|  7.17M|        if (op == 0) {                          /* literal */
  ------------------
  |  Branch (113:13): [True: 4.57M, False: 2.59M]
  ------------------
  114|  4.57M|            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
  115|  4.57M|                    "inflate:         literal '%c'\n" :
  116|  4.57M|                    "inflate:         literal 0x%02x\n", here->val));
  117|  4.57M|            *out++ = (unsigned char)(here->val);
  118|  4.57M|        }
  119|  2.59M|        else if (op & 16) {                     /* length base */
  ------------------
  |  Branch (119:18): [True: 2.29M, False: 298k]
  ------------------
  120|  2.29M|            len = (unsigned)(here->val);
  121|  2.29M|            op &= 15;                           /* number of extra bits */
  122|  2.29M|            if (op) {
  ------------------
  |  Branch (122:17): [True: 632k, False: 1.66M]
  ------------------
  123|   632k|                if (bits < op) {
  ------------------
  |  Branch (123:21): [True: 829, False: 631k]
  ------------------
  124|    829|                    hold += (unsigned long)(*in++) << bits;
  125|    829|                    bits += 8;
  126|    829|                }
  127|   632k|                len += (unsigned)hold & ((1U << op) - 1);
  128|   632k|                hold >>= op;
  129|   632k|                bits -= op;
  130|   632k|            }
  131|  2.29M|            Tracevv((stderr, "inflate:         length %u\n", len));
  132|  2.29M|            if (bits < 15) {
  ------------------
  |  Branch (132:17): [True: 724k, False: 1.57M]
  ------------------
  133|   724k|                hold += (unsigned long)(*in++) << bits;
  134|   724k|                bits += 8;
  135|   724k|                hold += (unsigned long)(*in++) << bits;
  136|   724k|                bits += 8;
  137|   724k|            }
  138|  2.29M|            here = dcode + (hold & dmask);
  139|  2.34M|          dodist:
  140|  2.34M|            op = (unsigned)(here->bits);
  141|  2.34M|            hold >>= op;
  142|  2.34M|            bits -= op;
  143|  2.34M|            op = (unsigned)(here->op);
  144|  2.34M|            if (op & 16) {                      /* distance base */
  ------------------
  |  Branch (144:17): [True: 2.29M, False: 47.2k]
  ------------------
  145|  2.29M|                dist = (unsigned)(here->val);
  146|  2.29M|                op &= 15;                       /* number of extra bits */
  147|  2.29M|                if (bits < op) {
  ------------------
  |  Branch (147:21): [True: 8.21k, False: 2.29M]
  ------------------
  148|  8.21k|                    hold += (unsigned long)(*in++) << bits;
  149|  8.21k|                    bits += 8;
  150|  8.21k|                    if (bits < op) {
  ------------------
  |  Branch (150:25): [True: 70, False: 8.14k]
  ------------------
  151|     70|                        hold += (unsigned long)(*in++) << bits;
  152|     70|                        bits += 8;
  153|     70|                    }
  154|  8.21k|                }
  155|  2.29M|                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|  2.29M|                hold >>= op;
  165|  2.29M|                bits -= op;
  166|  2.29M|                Tracevv((stderr, "inflate:         distance %u\n", dist));
  167|  2.29M|                op = (unsigned)(out - beg);     /* max distance in output */
  168|  2.29M|                if (dist > op) {                /* see if copy from window */
  ------------------
  |  Branch (168:21): [True: 58.9k, False: 2.24M]
  ------------------
  169|  58.9k|                    op = dist - op;             /* distance back in window */
  170|  58.9k|                    if (op > whave) {
  ------------------
  |  Branch (170:25): [True: 831, False: 58.1k]
  ------------------
  171|    831|                        if (state->sane) {
  ------------------
  |  Branch (171:29): [True: 831, False: 0]
  ------------------
  172|    831|                            strm->msg = (z_const char *)
  173|    831|                                "invalid distance too far back";
  174|    831|                            state->mode = BAD;
  175|    831|                            break;
  176|    831|                        }
  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|    831|                    }
  197|  58.1k|                    from = window;
  198|  58.1k|                    if (wnext == 0) {           /* very common case */
  ------------------
  |  Branch (198:25): [True: 11.0k, False: 47.0k]
  ------------------
  199|  11.0k|                        from += wsize - op;
  200|  11.0k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (200:29): [True: 361, False: 10.6k]
  ------------------
  201|    361|                            len -= op;
  202|  38.3k|                            do {
  203|  38.3k|                                *out++ = *from++;
  204|  38.3k|                            } while (--op);
  ------------------
  |  Branch (204:38): [True: 37.9k, False: 361]
  ------------------
  205|    361|                            from = out - dist;  /* rest from output */
  206|    361|                        }
  207|  11.0k|                    }
  208|  47.0k|                    else if (wnext < op) {      /* wrap around window */
  ------------------
  |  Branch (208:30): [True: 471, False: 46.5k]
  ------------------
  209|    471|                        from += wsize + wnext - op;
  210|    471|                        op -= wnext;
  211|    471|                        if (op < len) {         /* some from end of window */
  ------------------
  |  Branch (211:29): [True: 53, False: 418]
  ------------------
  212|     53|                            len -= op;
  213|  1.01k|                            do {
  214|  1.01k|                                *out++ = *from++;
  215|  1.01k|                            } while (--op);
  ------------------
  |  Branch (215:38): [True: 957, False: 53]
  ------------------
  216|     53|                            from = window;
  217|     53|                            if (wnext < len) {  /* some from start of window */
  ------------------
  |  Branch (217:33): [True: 20, False: 33]
  ------------------
  218|     20|                                op = wnext;
  219|     20|                                len -= op;
  220|    503|                                do {
  221|    503|                                    *out++ = *from++;
  222|    503|                                } while (--op);
  ------------------
  |  Branch (222:42): [True: 483, False: 20]
  ------------------
  223|     20|                                from = out - dist;      /* rest from output */
  224|     20|                            }
  225|     53|                        }
  226|    471|                    }
  227|  46.5k|                    else {                      /* contiguous in window */
  228|  46.5k|                        from += wnext - op;
  229|  46.5k|                        if (op < len) {         /* some from window */
  ------------------
  |  Branch (229:29): [True: 7.02k, False: 39.5k]
  ------------------
  230|  7.02k|                            len -= op;
  231|  99.2k|                            do {
  232|  99.2k|                                *out++ = *from++;
  233|  99.2k|                            } while (--op);
  ------------------
  |  Branch (233:38): [True: 92.1k, False: 7.02k]
  ------------------
  234|  7.02k|                            from = out - dist;  /* rest from output */
  235|  7.02k|                        }
  236|  46.5k|                    }
  237|   446k|                    while (len > 2) {
  ------------------
  |  Branch (237:28): [True: 388k, False: 58.1k]
  ------------------
  238|   388k|                        *out++ = *from++;
  239|   388k|                        *out++ = *from++;
  240|   388k|                        *out++ = *from++;
  241|   388k|                        len -= 3;
  242|   388k|                    }
  243|  58.1k|                    if (len) {
  ------------------
  |  Branch (243:25): [True: 28.2k, False: 29.8k]
  ------------------
  244|  28.2k|                        *out++ = *from++;
  245|  28.2k|                        if (len > 1)
  ------------------
  |  Branch (245:29): [True: 13.2k, False: 15.0k]
  ------------------
  246|  13.2k|                            *out++ = *from++;
  247|  28.2k|                    }
  248|  58.1k|                }
  249|  2.24M|                else {
  250|  2.24M|                    from = out - dist;          /* copy direct from output */
  251|  33.4M|                    do {                        /* minimum length is three */
  252|  33.4M|                        *out++ = *from++;
  253|  33.4M|                        *out++ = *from++;
  254|  33.4M|                        *out++ = *from++;
  255|  33.4M|                        len -= 3;
  256|  33.4M|                    } while (len > 2);
  ------------------
  |  Branch (256:30): [True: 31.1M, False: 2.24M]
  ------------------
  257|  2.24M|                    if (len) {
  ------------------
  |  Branch (257:25): [True: 1.33M, False: 909k]
  ------------------
  258|  1.33M|                        *out++ = *from++;
  259|  1.33M|                        if (len > 1)
  ------------------
  |  Branch (259:29): [True: 785k, False: 545k]
  ------------------
  260|   785k|                            *out++ = *from++;
  261|  1.33M|                    }
  262|  2.24M|                }
  263|  2.29M|            }
  264|  47.2k|            else if ((op & 64) == 0) {          /* 2nd level distance code */
  ------------------
  |  Branch (264:22): [True: 47.2k, False: 53]
  ------------------
  265|  47.2k|                here = dcode + here->val + (hold & ((1U << op) - 1));
  266|  47.2k|                goto dodist;
  267|  47.2k|            }
  268|     53|            else {
  269|     53|                strm->msg = (z_const char *)"invalid distance code";
  270|     53|                state->mode = BAD;
  271|     53|                break;
  272|     53|            }
  273|  2.34M|        }
  274|   298k|        else if ((op & 64) == 0) {              /* 2nd level length code */
  ------------------
  |  Branch (274:18): [True: 289k, False: 9.01k]
  ------------------
  275|   289k|            here = lcode + here->val + (hold & ((1U << op) - 1));
  276|   289k|            goto dolen;
  277|   289k|        }
  278|  9.01k|        else if (op & 32) {                     /* end-of-block */
  ------------------
  |  Branch (278:18): [True: 8.99k, False: 12]
  ------------------
  279|  8.99k|            Tracevv((stderr, "inflate:         end of block\n"));
  280|  8.99k|            state->mode = TYPE;
  281|  8.99k|            break;
  282|  8.99k|        }
  283|     12|        else {
  284|     12|            strm->msg = (z_const char *)"invalid literal/length code";
  285|     12|            state->mode = BAD;
  286|     12|            break;
  287|     12|        }
  288|  7.17M|    } while (in < last && out < end);
  ------------------
  |  Branch (288:14): [True: 6.83M, False: 45.4k]
  |  Branch (288:27): [True: 6.83M, False: 812]
  ------------------
  289|       |
  290|       |    /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
  291|  56.1k|    len = bits >> 3;
  292|  56.1k|    in -= len;
  293|  56.1k|    bits -= len << 3;
  294|  56.1k|    hold &= (1U << bits) - 1;
  295|       |
  296|       |    /* update state and return */
  297|  56.1k|    strm->next_in = in;
  298|  56.1k|    strm->next_out = out;
  299|  56.1k|    strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
  ------------------
  |  Branch (299:33): [True: 32.2k, False: 23.8k]
  ------------------
  300|  56.1k|    strm->avail_out = (unsigned)(out < end ?
  ------------------
  |  Branch (300:34): [True: 55.2k, False: 822]
  ------------------
  301|  55.2k|                                 257 + (end - out) : 257 - (out - end));
  302|  56.1k|    state->hold = hold;
  303|  56.1k|    state->bits = bits;
  304|  56.1k|    return;
  305|  56.1k|}

inflateResetKeep:
  100|  15.4k|int ZEXPORT inflateResetKeep(z_streamp strm) {
  101|  15.4k|    struct inflate_state FAR *state;
  102|       |
  103|  15.4k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (103:9): [True: 0, False: 15.4k]
  ------------------
  104|  15.4k|    state = (struct inflate_state FAR *)strm->state;
  105|  15.4k|    strm->total_in = strm->total_out = state->total = 0;
  106|  15.4k|    strm->msg = Z_NULL;
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  107|  15.4k|    strm->data_type = 0;
  108|  15.4k|    if (state->wrap)        /* to support ill-conceived Java test suite */
  ------------------
  |  Branch (108:9): [True: 15.4k, False: 0]
  ------------------
  109|  15.4k|        strm->adler = state->wrap & 1;
  110|  15.4k|    state->mode = HEAD;
  111|  15.4k|    state->last = 0;
  112|  15.4k|    state->havedict = 0;
  113|  15.4k|    state->flags = -1;
  114|  15.4k|    state->dmax = 32768U;
  115|  15.4k|    state->head = Z_NULL;
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  116|  15.4k|    state->hold = 0;
  117|  15.4k|    state->bits = 0;
  118|  15.4k|    state->lencode = state->distcode = state->next = state->codes;
  119|  15.4k|    state->sane = 1;
  120|  15.4k|    state->back = -1;
  121|  15.4k|    Tracev((stderr, "inflate: reset\n"));
  122|  15.4k|    return Z_OK;
  ------------------
  |  |  181|  15.4k|#define Z_OK            0
  ------------------
  123|  15.4k|}
inflateReset:
  125|  15.4k|int ZEXPORT inflateReset(z_streamp strm) {
  126|  15.4k|    struct inflate_state FAR *state;
  127|       |
  128|  15.4k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (128:9): [True: 0, False: 15.4k]
  ------------------
  129|  15.4k|    state = (struct inflate_state FAR *)strm->state;
  130|  15.4k|    if (state->wbits != state->reqbits) {
  ------------------
  |  Branch (130:9): [True: 0, False: 15.4k]
  ------------------
  131|      0|        if (state->window != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (131:13): [True: 0, False: 0]
  ------------------
  132|      0|            ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  133|      0|            state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  134|      0|        }
  135|      0|        state->wbits = state->reqbits;
  136|      0|    }
  137|  15.4k|    state->wrap = state->reqwrap;
  138|  15.4k|    state->wsize = 0;
  139|  15.4k|    state->whave = 0;
  140|  15.4k|    state->wnext = 0;
  141|  15.4k|    return inflateResetKeep(strm);
  142|  15.4k|}
inflateReset2:
  144|  15.4k|int ZEXPORT inflateReset2(z_streamp strm, int windowBits) {
  145|  15.4k|    int wrap;
  146|  15.4k|    struct inflate_state FAR *state;
  147|       |
  148|       |    /* get the state */
  149|  15.4k|    if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  |  Branch (149:9): [True: 0, False: 15.4k]
  ------------------
  150|  15.4k|    state = (struct inflate_state FAR *)strm->state;
  151|       |
  152|       |    /* extract wrap request from windowBits parameter */
  153|  15.4k|    if (windowBits < 0) {
  ------------------
  |  Branch (153:9): [True: 0, False: 15.4k]
  ------------------
  154|      0|        if (windowBits < -15)
  ------------------
  |  Branch (154:13): [True: 0, False: 0]
  ------------------
  155|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  156|      0|        wrap = 0;
  157|      0|        windowBits = -windowBits;
  158|      0|    }
  159|  15.4k|    else {
  160|  15.4k|        wrap = (windowBits >> 4) + 5;
  161|  15.4k|#ifdef GUNZIP
  162|  15.4k|        if (windowBits < 48)
  ------------------
  |  Branch (162:13): [True: 15.4k, False: 0]
  ------------------
  163|  15.4k|            windowBits &= 15;
  164|  15.4k|#endif
  165|  15.4k|    }
  166|       |
  167|       |    /* set number of window bits, free window if different */
  168|  15.4k|    if (windowBits && (windowBits < 8 || windowBits > 15))
  ------------------
  |  Branch (168:9): [True: 15.4k, False: 0]
  |  Branch (168:24): [True: 0, False: 15.4k]
  |  Branch (168:42): [True: 0, False: 15.4k]
  ------------------
  169|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  170|  15.4k|    if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
  ------------------
  |  |  216|  30.9k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (170:9): [True: 0, False: 15.4k]
  |  Branch (170:36): [True: 0, False: 0]
  ------------------
  171|      0|        ZFREE(strm, state->window);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  172|      0|        state->window = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  173|      0|    }
  174|       |
  175|       |    /* update state and reset the rest of it */
  176|  15.4k|    state->reqwrap = state->wrap = wrap;
  177|  15.4k|    state->reqbits = state->wbits = (unsigned)windowBits;
  178|  15.4k|    return inflateReset(strm);
  179|  15.4k|}
inflateInit2_:
  182|  15.4k|                          const char *version, int stream_size) {
  183|  15.4k|    int ret;
  184|  15.4k|    struct inflate_state FAR *state;
  185|       |
  186|  15.4k|    if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |  216|  30.9k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
  ------------------
  |  |   44|  15.4k|#define ZLIB_VERSION "1.4"
  ------------------
  |  Branch (186:9): [True: 0, False: 15.4k]
  |  Branch (186:30): [True: 0, False: 15.4k]
  ------------------
  187|  15.4k|        stream_size != (int)(sizeof(z_stream)))
  ------------------
  |  Branch (187:9): [True: 0, False: 15.4k]
  ------------------
  188|      0|        return Z_VERSION_ERROR;
  ------------------
  |  |  189|      0|#define Z_VERSION_ERROR (-6)
  ------------------
  189|  15.4k|    if (strm == Z_NULL) return Z_STREAM_ERROR;
  ------------------
  |  |  216|  15.4k|#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 (189:9): [True: 0, False: 15.4k]
  ------------------
  190|  15.4k|    strm->msg = Z_NULL;                 /* in case we return an error */
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  191|  15.4k|    if (strm->zalloc == (alloc_func)0) {
  ------------------
  |  Branch (191:9): [True: 15.4k, False: 0]
  ------------------
  192|       |#ifdef Z_SOLO
  193|       |        return Z_STREAM_ERROR;
  194|       |#else
  195|  15.4k|        strm->zalloc = zcalloc;
  196|  15.4k|        strm->opaque = (voidpf)0;
  197|  15.4k|#endif
  198|  15.4k|    }
  199|  15.4k|    if (strm->zfree == (free_func)0)
  ------------------
  |  Branch (199:9): [True: 15.4k, False: 0]
  ------------------
  200|       |#ifdef Z_SOLO
  201|       |        return Z_STREAM_ERROR;
  202|       |#else
  203|  15.4k|        strm->zfree = zcfree;
  204|  15.4k|#endif
  205|  15.4k|    state = (struct inflate_state FAR *)
  206|  15.4k|            ZALLOC(strm, 1, sizeof(struct inflate_state));
  ------------------
  |  |  253|  15.4k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  207|  15.4k|    if (state == Z_NULL) return Z_MEM_ERROR;
  ------------------
  |  |  216|  15.4k|#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 (207:9): [True: 0, False: 15.4k]
  ------------------
  208|  15.4k|    zmemzero(state, sizeof(struct inflate_state));
  ------------------
  |  |  218|  15.4k|#    define zmemzero(dest, len) memset(dest, 0, len)
  ------------------
  209|  15.4k|    Tracev((stderr, "inflate: allocated\n"));
  210|  15.4k|    strm->state = (struct internal_state FAR *)state;
  211|  15.4k|    state->strm = strm;
  212|  15.4k|    state->window = Z_NULL;
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  213|  15.4k|    state->mode = HEAD;     /* to pass state test in inflateReset2() */
  214|  15.4k|    ret = inflateReset2(strm, windowBits);
  215|  15.4k|    if (ret != Z_OK) {
  ------------------
  |  |  181|  15.4k|#define Z_OK            0
  ------------------
  |  Branch (215:9): [True: 0, False: 15.4k]
  ------------------
  216|      0|        ZFREE(strm, state);
  ------------------
  |  |  254|      0|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  217|      0|        strm->state = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  218|      0|    }
  219|  15.4k|    return ret;
  220|  15.4k|}
inflateInit_:
  223|  15.4k|                         int stream_size) {
  224|  15.4k|    return inflateInit2_(strm, DEF_WBITS, version, stream_size);
  ------------------
  |  |   76|  15.4k|#  define DEF_WBITS MAX_WBITS
  |  |  ------------------
  |  |  |  |  287|  15.4k|#  define MAX_WBITS   15 /* 32K LZ77 window */
  |  |  ------------------
  ------------------
  225|  15.4k|}
inflate:
  482|   166k|int ZEXPORT inflate(z_streamp strm, int flush) {
  483|   166k|    struct inflate_state FAR *state;
  484|   166k|    z_const unsigned char FAR *next;    /* next input */
  485|   166k|    unsigned char FAR *put;     /* next output */
  486|   166k|    unsigned have, left;        /* available input and output */
  487|   166k|    unsigned long hold;         /* bit buffer */
  488|   166k|    unsigned bits;              /* bits in bit buffer */
  489|   166k|    unsigned in, out;           /* save starting available input and output */
  490|   166k|    unsigned copy;              /* number of stored or match bytes to copy */
  491|   166k|    unsigned char FAR *from;    /* where to copy match bytes from */
  492|   166k|    code here;                  /* current decoding table entry */
  493|   166k|    code last;                  /* parent table entry */
  494|   166k|    unsigned len;               /* length to copy for repeats, bits to drop */
  495|   166k|    int ret;                    /* return code */
  496|   166k|#ifdef GUNZIP
  497|   166k|    unsigned char hbuf[4];      /* buffer for gzip header crc calculation */
  498|   166k|#endif
  499|   166k|    static const unsigned short order[19] = /* permutation of code lengths */
  500|   166k|        {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15};
  501|       |
  502|   166k|    if (inflateStateCheck(strm) || strm->next_out == Z_NULL ||
  ------------------
  |  |  216|   333k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (502:9): [True: 0, False: 166k]
  |  Branch (502:36): [True: 0, False: 166k]
  ------------------
  503|   166k|        (strm->next_in == Z_NULL && strm->avail_in != 0))
  ------------------
  |  |  216|   333k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (503:10): [True: 0, False: 166k]
  |  Branch (503:37): [True: 0, False: 0]
  ------------------
  504|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
  505|       |
  506|   166k|    state = (struct inflate_state FAR *)strm->state;
  507|   166k|    if (state->mode == TYPE) state->mode = TYPEDO;      /* skip check */
  ------------------
  |  Branch (507:9): [True: 149, False: 166k]
  ------------------
  508|   166k|    LOAD();
  ------------------
  |  |  337|   166k|    do { \
  |  |  338|   166k|        put = strm->next_out; \
  |  |  339|   166k|        left = strm->avail_out; \
  |  |  340|   166k|        next = strm->next_in; \
  |  |  341|   166k|        have = strm->avail_in; \
  |  |  342|   166k|        hold = state->hold; \
  |  |  343|   166k|        bits = state->bits; \
  |  |  344|   166k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (344:14): [Folded, False: 166k]
  |  |  ------------------
  ------------------
  509|   166k|    in = have;
  510|   166k|    out = left;
  511|   166k|    ret = Z_OK;
  ------------------
  |  |  181|   166k|#define Z_OK            0
  ------------------
  512|   166k|    for (;;)
  513|   874k|        switch (state->mode) {
  514|  15.5k|        case HEAD:
  ------------------
  |  Branch (514:9): [True: 15.5k, False: 859k]
  ------------------
  515|  15.5k|            if (state->wrap == 0) {
  ------------------
  |  Branch (515:17): [True: 0, False: 15.5k]
  ------------------
  516|      0|                state->mode = TYPEDO;
  517|      0|                break;
  518|      0|            }
  519|  15.5k|            NEEDBITS(16);
  ------------------
  |  |  377|  15.5k|    do { \
  |  |  378|  46.4k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 30.9k, False: 15.4k]
  |  |  ------------------
  |  |  379|  30.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  30.9k|    do { \
  |  |  |  |  368|  30.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 99, False: 30.8k]
  |  |  |  |  ------------------
  |  |  |  |  369|  30.9k|        have--; \
  |  |  |  |  370|  30.8k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  30.8k|        bits += 8; \
  |  |  |  |  372|  30.8k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 30.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  15.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 15.4k]
  |  |  ------------------
  ------------------
  520|  15.4k|#ifdef GUNZIP
  521|  15.4k|            if ((state->wrap & 2) && hold == 0x8b1f) {  /* gzip header */
  ------------------
  |  Branch (521:17): [True: 0, False: 15.4k]
  |  Branch (521:38): [True: 0, False: 0]
  ------------------
  522|      0|                if (state->wbits == 0)
  ------------------
  |  Branch (522:21): [True: 0, False: 0]
  ------------------
  523|      0|                    state->wbits = 15;
  524|      0|                state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  525|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  526|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  527|      0|                state->mode = FLAGS;
  528|      0|                break;
  529|      0|            }
  530|  15.4k|            if (state->head != Z_NULL)
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (530:17): [True: 0, False: 15.4k]
  ------------------
  531|      0|                state->head->done = -1;
  532|  15.4k|            if (!(state->wrap & 1) ||   /* check if zlib header allowed */
  ------------------
  |  Branch (532:17): [True: 0, False: 15.4k]
  ------------------
  533|       |#else
  534|       |            if (
  535|       |#endif
  536|  15.4k|                ((BITS(8) << 8) + (hold >> 8)) % 31) {
  ------------------
  |  |  384|  15.4k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  |  Branch (536:17): [True: 2.21k, False: 13.2k]
  ------------------
  537|  2.21k|                strm->msg = (z_const char *)"incorrect header check";
  538|  2.21k|                state->mode = BAD;
  539|  2.21k|                break;
  540|  2.21k|            }
  541|  13.2k|            if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  384|  13.2k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
                          if (BITS(4) != Z_DEFLATED) {
  ------------------
  |  |  213|  13.2k|#define Z_DEFLATED   8
  ------------------
  |  Branch (541:17): [True: 114, False: 13.1k]
  ------------------
  542|    114|                strm->msg = (z_const char *)"unknown compression method";
  543|    114|                state->mode = BAD;
  544|    114|                break;
  545|    114|            }
  546|  13.1k|            DROPBITS(4);
  ------------------
  |  |  388|  13.1k|    do { \
  |  |  389|  13.1k|        hold >>= (n); \
  |  |  390|  13.1k|        bits -= (unsigned)(n); \
  |  |  391|  13.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 13.1k]
  |  |  ------------------
  ------------------
  547|  13.1k|            len = BITS(4) + 8;
  ------------------
  |  |  384|  13.1k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  548|  13.1k|            if (len > 15 || (state->wbits != 0 && len > state->wbits)) {
  ------------------
  |  Branch (548:17): [True: 37, False: 13.0k]
  |  Branch (548:30): [True: 13.0k, False: 0]
  |  Branch (548:51): [True: 0, False: 13.0k]
  ------------------
  549|     37|                strm->msg = (z_const char *)"invalid window size";
  550|     37|                state->mode = BAD;
  551|     37|                break;
  552|     37|            }
  553|  13.0k|            if (state->wbits == 0)
  ------------------
  |  Branch (553:17): [True: 0, False: 13.0k]
  ------------------
  554|      0|                state->wbits = len;
  555|  13.0k|            state->dmax = 1U << len;
  556|  13.0k|            state->flags = 0;               /* indicate zlib header */
  557|  13.0k|            Tracev((stderr, "inflate:   zlib header ok\n"));
  558|  13.0k|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|  13.0k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  559|  13.0k|            state->mode = hold & 0x200 ? DICTID : TYPE;
  ------------------
  |  Branch (559:27): [True: 60, False: 13.0k]
  ------------------
  560|  13.0k|            INITBITS();
  ------------------
  |  |  359|  13.0k|    do { \
  |  |  360|  13.0k|        hold = 0; \
  |  |  361|  13.0k|        bits = 0; \
  |  |  362|  13.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 13.0k]
  |  |  ------------------
  ------------------
  561|  13.0k|            break;
  562|      0|#ifdef GUNZIP
  563|      0|        case FLAGS:
  ------------------
  |  Branch (563:9): [True: 0, False: 874k]
  ------------------
  564|      0|            NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  565|      0|            state->flags = (int)(hold);
  566|      0|            if ((state->flags & 0xff) != Z_DEFLATED) {
  ------------------
  |  |  213|      0|#define Z_DEFLATED   8
  ------------------
  |  Branch (566:17): [True: 0, False: 0]
  ------------------
  567|      0|                strm->msg = (z_const char *)"unknown compression method";
  568|      0|                state->mode = BAD;
  569|      0|                break;
  570|      0|            }
  571|      0|            if (state->flags & 0xe000) {
  ------------------
  |  Branch (571:17): [True: 0, False: 0]
  ------------------
  572|      0|                strm->msg = (z_const char *)"unknown header flags set";
  573|      0|                state->mode = BAD;
  574|      0|                break;
  575|      0|            }
  576|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (576:17): [True: 0, False: 0]
  ------------------
  577|      0|                state->head->text = (int)((hold >> 8) & 1);
  578|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (578:17): [True: 0, False: 0]
  |  Branch (578:44): [True: 0, False: 0]
  ------------------
  579|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  580|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  581|      0|            state->mode = TIME;
  582|       |                /* fallthrough */
  583|      0|        case TIME:
  ------------------
  |  Branch (583:9): [True: 0, False: 874k]
  ------------------
  584|      0|            NEEDBITS(32);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  585|      0|            if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (585:17): [True: 0, False: 0]
  ------------------
  586|      0|                state->head->time = hold;
  587|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (587:17): [True: 0, False: 0]
  |  Branch (587:44): [True: 0, False: 0]
  ------------------
  588|      0|                CRC4(state->check, hold);
  ------------------
  |  |  326|      0|    do { \
  |  |  327|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  328|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  329|      0|        hbuf[2] = (unsigned char)((word) >> 16); \
  |  |  330|      0|        hbuf[3] = (unsigned char)((word) >> 24); \
  |  |  331|      0|        check = crc32(check, hbuf, 4); \
  |  |  332|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (332:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  589|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  590|      0|            state->mode = OS;
  591|       |                /* fallthrough */
  592|      0|        case OS:
  ------------------
  |  Branch (592:9): [True: 0, False: 874k]
  ------------------
  593|      0|            NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  594|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (594:17): [True: 0, False: 0]
  ------------------
  595|      0|                state->head->xflags = (int)(hold & 0xff);
  596|      0|                state->head->os = (int)(hold >> 8);
  597|      0|            }
  598|      0|            if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (598:17): [True: 0, False: 0]
  |  Branch (598:44): [True: 0, False: 0]
  ------------------
  599|      0|                CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  600|      0|            INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  601|      0|            state->mode = EXLEN;
  602|       |                /* fallthrough */
  603|      0|        case EXLEN:
  ------------------
  |  Branch (603:9): [True: 0, False: 874k]
  ------------------
  604|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (604:17): [True: 0, False: 0]
  ------------------
  605|      0|                NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  606|      0|                state->length = (unsigned)(hold);
  607|      0|                if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (607:21): [True: 0, False: 0]
  ------------------
  608|      0|                    state->head->extra_len = (unsigned)hold;
  609|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (609:21): [True: 0, False: 0]
  |  Branch (609:48): [True: 0, False: 0]
  ------------------
  610|      0|                    CRC2(state->check, hold);
  ------------------
  |  |  319|      0|    do { \
  |  |  320|      0|        hbuf[0] = (unsigned char)(word); \
  |  |  321|      0|        hbuf[1] = (unsigned char)((word) >> 8); \
  |  |  322|      0|        check = crc32(check, hbuf, 2); \
  |  |  323|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (323:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  611|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  612|      0|            }
  613|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (613:22): [True: 0, False: 0]
  ------------------
  614|      0|                state->head->extra = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  615|      0|            state->mode = EXTRA;
  616|       |                /* fallthrough */
  617|      0|        case EXTRA:
  ------------------
  |  Branch (617:9): [True: 0, False: 874k]
  ------------------
  618|      0|            if (state->flags & 0x0400) {
  ------------------
  |  Branch (618:17): [True: 0, False: 0]
  ------------------
  619|      0|                copy = state->length;
  620|      0|                if (copy > have) copy = have;
  ------------------
  |  Branch (620:21): [True: 0, False: 0]
  ------------------
  621|      0|                if (copy) {
  ------------------
  |  Branch (621:21): [True: 0, False: 0]
  ------------------
  622|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (622:25): [True: 0, False: 0]
  ------------------
  623|      0|                        state->head->extra != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (623:25): [True: 0, False: 0]
  ------------------
  624|      0|                        (len = state->head->extra_len - state->length) <
  ------------------
  |  Branch (624:25): [True: 0, False: 0]
  ------------------
  625|      0|                            state->head->extra_max) {
  626|      0|                        zmemcpy(state->head->extra + len, next,
  ------------------
  |  |  216|      0|#    define zmemcpy memcpy
  ------------------
  627|      0|                                len + copy > state->head->extra_max ?
  ------------------
  |  Branch (627:33): [True: 0, False: 0]
  ------------------
  628|      0|                                state->head->extra_max - len : copy);
  629|      0|                    }
  630|      0|                    if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (630:25): [True: 0, False: 0]
  |  Branch (630:52): [True: 0, False: 0]
  ------------------
  631|      0|                        state->check = crc32(state->check, next, copy);
  632|      0|                    have -= copy;
  633|      0|                    next += copy;
  634|      0|                    state->length -= copy;
  635|      0|                }
  636|      0|                if (state->length) goto inf_leave;
  ------------------
  |  Branch (636:21): [True: 0, False: 0]
  ------------------
  637|      0|            }
  638|      0|            state->length = 0;
  639|      0|            state->mode = NAME;
  640|       |                /* fallthrough */
  641|      0|        case NAME:
  ------------------
  |  Branch (641:9): [True: 0, False: 874k]
  ------------------
  642|      0|            if (state->flags & 0x0800) {
  ------------------
  |  Branch (642:17): [True: 0, False: 0]
  ------------------
  643|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (643:21): [True: 0, False: 0]
  ------------------
  644|      0|                copy = 0;
  645|      0|                do {
  646|      0|                    len = (unsigned)(next[copy++]);
  647|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (647:25): [True: 0, False: 0]
  ------------------
  648|      0|                            state->head->name != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (648:29): [True: 0, False: 0]
  ------------------
  649|      0|                            state->length < state->head->name_max)
  ------------------
  |  Branch (649:29): [True: 0, False: 0]
  ------------------
  650|      0|                        state->head->name[state->length++] = (Bytef)len;
  651|      0|                } while (len && copy < have);
  ------------------
  |  Branch (651:26): [True: 0, False: 0]
  |  Branch (651:33): [True: 0, False: 0]
  ------------------
  652|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (652:21): [True: 0, False: 0]
  |  Branch (652:48): [True: 0, False: 0]
  ------------------
  653|      0|                    state->check = crc32(state->check, next, copy);
  654|      0|                have -= copy;
  655|      0|                next += copy;
  656|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (656:21): [True: 0, False: 0]
  ------------------
  657|      0|            }
  658|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (658:22): [True: 0, False: 0]
  ------------------
  659|      0|                state->head->name = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  660|      0|            state->length = 0;
  661|      0|            state->mode = COMMENT;
  662|       |                /* fallthrough */
  663|      0|        case COMMENT:
  ------------------
  |  Branch (663:9): [True: 0, False: 874k]
  ------------------
  664|      0|            if (state->flags & 0x1000) {
  ------------------
  |  Branch (664:17): [True: 0, False: 0]
  ------------------
  665|      0|                if (have == 0) goto inf_leave;
  ------------------
  |  Branch (665:21): [True: 0, False: 0]
  ------------------
  666|      0|                copy = 0;
  667|      0|                do {
  668|      0|                    len = (unsigned)(next[copy++]);
  669|      0|                    if (state->head != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (669:25): [True: 0, False: 0]
  ------------------
  670|      0|                            state->head->comment != Z_NULL &&
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (670:29): [True: 0, False: 0]
  ------------------
  671|      0|                            state->length < state->head->comm_max)
  ------------------
  |  Branch (671:29): [True: 0, False: 0]
  ------------------
  672|      0|                        state->head->comment[state->length++] = (Bytef)len;
  673|      0|                } while (len && copy < have);
  ------------------
  |  Branch (673:26): [True: 0, False: 0]
  |  Branch (673:33): [True: 0, False: 0]
  ------------------
  674|      0|                if ((state->flags & 0x0200) && (state->wrap & 4))
  ------------------
  |  Branch (674:21): [True: 0, False: 0]
  |  Branch (674:48): [True: 0, False: 0]
  ------------------
  675|      0|                    state->check = crc32(state->check, next, copy);
  676|      0|                have -= copy;
  677|      0|                next += copy;
  678|      0|                if (len) goto inf_leave;
  ------------------
  |  Branch (678:21): [True: 0, False: 0]
  ------------------
  679|      0|            }
  680|      0|            else if (state->head != Z_NULL)
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (680:22): [True: 0, False: 0]
  ------------------
  681|      0|                state->head->comment = Z_NULL;
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  682|      0|            state->mode = HCRC;
  683|       |                /* fallthrough */
  684|      0|        case HCRC:
  ------------------
  |  Branch (684:9): [True: 0, False: 874k]
  ------------------
  685|      0|            if (state->flags & 0x0200) {
  ------------------
  |  Branch (685:17): [True: 0, False: 0]
  ------------------
  686|      0|                NEEDBITS(16);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  687|      0|                if ((state->wrap & 4) && hold != (state->check & 0xffff)) {
  ------------------
  |  Branch (687:21): [True: 0, False: 0]
  |  Branch (687:42): [True: 0, False: 0]
  ------------------
  688|      0|                    strm->msg = (z_const char *)"header crc mismatch";
  689|      0|                    state->mode = BAD;
  690|      0|                    break;
  691|      0|                }
  692|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  693|      0|            }
  694|      0|            if (state->head != Z_NULL) {
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (694:17): [True: 0, False: 0]
  ------------------
  695|      0|                state->head->hcrc = (int)((state->flags >> 9) & 1);
  696|      0|                state->head->done = 1;
  697|      0|            }
  698|      0|            strm->adler = state->check = crc32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  699|      0|            state->mode = TYPE;
  700|      0|            break;
  701|      0|#endif
  702|     68|        case DICTID:
  ------------------
  |  Branch (702:9): [True: 68, False: 874k]
  ------------------
  703|     68|            NEEDBITS(32);
  ------------------
  |  |  377|     68|    do { \
  |  |  378|    295|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 242, False: 53]
  |  |  ------------------
  |  |  379|    242|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|    242|    do { \
  |  |  |  |  368|    242|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 15, False: 227]
  |  |  |  |  ------------------
  |  |  |  |  369|    242|        have--; \
  |  |  |  |  370|    227|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|    227|        bits += 8; \
  |  |  |  |  372|    227|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 227]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|     68|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 53]
  |  |  ------------------
  ------------------
  704|     53|            strm->adler = state->check = ZSWAP32(hold);
  ------------------
  |  |  258|     53|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|     53|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
  705|     53|            INITBITS();
  ------------------
  |  |  359|     53|    do { \
  |  |  360|     53|        hold = 0; \
  |  |  361|     53|        bits = 0; \
  |  |  362|     53|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 53]
  |  |  ------------------
  ------------------
  706|     53|            state->mode = DICT;
  707|       |                /* fallthrough */
  708|    105|        case DICT:
  ------------------
  |  Branch (708:9): [True: 52, False: 874k]
  ------------------
  709|    105|            if (state->havedict == 0) {
  ------------------
  |  Branch (709:17): [True: 105, False: 0]
  ------------------
  710|    105|                RESTORE();
  ------------------
  |  |  348|    105|    do { \
  |  |  349|    105|        strm->next_out = put; \
  |  |  350|    105|        strm->avail_out = left; \
  |  |  351|    105|        strm->next_in = next; \
  |  |  352|    105|        strm->avail_in = have; \
  |  |  353|    105|        state->hold = hold; \
  |  |  354|    105|        state->bits = bits; \
  |  |  355|    105|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 105]
  |  |  ------------------
  ------------------
  711|    105|                strm->total_in += in - strm->avail_in;
  712|    105|                return Z_NEED_DICT;
  ------------------
  |  |  183|    105|#define Z_NEED_DICT     2
  ------------------
  713|    105|            }
  714|      0|            strm->adler = state->check = adler32(0L, Z_NULL, 0);
  ------------------
  |  |  216|      0|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  715|      0|            state->mode = TYPE;
  716|       |                /* fallthrough */
  717|  30.5k|        case TYPE:
  ------------------
  |  Branch (717:9): [True: 30.5k, False: 844k]
  ------------------
  718|  30.5k|            if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  177|  61.0k|#define Z_BLOCK         5
  ------------------
                          if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  30.5k|#define Z_TREES         6
  ------------------
  |  Branch (718:17): [True: 0, False: 30.5k]
  |  Branch (718:37): [True: 0, False: 30.5k]
  ------------------
  719|       |                /* fallthrough */
  720|  30.6k|        case TYPEDO:
  ------------------
  |  Branch (720:9): [True: 149, False: 874k]
  ------------------
  721|  30.6k|            if (state->last) {
  ------------------
  |  Branch (721:17): [True: 7.56k, False: 23.1k]
  ------------------
  722|  7.56k|                BYTEBITS();
  ------------------
  |  |  395|  7.56k|    do { \
  |  |  396|  7.56k|        hold >>= bits & 7; \
  |  |  397|  7.56k|        bits -= bits & 7; \
  |  |  398|  7.56k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (398:14): [Folded, False: 7.56k]
  |  |  ------------------
  ------------------
  723|  7.56k|                state->mode = CHECK;
  724|  7.56k|                break;
  725|  7.56k|            }
  726|  23.1k|            NEEDBITS(3);
  ------------------
  |  |  377|  23.1k|    do { \
  |  |  378|  41.0k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 18.1k, False: 22.9k]
  |  |  ------------------
  |  |  379|  23.1k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  18.1k|    do { \
  |  |  |  |  368|  18.1k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 182, False: 17.9k]
  |  |  |  |  ------------------
  |  |  |  |  369|  18.1k|        have--; \
  |  |  |  |  370|  17.9k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  17.9k|        bits += 8; \
  |  |  |  |  372|  17.9k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 17.9k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  23.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 22.9k]
  |  |  ------------------
  ------------------
  727|  22.9k|            state->last = BITS(1);
  ------------------
  |  |  384|  22.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  728|  22.9k|            DROPBITS(1);
  ------------------
  |  |  388|  22.9k|    do { \
  |  |  389|  22.9k|        hold >>= (n); \
  |  |  390|  22.9k|        bits -= (unsigned)(n); \
  |  |  391|  22.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 22.9k]
  |  |  ------------------
  ------------------
  729|  22.9k|            switch (BITS(2)) {
  ------------------
  |  |  384|  22.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  730|  2.47k|            case 0:                             /* stored block */
  ------------------
  |  Branch (730:13): [True: 2.47k, False: 20.4k]
  ------------------
  731|  2.47k|                Tracev((stderr, "inflate:     stored block%s\n",
  732|  2.47k|                        state->last ? " (last)" : ""));
  733|  2.47k|                state->mode = STORED;
  734|  2.47k|                break;
  735|  9.84k|            case 1:                             /* fixed block */
  ------------------
  |  Branch (735:13): [True: 9.84k, False: 13.0k]
  ------------------
  736|  9.84k|                inflate_fixed(state);
  737|  9.84k|                Tracev((stderr, "inflate:     fixed codes block%s\n",
  738|  9.84k|                        state->last ? " (last)" : ""));
  739|  9.84k|                state->mode = LEN_;             /* decode codes */
  740|  9.84k|                if (flush == Z_TREES) {
  ------------------
  |  |  178|  9.84k|#define Z_TREES         6
  ------------------
  |  Branch (740:21): [True: 0, False: 9.84k]
  ------------------
  741|      0|                    DROPBITS(2);
  ------------------
  |  |  388|      0|    do { \
  |  |  389|      0|        hold >>= (n); \
  |  |  390|      0|        bits -= (unsigned)(n); \
  |  |  391|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
  742|      0|                    goto inf_leave;
  743|      0|                }
  744|  9.84k|                break;
  745|  10.5k|            case 2:                             /* dynamic block */
  ------------------
  |  Branch (745:13): [True: 10.5k, False: 12.3k]
  ------------------
  746|  10.5k|                Tracev((stderr, "inflate:     dynamic codes block%s\n",
  747|  10.5k|                        state->last ? " (last)" : ""));
  748|  10.5k|                state->mode = TABLE;
  749|  10.5k|                break;
  750|     76|            default:
  ------------------
  |  Branch (750:13): [True: 76, False: 22.8k]
  ------------------
  751|     76|                strm->msg = (z_const char *)"invalid block type";
  752|     76|                state->mode = BAD;
  753|  22.9k|            }
  754|  22.9k|            DROPBITS(2);
  ------------------
  |  |  388|  22.9k|    do { \
  |  |  389|  22.9k|        hold >>= (n); \
  |  |  390|  22.9k|        bits -= (unsigned)(n); \
  |  |  391|  22.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 22.9k]
  |  |  ------------------
  ------------------
  755|  22.9k|            break;
  756|  2.54k|        case STORED:
  ------------------
  |  Branch (756:9): [True: 2.54k, False: 872k]
  ------------------
  757|  2.54k|            BYTEBITS();                         /* go to byte boundary */
  ------------------
  |  |  395|  2.54k|    do { \
  |  |  396|  2.54k|        hold >>= bits & 7; \
  |  |  397|  2.54k|        bits -= bits & 7; \
  |  |  398|  2.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (398:14): [Folded, False: 2.54k]
  |  |  ------------------
  ------------------
  758|  2.54k|            NEEDBITS(32);
  ------------------
  |  |  377|  2.54k|    do { \
  |  |  378|  12.3k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 9.90k, False: 2.42k]
  |  |  ------------------
  |  |  379|  9.90k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  9.90k|    do { \
  |  |  |  |  368|  9.90k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 119, False: 9.78k]
  |  |  |  |  ------------------
  |  |  |  |  369|  9.90k|        have--; \
  |  |  |  |  370|  9.78k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  9.78k|        bits += 8; \
  |  |  |  |  372|  9.78k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 9.78k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  2.54k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 2.42k]
  |  |  ------------------
  ------------------
  759|  2.42k|            if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
  ------------------
  |  Branch (759:17): [True: 123, False: 2.30k]
  ------------------
  760|    123|                strm->msg = (z_const char *)"invalid stored block lengths";
  761|    123|                state->mode = BAD;
  762|    123|                break;
  763|    123|            }
  764|  2.30k|            state->length = (unsigned)hold & 0xffff;
  765|  2.30k|            Tracev((stderr, "inflate:       stored length %u\n",
  766|  2.30k|                    state->length));
  767|  2.30k|            INITBITS();
  ------------------
  |  |  359|  2.30k|    do { \
  |  |  360|  2.30k|        hold = 0; \
  |  |  361|  2.30k|        bits = 0; \
  |  |  362|  2.30k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 2.30k]
  |  |  ------------------
  ------------------
  768|  2.30k|            state->mode = COPY_;
  769|  2.30k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  2.30k|#define Z_TREES         6
  ------------------
  |  Branch (769:17): [True: 0, False: 2.30k]
  ------------------
  770|       |                /* fallthrough */
  771|  2.30k|        case COPY_:
  ------------------
  |  Branch (771:9): [True: 0, False: 874k]
  ------------------
  772|  2.30k|            state->mode = COPY;
  773|       |                /* fallthrough */
  774|  2.94k|        case COPY:
  ------------------
  |  Branch (774:9): [True: 647, False: 874k]
  ------------------
  775|  2.94k|            copy = state->length;
  776|  2.94k|            if (copy) {
  ------------------
  |  Branch (776:17): [True: 719, False: 2.23k]
  ------------------
  777|    719|                if (copy > have) copy = have;
  ------------------
  |  Branch (777:21): [True: 265, False: 454]
  ------------------
  778|    719|                if (copy > left) copy = left;
  ------------------
  |  Branch (778:21): [True: 107, False: 612]
  ------------------
  779|    719|                if (copy == 0) goto inf_leave;
  ------------------
  |  Branch (779:21): [True: 198, False: 521]
  ------------------
  780|    521|                zmemcpy(put, next, copy);
  ------------------
  |  |  216|    521|#    define zmemcpy memcpy
  ------------------
  781|    521|                have -= copy;
  782|    521|                next += copy;
  783|    521|                left -= copy;
  784|    521|                put += copy;
  785|    521|                state->length -= copy;
  786|    521|                break;
  787|    719|            }
  788|  2.23k|            Tracev((stderr, "inflate:       stored end\n"));
  789|  2.23k|            state->mode = TYPE;
  790|  2.23k|            break;
  791|  11.2k|        case TABLE:
  ------------------
  |  Branch (791:9): [True: 11.2k, False: 863k]
  ------------------
  792|  11.2k|            NEEDBITS(14);
  ------------------
  |  |  377|  11.2k|    do { \
  |  |  378|  31.8k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 21.2k, False: 10.5k]
  |  |  ------------------
  |  |  379|  21.2k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  21.2k|    do { \
  |  |  |  |  368|  21.2k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 751, False: 20.5k]
  |  |  |  |  ------------------
  |  |  |  |  369|  21.2k|        have--; \
  |  |  |  |  370|  20.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  20.5k|        bits += 8; \
  |  |  |  |  372|  20.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 20.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  11.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  793|  10.5k|            state->nlen = BITS(5) + 257;
  ------------------
  |  |  384|  10.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  794|  10.5k|            DROPBITS(5);
  ------------------
  |  |  388|  10.5k|    do { \
  |  |  389|  10.5k|        hold >>= (n); \
  |  |  390|  10.5k|        bits -= (unsigned)(n); \
  |  |  391|  10.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  795|  10.5k|            state->ndist = BITS(5) + 1;
  ------------------
  |  |  384|  10.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  796|  10.5k|            DROPBITS(5);
  ------------------
  |  |  388|  10.5k|    do { \
  |  |  389|  10.5k|        hold >>= (n); \
  |  |  390|  10.5k|        bits -= (unsigned)(n); \
  |  |  391|  10.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  797|  10.5k|            state->ncode = BITS(4) + 4;
  ------------------
  |  |  384|  10.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  798|  10.5k|            DROPBITS(4);
  ------------------
  |  |  388|  10.5k|    do { \
  |  |  389|  10.5k|        hold >>= (n); \
  |  |  390|  10.5k|        bits -= (unsigned)(n); \
  |  |  391|  10.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 10.5k]
  |  |  ------------------
  ------------------
  799|  10.5k|#ifndef PKZIP_BUG_WORKAROUND
  800|  10.5k|            if (state->nlen > 286 || state->ndist > 30) {
  ------------------
  |  Branch (800:17): [True: 3, False: 10.5k]
  |  Branch (800:38): [True: 11, False: 10.5k]
  ------------------
  801|     14|                strm->msg = (z_const char *)
  802|     14|                    "too many length or distance symbols";
  803|     14|                state->mode = BAD;
  804|     14|                break;
  805|     14|            }
  806|  10.5k|#endif
  807|  10.5k|            Tracev((stderr, "inflate:       table sizes ok\n"));
  808|  10.5k|            state->have = 0;
  809|  10.5k|            state->mode = LENLENS;
  810|       |                /* fallthrough */
  811|  11.3k|        case LENLENS:
  ------------------
  |  Branch (811:9): [True: 826, False: 874k]
  ------------------
  812|   185k|            while (state->have < state->ncode) {
  ------------------
  |  Branch (812:20): [True: 174k, False: 10.4k]
  ------------------
  813|   174k|                NEEDBITS(3);
  ------------------
  |  |  377|   174k|    do { \
  |  |  378|   235k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 61.9k, False: 173k]
  |  |  ------------------
  |  |  379|   174k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  61.9k|    do { \
  |  |  |  |  368|  61.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 891, False: 61.0k]
  |  |  |  |  ------------------
  |  |  |  |  369|  61.9k|        have--; \
  |  |  |  |  370|  61.0k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  61.0k|        bits += 8; \
  |  |  |  |  372|  61.0k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 61.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|   174k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 173k]
  |  |  ------------------
  ------------------
  814|   173k|                state->lens[order[state->have++]] = (unsigned short)BITS(3);
  ------------------
  |  |  384|   173k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  815|   173k|                DROPBITS(3);
  ------------------
  |  |  388|   173k|    do { \
  |  |  389|   173k|        hold >>= (n); \
  |  |  390|   173k|        bits -= (unsigned)(n); \
  |  |  391|   173k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 173k]
  |  |  ------------------
  ------------------
  816|   173k|            }
  817|  35.4k|            while (state->have < 19)
  ------------------
  |  Branch (817:20): [True: 25.0k, False: 10.4k]
  ------------------
  818|  25.0k|                state->lens[order[state->have++]] = 0;
  819|  10.4k|            state->next = state->codes;
  820|  10.4k|            state->lencode = state->distcode = (const code FAR *)(state->next);
  821|  10.4k|            state->lenbits = 7;
  822|  10.4k|            ret = inflate_table(CODES, state->lens, 19, &(state->next),
  823|  10.4k|                                &(state->lenbits), state->work);
  824|  10.4k|            if (ret) {
  ------------------
  |  Branch (824:17): [True: 297, False: 10.1k]
  ------------------
  825|    297|                strm->msg = (z_const char *)"invalid code lengths set";
  826|    297|                state->mode = BAD;
  827|    297|                break;
  828|    297|            }
  829|  10.1k|            Tracev((stderr, "inflate:       code lengths ok\n"));
  830|  10.1k|            state->have = 0;
  831|  10.1k|            state->mode = CODELENS;
  832|       |                /* fallthrough */
  833|  15.5k|        case CODELENS:
  ------------------
  |  Branch (833:9): [True: 5.37k, False: 869k]
  ------------------
  834|  1.04M|            while (state->have < state->nlen + state->ndist) {
  ------------------
  |  Branch (834:20): [True: 1.03M, False: 9.79k]
  ------------------
  835|  1.41M|                for (;;) {
  836|  1.41M|                    here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  384|  1.41M|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  837|  1.41M|                    if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (837:25): [True: 1.03M, False: 377k]
  ------------------
  838|   377k|                    PULLBYTE();
  ------------------
  |  |  367|   377k|    do { \
  |  |  368|   377k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 4.02k, False: 373k]
  |  |  ------------------
  |  |  369|   377k|        have--; \
  |  |  370|   373k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|   373k|        bits += 8; \
  |  |  372|   373k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 373k]
  |  |  ------------------
  ------------------
  839|   377k|                }
  840|  1.03M|                if (here.val < 16) {
  ------------------
  |  Branch (840:21): [True: 919k, False: 114k]
  ------------------
  841|   919k|                    DROPBITS(here.bits);
  ------------------
  |  |  388|   919k|    do { \
  |  |  389|   919k|        hold >>= (n); \
  |  |  390|   919k|        bits -= (unsigned)(n); \
  |  |  391|   919k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 919k]
  |  |  ------------------
  ------------------
  842|   919k|                    state->lens[state->have++] = here.val;
  843|   919k|                }
  844|   114k|                else {
  845|   114k|                    if (here.val == 16) {
  ------------------
  |  Branch (845:25): [True: 46.9k, False: 67.1k]
  ------------------
  846|  46.9k|                        NEEDBITS(here.bits + 2);
  ------------------
  |  |  377|  46.9k|    do { \
  |  |  378|  59.1k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 12.4k, False: 46.7k]
  |  |  ------------------
  |  |  379|  46.9k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  12.4k|    do { \
  |  |  |  |  368|  12.4k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 245, False: 12.1k]
  |  |  |  |  ------------------
  |  |  |  |  369|  12.4k|        have--; \
  |  |  |  |  370|  12.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  12.1k|        bits += 8; \
  |  |  |  |  372|  12.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 12.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  46.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 46.7k]
  |  |  ------------------
  ------------------
  847|  46.7k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  46.7k|    do { \
  |  |  389|  46.7k|        hold >>= (n); \
  |  |  390|  46.7k|        bits -= (unsigned)(n); \
  |  |  391|  46.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 46.7k]
  |  |  ------------------
  ------------------
  848|  46.7k|                        if (state->have == 0) {
  ------------------
  |  Branch (848:29): [True: 5, False: 46.7k]
  ------------------
  849|      5|                            strm->msg = (z_const char *)
  850|      5|                                "invalid bit length repeat";
  851|      5|                            state->mode = BAD;
  852|      5|                            break;
  853|      5|                        }
  854|  46.7k|                        len = state->lens[state->have - 1];
  855|  46.7k|                        copy = 3 + BITS(2);
  ------------------
  |  |  384|  46.7k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  856|  46.7k|                        DROPBITS(2);
  ------------------
  |  |  388|  46.7k|    do { \
  |  |  389|  46.7k|        hold >>= (n); \
  |  |  390|  46.7k|        bits -= (unsigned)(n); \
  |  |  391|  46.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 46.7k]
  |  |  ------------------
  ------------------
  857|  46.7k|                    }
  858|  67.1k|                    else if (here.val == 17) {
  ------------------
  |  Branch (858:30): [True: 37.0k, False: 30.0k]
  ------------------
  859|  37.0k|                        NEEDBITS(here.bits + 3);
  ------------------
  |  |  377|  37.0k|    do { \
  |  |  378|  48.5k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 11.6k, False: 36.9k]
  |  |  ------------------
  |  |  379|  37.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  11.6k|    do { \
  |  |  |  |  368|  11.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 51, False: 11.5k]
  |  |  |  |  ------------------
  |  |  |  |  369|  11.6k|        have--; \
  |  |  |  |  370|  11.5k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  11.5k|        bits += 8; \
  |  |  |  |  372|  11.5k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 11.5k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  37.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 36.9k]
  |  |  ------------------
  ------------------
  860|  36.9k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  36.9k|    do { \
  |  |  389|  36.9k|        hold >>= (n); \
  |  |  390|  36.9k|        bits -= (unsigned)(n); \
  |  |  391|  36.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 36.9k]
  |  |  ------------------
  ------------------
  861|  36.9k|                        len = 0;
  862|  36.9k|                        copy = 3 + BITS(3);
  ------------------
  |  |  384|  36.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  863|  36.9k|                        DROPBITS(3);
  ------------------
  |  |  388|  36.9k|    do { \
  |  |  389|  36.9k|        hold >>= (n); \
  |  |  390|  36.9k|        bits -= (unsigned)(n); \
  |  |  391|  36.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 36.9k]
  |  |  ------------------
  ------------------
  864|  36.9k|                    }
  865|  30.0k|                    else {
  866|  30.0k|                        NEEDBITS(here.bits + 7);
  ------------------
  |  |  377|  30.0k|    do { \
  |  |  378|  55.8k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 26.9k, False: 28.9k]
  |  |  ------------------
  |  |  379|  30.0k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  26.9k|    do { \
  |  |  |  |  368|  26.9k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 1.17k, False: 25.7k]
  |  |  |  |  ------------------
  |  |  |  |  369|  26.9k|        have--; \
  |  |  |  |  370|  25.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  25.7k|        bits += 8; \
  |  |  |  |  372|  25.7k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 25.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  30.0k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  867|  28.9k|                        DROPBITS(here.bits);
  ------------------
  |  |  388|  28.9k|    do { \
  |  |  389|  28.9k|        hold >>= (n); \
  |  |  390|  28.9k|        bits -= (unsigned)(n); \
  |  |  391|  28.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  868|  28.9k|                        len = 0;
  869|  28.9k|                        copy = 11 + BITS(7);
  ------------------
  |  |  384|  28.9k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  870|  28.9k|                        DROPBITS(7);
  ------------------
  |  |  388|  28.9k|    do { \
  |  |  389|  28.9k|        hold >>= (n); \
  |  |  390|  28.9k|        bits -= (unsigned)(n); \
  |  |  391|  28.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 28.9k]
  |  |  ------------------
  ------------------
  871|  28.9k|                    }
  872|   112k|                    if (state->have + copy > state->nlen + state->ndist) {
  ------------------
  |  Branch (872:25): [True: 215, False: 112k]
  ------------------
  873|    215|                        strm->msg = (z_const char *)
  874|    215|                            "invalid bit length repeat";
  875|    215|                        state->mode = BAD;
  876|    215|                        break;
  877|    215|                    }
  878|  2.20M|                    while (copy--)
  ------------------
  |  Branch (878:28): [True: 2.09M, False: 112k]
  ------------------
  879|  2.09M|                        state->lens[state->have++] = (unsigned short)len;
  880|   112k|                }
  881|  1.03M|            }
  882|       |
  883|       |            /* handle error breaks in while */
  884|  10.0k|            if (state->mode == BAD) break;
  ------------------
  |  Branch (884:17): [True: 220, False: 9.79k]
  ------------------
  885|       |
  886|       |            /* check for end-of-block code (better have one) */
  887|  9.79k|            if (state->lens[256] == 0) {
  ------------------
  |  Branch (887:17): [True: 50, False: 9.74k]
  ------------------
  888|     50|                strm->msg = (z_const char *)
  889|     50|                    "invalid code -- missing end-of-block";
  890|     50|                state->mode = BAD;
  891|     50|                break;
  892|     50|            }
  893|       |
  894|       |            /* build code tables -- note: do not change the lenbits or distbits
  895|       |               values here (9 and 6) without reading the comments in inftrees.h
  896|       |               concerning the ENOUGH constants, which depend on those values */
  897|  9.74k|            state->next = state->codes;
  898|  9.74k|            state->lencode = (const code FAR *)(state->next);
  899|  9.74k|            state->lenbits = 9;
  900|  9.74k|            ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
  901|  9.74k|                                &(state->lenbits), state->work);
  902|  9.74k|            if (ret) {
  ------------------
  |  Branch (902:17): [True: 144, False: 9.59k]
  ------------------
  903|    144|                strm->msg = (z_const char *)"invalid literal/lengths set";
  904|    144|                state->mode = BAD;
  905|    144|                break;
  906|    144|            }
  907|  9.59k|            state->distcode = (const code FAR *)(state->next);
  908|  9.59k|            state->distbits = 6;
  909|  9.59k|            ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
  910|  9.59k|                            &(state->next), &(state->distbits), state->work);
  911|  9.59k|            if (ret) {
  ------------------
  |  Branch (911:17): [True: 53, False: 9.54k]
  ------------------
  912|     53|                strm->msg = (z_const char *)"invalid distances set";
  913|     53|                state->mode = BAD;
  914|     53|                break;
  915|     53|            }
  916|  9.54k|            Tracev((stderr, "inflate:       codes ok\n"));
  917|  9.54k|            state->mode = LEN_;
  918|  9.54k|            if (flush == Z_TREES) goto inf_leave;
  ------------------
  |  |  178|  9.54k|#define Z_TREES         6
  ------------------
  |  Branch (918:17): [True: 0, False: 9.54k]
  ------------------
  919|       |                /* fallthrough */
  920|  19.3k|        case LEN_:
  ------------------
  |  Branch (920:9): [True: 9.84k, False: 865k]
  ------------------
  921|  19.3k|            state->mode = LEN;
  922|       |                /* fallthrough */
  923|   520k|        case LEN:
  ------------------
  |  Branch (923:9): [True: 501k, False: 373k]
  ------------------
  924|   520k|            if (have >= 6 && left >= 258 && bits < 8) {
  ------------------
  |  Branch (924:17): [True: 70.8k, False: 450k]
  |  Branch (924:30): [True: 56.4k, False: 14.4k]
  |  Branch (924:45): [True: 56.1k, False: 343]
  ------------------
  925|  56.1k|                RESTORE();
  ------------------
  |  |  348|  56.1k|    do { \
  |  |  349|  56.1k|        strm->next_out = put; \
  |  |  350|  56.1k|        strm->avail_out = left; \
  |  |  351|  56.1k|        strm->next_in = next; \
  |  |  352|  56.1k|        strm->avail_in = have; \
  |  |  353|  56.1k|        state->hold = hold; \
  |  |  354|  56.1k|        state->bits = bits; \
  |  |  355|  56.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 56.1k]
  |  |  ------------------
  ------------------
  926|  56.1k|                inflate_fast(strm, out);
  927|  56.1k|                LOAD();
  ------------------
  |  |  337|  56.1k|    do { \
  |  |  338|  56.1k|        put = strm->next_out; \
  |  |  339|  56.1k|        left = strm->avail_out; \
  |  |  340|  56.1k|        next = strm->next_in; \
  |  |  341|  56.1k|        have = strm->avail_in; \
  |  |  342|  56.1k|        hold = state->hold; \
  |  |  343|  56.1k|        bits = state->bits; \
  |  |  344|  56.1k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (344:14): [Folded, False: 56.1k]
  |  |  ------------------
  ------------------
  928|  56.1k|                if (state->mode == TYPE)
  ------------------
  |  Branch (928:21): [True: 8.99k, False: 47.1k]
  ------------------
  929|  8.99k|                    state->back = -1;
  930|  56.1k|                break;
  931|  56.1k|            }
  932|   464k|            state->back = 0;
  933|   753k|            for (;;) {
  934|   753k|                here = state->lencode[BITS(state->lenbits)];
  ------------------
  |  |  384|   753k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  935|   753k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (935:21): [True: 375k, False: 377k]
  ------------------
  936|   377k|                PULLBYTE();
  ------------------
  |  |  367|   377k|    do { \
  |  |  368|   377k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 89.2k, False: 288k]
  |  |  ------------------
  |  |  369|   377k|        have--; \
  |  |  370|   288k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|   288k|        bits += 8; \
  |  |  372|   288k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 288k]
  |  |  ------------------
  ------------------
  937|   377k|            }
  938|   375k|            if (here.op && (here.op & 0xf0) == 0) {
  ------------------
  |  Branch (938:17): [True: 190k, False: 185k]
  |  Branch (938:28): [True: 35.1k, False: 155k]
  ------------------
  939|  35.1k|                last = here;
  940|  38.3k|                for (;;) {
  941|  38.3k|                    here = state->lencode[last.val +
  942|  38.3k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  384|  38.3k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  943|  38.3k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (943:25): [True: 34.2k, False: 4.13k]
  ------------------
  944|  4.13k|                    PULLBYTE();
  ------------------
  |  |  367|  4.13k|    do { \
  |  |  368|  4.13k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 892, False: 3.24k]
  |  |  ------------------
  |  |  369|  4.13k|        have--; \
  |  |  370|  3.24k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  3.24k|        bits += 8; \
  |  |  372|  3.24k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 3.24k]
  |  |  ------------------
  ------------------
  945|  4.13k|                }
  946|  34.2k|                DROPBITS(last.bits);
  ------------------
  |  |  388|  34.2k|    do { \
  |  |  389|  34.2k|        hold >>= (n); \
  |  |  390|  34.2k|        bits -= (unsigned)(n); \
  |  |  391|  34.2k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 34.2k]
  |  |  ------------------
  ------------------
  947|  34.2k|                state->back += last.bits;
  948|  34.2k|            }
  949|   374k|            DROPBITS(here.bits);
  ------------------
  |  |  388|   374k|    do { \
  |  |  389|   374k|        hold >>= (n); \
  |  |  390|   374k|        bits -= (unsigned)(n); \
  |  |  391|   374k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 374k]
  |  |  ------------------
  ------------------
  950|   374k|            state->back += here.bits;
  951|   374k|            state->length = (unsigned)here.val;
  952|   374k|            if ((int)(here.op) == 0) {
  ------------------
  |  Branch (952:17): [True: 217k, False: 157k]
  ------------------
  953|   217k|                Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
  954|   217k|                        "inflate:         literal '%c'\n" :
  955|   217k|                        "inflate:         literal 0x%02x\n", here.val));
  956|   217k|                state->mode = LIT;
  957|   217k|                break;
  958|   217k|            }
  959|   157k|            if (here.op & 32) {
  ------------------
  |  Branch (959:17): [True: 6.29k, False: 150k]
  ------------------
  960|  6.29k|                Tracevv((stderr, "inflate:         end of block\n"));
  961|  6.29k|                state->back = -1;
  962|  6.29k|                state->mode = TYPE;
  963|  6.29k|                break;
  964|  6.29k|            }
  965|   150k|            if (here.op & 64) {
  ------------------
  |  Branch (965:17): [True: 13, False: 150k]
  ------------------
  966|     13|                strm->msg = (z_const char *)"invalid literal/length code";
  967|     13|                state->mode = BAD;
  968|     13|                break;
  969|     13|            }
  970|   150k|            state->extra = (unsigned)(here.op) & 15;
  971|   150k|            state->mode = LENEXT;
  972|       |                /* fallthrough */
  973|   152k|        case LENEXT:
  ------------------
  |  Branch (973:9): [True: 1.17k, False: 873k]
  ------------------
  974|   152k|            if (state->extra) {
  ------------------
  |  Branch (974:17): [True: 32.8k, False: 119k]
  ------------------
  975|  32.8k|                NEEDBITS(state->extra);
  ------------------
  |  |  377|  32.8k|    do { \
  |  |  378|  40.7k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 9.19k, False: 31.5k]
  |  |  ------------------
  |  |  379|  32.8k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  9.19k|    do { \
  |  |  |  |  368|  9.19k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 1.26k, False: 7.92k]
  |  |  |  |  ------------------
  |  |  |  |  369|  9.19k|        have--; \
  |  |  |  |  370|  7.92k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  7.92k|        bits += 8; \
  |  |  |  |  372|  7.92k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 7.92k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  32.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 31.5k]
  |  |  ------------------
  ------------------
  976|  31.5k|                state->length += BITS(state->extra);
  ------------------
  |  |  384|  31.5k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  977|  31.5k|                DROPBITS(state->extra);
  ------------------
  |  |  388|  31.5k|    do { \
  |  |  389|  31.5k|        hold >>= (n); \
  |  |  390|  31.5k|        bits -= (unsigned)(n); \
  |  |  391|  31.5k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 31.5k]
  |  |  ------------------
  ------------------
  978|  31.5k|                state->back += state->extra;
  979|  31.5k|            }
  980|   150k|            Tracevv((stderr, "inflate:         length %u\n", state->length));
  981|   150k|            state->was = state->length;
  982|   150k|            state->mode = DIST;
  983|       |                /* fallthrough */
  984|   167k|        case DIST:
  ------------------
  |  Branch (984:9): [True: 16.4k, False: 858k]
  ------------------
  985|   226k|            for (;;) {
  986|   226k|                here = state->distcode[BITS(state->distbits)];
  ------------------
  |  |  384|   226k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  987|   226k|                if ((unsigned)(here.bits) <= bits) break;
  ------------------
  |  Branch (987:21): [True: 150k, False: 75.4k]
  ------------------
  988|  75.4k|                PULLBYTE();
  ------------------
  |  |  367|  75.4k|    do { \
  |  |  368|  75.4k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 16.7k, False: 58.7k]
  |  |  ------------------
  |  |  369|  75.4k|        have--; \
  |  |  370|  58.7k|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|  58.7k|        bits += 8; \
  |  |  372|  58.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 58.7k]
  |  |  ------------------
  ------------------
  989|  75.4k|            }
  990|   150k|            if ((here.op & 0xf0) == 0) {
  ------------------
  |  Branch (990:17): [True: 3.38k, False: 147k]
  ------------------
  991|  3.38k|                last = here;
  992|  4.17k|                for (;;) {
  993|  4.17k|                    here = state->distcode[last.val +
  994|  4.17k|                            (BITS(last.bits + last.op) >> last.bits)];
  ------------------
  |  |  384|  4.17k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
  995|  4.17k|                    if ((unsigned)(last.bits + here.bits) <= bits) break;
  ------------------
  |  Branch (995:25): [True: 3.13k, False: 1.04k]
  ------------------
  996|  1.04k|                    PULLBYTE();
  ------------------
  |  |  367|  1.04k|    do { \
  |  |  368|  1.04k|        if (have == 0) goto inf_leave; \
  |  |  ------------------
  |  |  |  Branch (368:13): [True: 252, False: 788]
  |  |  ------------------
  |  |  369|  1.04k|        have--; \
  |  |  370|    788|        hold += (unsigned long)(*next++) << bits; \
  |  |  371|    788|        bits += 8; \
  |  |  372|    788|    } while (0)
  |  |  ------------------
  |  |  |  Branch (372:14): [Folded, False: 788]
  |  |  ------------------
  ------------------
  997|  1.04k|                }
  998|  3.13k|                DROPBITS(last.bits);
  ------------------
  |  |  388|  3.13k|    do { \
  |  |  389|  3.13k|        hold >>= (n); \
  |  |  390|  3.13k|        bits -= (unsigned)(n); \
  |  |  391|  3.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 3.13k]
  |  |  ------------------
  ------------------
  999|  3.13k|                state->back += last.bits;
 1000|  3.13k|            }
 1001|   150k|            DROPBITS(here.bits);
  ------------------
  |  |  388|   150k|    do { \
  |  |  389|   150k|        hold >>= (n); \
  |  |  390|   150k|        bits -= (unsigned)(n); \
  |  |  391|   150k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 150k]
  |  |  ------------------
  ------------------
 1002|   150k|            state->back += here.bits;
 1003|   150k|            if (here.op & 64) {
  ------------------
  |  Branch (1003:17): [True: 28, False: 150k]
  ------------------
 1004|     28|                strm->msg = (z_const char *)"invalid distance code";
 1005|     28|                state->mode = BAD;
 1006|     28|                break;
 1007|     28|            }
 1008|   150k|            state->offset = (unsigned)here.val;
 1009|   150k|            state->extra = (unsigned)(here.op) & 15;
 1010|   150k|            state->mode = DISTEXT;
 1011|       |                /* fallthrough */
 1012|   170k|        case DISTEXT:
  ------------------
  |  Branch (1012:9): [True: 20.3k, False: 854k]
  ------------------
 1013|   170k|            if (state->extra) {
  ------------------
  |  Branch (1013:17): [True: 131k, False: 39.0k]
  ------------------
 1014|   131k|                NEEDBITS(state->extra);
  ------------------
  |  |  377|   131k|    do { \
  |  |  378|   223k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 112k, False: 110k]
  |  |  ------------------
  |  |  379|   131k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|   112k|    do { \
  |  |  |  |  368|   112k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 20.9k, False: 91.6k]
  |  |  |  |  ------------------
  |  |  |  |  369|   112k|        have--; \
  |  |  |  |  370|  91.6k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  91.6k|        bits += 8; \
  |  |  |  |  372|  91.6k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 91.6k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|   131k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 110k]
  |  |  ------------------
  ------------------
 1015|   110k|                state->offset += BITS(state->extra);
  ------------------
  |  |  384|   110k|    ((unsigned)hold & ((1U << (n)) - 1))
  ------------------
 1016|   110k|                DROPBITS(state->extra);
  ------------------
  |  |  388|   110k|    do { \
  |  |  389|   110k|        hold >>= (n); \
  |  |  390|   110k|        bits -= (unsigned)(n); \
  |  |  391|   110k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (391:14): [Folded, False: 110k]
  |  |  ------------------
  ------------------
 1017|   110k|                state->back += state->extra;
 1018|   110k|            }
 1019|       |#ifdef INFLATE_STRICT
 1020|       |            if (state->offset > state->dmax) {
 1021|       |                strm->msg = (z_const char *)"invalid distance too far back";
 1022|       |                state->mode = BAD;
 1023|       |                break;
 1024|       |            }
 1025|       |#endif
 1026|   149k|            Tracevv((stderr, "inflate:         distance %u\n", state->offset));
 1027|   149k|            state->mode = MATCH;
 1028|       |                /* fallthrough */
 1029|   160k|        case MATCH:
  ------------------
  |  Branch (1029:9): [True: 10.9k, False: 863k]
  ------------------
 1030|   160k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1030:17): [True: 724, False: 160k]
  ------------------
 1031|   160k|            copy = out - left;
 1032|   160k|            if (state->offset > copy) {         /* copy from window */
  ------------------
  |  Branch (1032:17): [True: 89.5k, False: 70.4k]
  ------------------
 1033|  89.5k|                copy = state->offset - copy;
 1034|  89.5k|                if (copy > state->whave) {
  ------------------
  |  Branch (1034:21): [True: 94, False: 89.4k]
  ------------------
 1035|     94|                    if (state->sane) {
  ------------------
  |  Branch (1035:25): [True: 94, False: 0]
  ------------------
 1036|     94|                        strm->msg = (z_const char *)
 1037|     94|                            "invalid distance too far back";
 1038|     94|                        state->mode = BAD;
 1039|     94|                        break;
 1040|     94|                    }
 1041|       |#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
 1042|       |                    Trace((stderr, "inflate.c too far\n"));
 1043|       |                    copy -= state->whave;
 1044|       |                    if (copy > state->length) copy = state->length;
 1045|       |                    if (copy > left) copy = left;
 1046|       |                    left -= copy;
 1047|       |                    state->length -= copy;
 1048|       |                    do {
 1049|       |                        *put++ = 0;
 1050|       |                    } while (--copy);
 1051|       |                    if (state->length == 0) state->mode = LEN;
 1052|       |                    break;
 1053|       |#endif
 1054|     94|                }
 1055|  89.4k|                if (copy > state->wnext) {
  ------------------
  |  Branch (1055:21): [True: 9.16k, False: 80.3k]
  ------------------
 1056|  9.16k|                    copy -= state->wnext;
 1057|  9.16k|                    from = state->window + (state->wsize - copy);
 1058|  9.16k|                }
 1059|  80.3k|                else
 1060|  80.3k|                    from = state->window + (state->wnext - copy);
 1061|  89.4k|                if (copy > state->length) copy = state->length;
  ------------------
  |  Branch (1061:21): [True: 79.1k, False: 10.3k]
  ------------------
 1062|  89.4k|            }
 1063|  70.4k|            else {                              /* copy from output */
 1064|  70.4k|                from = put - state->offset;
 1065|  70.4k|                copy = state->length;
 1066|  70.4k|            }
 1067|   159k|            if (copy > left) copy = left;
  ------------------
  |  Branch (1067:17): [True: 706, False: 159k]
  ------------------
 1068|   159k|            left -= copy;
 1069|   159k|            state->length -= copy;
 1070|  11.4M|            do {
 1071|  11.4M|                *put++ = *from++;
 1072|  11.4M|            } while (--copy);
  ------------------
  |  Branch (1072:22): [True: 11.3M, False: 159k]
  ------------------
 1073|   159k|            if (state->length == 0) state->mode = LEN;
  ------------------
  |  Branch (1073:17): [True: 149k, False: 10.2k]
  ------------------
 1074|   159k|            break;
 1075|   217k|        case LIT:
  ------------------
  |  Branch (1075:9): [True: 217k, False: 657k]
  ------------------
 1076|   217k|            if (left == 0) goto inf_leave;
  ------------------
  |  Branch (1076:17): [True: 47, False: 217k]
  ------------------
 1077|   217k|            *put++ = (unsigned char)(state->length);
 1078|   217k|            left--;
 1079|   217k|            state->mode = LEN;
 1080|   217k|            break;
 1081|  8.00k|        case CHECK:
  ------------------
  |  Branch (1081:9): [True: 8.00k, False: 866k]
  ------------------
 1082|  8.00k|            if (state->wrap) {
  ------------------
  |  Branch (1082:17): [True: 8.00k, False: 0]
  ------------------
 1083|  8.00k|                NEEDBITS(32);
  ------------------
  |  |  377|  8.00k|    do { \
  |  |  378|  38.1k|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 30.6k, False: 7.50k]
  |  |  ------------------
  |  |  379|  30.6k|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|  30.6k|    do { \
  |  |  |  |  368|  30.6k|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 495, False: 30.1k]
  |  |  |  |  ------------------
  |  |  |  |  369|  30.6k|        have--; \
  |  |  |  |  370|  30.1k|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|  30.1k|        bits += 8; \
  |  |  |  |  372|  30.1k|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 30.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|  8.00k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 7.50k]
  |  |  ------------------
  ------------------
 1084|  7.50k|                out -= left;
 1085|  7.50k|                strm->total_out += out;
 1086|  7.50k|                state->total += out;
 1087|  7.50k|                if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1087:21): [True: 7.50k, False: 0]
  |  Branch (1087:42): [True: 5.72k, False: 1.78k]
  ------------------
 1088|  5.72k|                    strm->adler = state->check =
 1089|  5.72k|                        UPDATE_CHECK(state->check, put - out, out);
  ------------------
  |  |  311|  5.72k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (311:6): [True: 0, False: 5.72k]
  |  |  ------------------
  ------------------
 1090|  7.50k|                out = left;
 1091|  7.50k|                if ((state->wrap & 4) && (
  ------------------
  |  Branch (1091:21): [True: 7.50k, False: 0]
  |  Branch (1091:42): [True: 1.39k, False: 6.11k]
  ------------------
 1092|  7.50k|#ifdef GUNZIP
 1093|  7.50k|                     state->flags ? hold :
  ------------------
  |  Branch (1093:22): [True: 0, False: 7.50k]
  ------------------
 1094|  7.50k|#endif
 1095|  7.50k|                     ZSWAP32(hold)) != state->check) {
  ------------------
  |  |  258|  7.50k|#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
  |  |  259|  7.50k|                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
  ------------------
 1096|  1.39k|                    strm->msg = (z_const char *)"incorrect data check";
 1097|  1.39k|                    state->mode = BAD;
 1098|  1.39k|                    break;
 1099|  1.39k|                }
 1100|  6.11k|                INITBITS();
  ------------------
  |  |  359|  6.11k|    do { \
  |  |  360|  6.11k|        hold = 0; \
  |  |  361|  6.11k|        bits = 0; \
  |  |  362|  6.11k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 6.11k]
  |  |  ------------------
  ------------------
 1101|  6.11k|                Tracev((stderr, "inflate:   check matches trailer\n"));
 1102|  6.11k|            }
 1103|  6.11k|#ifdef GUNZIP
 1104|  6.11k|            state->mode = LENGTH;
 1105|       |                /* fallthrough */
 1106|  6.11k|        case LENGTH:
  ------------------
  |  Branch (1106:9): [True: 0, False: 874k]
  ------------------
 1107|  6.11k|            if (state->wrap && state->flags) {
  ------------------
  |  Branch (1107:17): [True: 6.11k, False: 0]
  |  Branch (1107:32): [True: 0, False: 6.11k]
  ------------------
 1108|      0|                NEEDBITS(32);
  ------------------
  |  |  377|      0|    do { \
  |  |  378|      0|        while (bits < (unsigned)(n)) \
  |  |  ------------------
  |  |  |  Branch (378:16): [True: 0, False: 0]
  |  |  ------------------
  |  |  379|      0|            PULLBYTE(); \
  |  |  ------------------
  |  |  |  |  367|      0|    do { \
  |  |  |  |  368|      0|        if (have == 0) goto inf_leave; \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (368:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  369|      0|        have--; \
  |  |  |  |  370|      0|        hold += (unsigned long)(*next++) << bits; \
  |  |  |  |  371|      0|        bits += 8; \
  |  |  |  |  372|      0|    } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (372:14): [Folded, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  380|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (380:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1109|      0|                if ((state->wrap & 4) && hold != (state->total & 0xffffffff)) {
  ------------------
  |  Branch (1109:21): [True: 0, False: 0]
  |  Branch (1109:42): [True: 0, False: 0]
  ------------------
 1110|      0|                    strm->msg = (z_const char *)"incorrect length check";
 1111|      0|                    state->mode = BAD;
 1112|      0|                    break;
 1113|      0|                }
 1114|      0|                INITBITS();
  ------------------
  |  |  359|      0|    do { \
  |  |  360|      0|        hold = 0; \
  |  |  361|      0|        bits = 0; \
  |  |  362|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (362:14): [Folded, False: 0]
  |  |  ------------------
  ------------------
 1115|      0|                Tracev((stderr, "inflate:   length matches trailer\n"));
 1116|      0|            }
 1117|  6.11k|#endif
 1118|  6.11k|            state->mode = DONE;
 1119|       |                /* fallthrough */
 1120|  12.4k|        case DONE:
  ------------------
  |  Branch (1120:9): [True: 6.30k, False: 868k]
  ------------------
 1121|  12.4k|            ret = Z_STREAM_END;
  ------------------
  |  |  182|  12.4k|#define Z_STREAM_END    1
  ------------------
 1122|  12.4k|            goto inf_leave;
 1123|  15.7k|        case BAD:
  ------------------
  |  Branch (1123:9): [True: 15.7k, False: 859k]
  ------------------
 1124|  15.7k|            ret = Z_DATA_ERROR;
  ------------------
  |  |  186|  15.7k|#define Z_DATA_ERROR   (-3)
  ------------------
 1125|  15.7k|            goto inf_leave;
 1126|      0|        case MEM:
  ------------------
  |  Branch (1126:9): [True: 0, False: 874k]
  ------------------
 1127|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1128|      0|        case SYNC:
  ------------------
  |  Branch (1128:9): [True: 0, False: 874k]
  ------------------
 1129|       |                /* fallthrough */
 1130|      0|        default:
  ------------------
  |  Branch (1130:9): [True: 0, False: 874k]
  ------------------
 1131|      0|            return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1132|   874k|        }
 1133|       |
 1134|       |    /*
 1135|       |       Return from inflate(), updating the total counts and the check value.
 1136|       |       If there was no progress during the inflate() call, return a buffer
 1137|       |       error.  Call updatewindow() to create and/or update the window state.
 1138|       |       Note: a memory error from inflate() is non-recoverable.
 1139|       |     */
 1140|   166k|  inf_leave:
 1141|   166k|    RESTORE();
  ------------------
  |  |  348|   166k|    do { \
  |  |  349|   166k|        strm->next_out = put; \
  |  |  350|   166k|        strm->avail_out = left; \
  |  |  351|   166k|        strm->next_in = next; \
  |  |  352|   166k|        strm->avail_in = have; \
  |  |  353|   166k|        state->hold = hold; \
  |  |  354|   166k|        state->bits = bits; \
  |  |  355|   166k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (355:14): [Folded, False: 166k]
  |  |  ------------------
  ------------------
 1142|   166k|    if (state->wsize || (out != strm->avail_out && state->mode < BAD &&
  ------------------
  |  Branch (1142:9): [True: 132k, False: 33.6k]
  |  Branch (1142:26): [True: 4.95k, False: 28.6k]
  |  Branch (1142:52): [True: 3.92k, False: 1.03k]
  ------------------
 1143|  3.92k|            (state->mode < CHECK || flush != Z_FINISH)))
  ------------------
  |  |  176|     47|#define Z_FINISH        4
  ------------------
  |  Branch (1143:14): [True: 3.87k, False: 47]
  |  Branch (1143:37): [True: 47, False: 0]
  ------------------
 1144|   136k|        if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
  ------------------
  |  Branch (1144:13): [True: 0, False: 136k]
  ------------------
 1145|      0|            state->mode = MEM;
 1146|      0|            return Z_MEM_ERROR;
  ------------------
  |  |  187|      0|#define Z_MEM_ERROR    (-4)
  ------------------
 1147|      0|        }
 1148|   166k|    in -= strm->avail_in;
 1149|   166k|    out -= strm->avail_out;
 1150|   166k|    strm->total_in += in;
 1151|   166k|    strm->total_out += out;
 1152|   166k|    state->total += out;
 1153|   166k|    if ((state->wrap & 4) && out)
  ------------------
  |  Branch (1153:9): [True: 166k, False: 0]
  |  Branch (1153:30): [True: 127k, False: 39.0k]
  ------------------
 1154|   127k|        strm->adler = state->check =
 1155|   127k|            UPDATE_CHECK(state->check, strm->next_out - out, out);
  ------------------
  |  |  311|   127k|    (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
  |  |  ------------------
  |  |  |  Branch (311:6): [True: 0, False: 127k]
  |  |  ------------------
  ------------------
 1156|   166k|    strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
  ------------------
  |  Branch (1156:43): [True: 140k, False: 26.3k]
  ------------------
 1157|   166k|                      (state->mode == TYPE ? 128 : 0) +
  ------------------
  |  Branch (1157:24): [True: 149, False: 166k]
  ------------------
 1158|   166k|                      (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
  ------------------
  |  Branch (1158:24): [True: 0, False: 166k]
  |  Branch (1158:47): [True: 0, False: 166k]
  ------------------
 1159|   166k|    if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  176|   146k|#define Z_FINISH        4
  ------------------
                  if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
  ------------------
  |  |  181|  19.6k|#define Z_OK            0
  ------------------
  |  Branch (1159:11): [True: 19.6k, False: 146k]
  |  Branch (1159:22): [True: 19.6k, False: 11]
  |  Branch (1159:35): [True: 0, False: 146k]
  |  Branch (1159:57): [True: 3.36k, False: 16.2k]
  ------------------
 1160|  3.36k|        ret = Z_BUF_ERROR;
  ------------------
  |  |  188|  3.36k|#define Z_BUF_ERROR    (-5)
  ------------------
 1161|   166k|    return ret;
 1162|   166k|}
inflateEnd:
 1164|  15.4k|int ZEXPORT inflateEnd(z_streamp strm) {
 1165|  15.4k|    struct inflate_state FAR *state;
 1166|  15.4k|    if (inflateStateCheck(strm))
  ------------------
  |  Branch (1166:9): [True: 0, False: 15.4k]
  ------------------
 1167|      0|        return Z_STREAM_ERROR;
  ------------------
  |  |  185|      0|#define Z_STREAM_ERROR (-2)
  ------------------
 1168|  15.4k|    state = (struct inflate_state FAR *)strm->state;
 1169|  15.4k|    if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
                  if (state->window != Z_NULL) ZFREE(strm, state->window);
  ------------------
  |  |  254|  3.92k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
  |  Branch (1169:9): [True: 3.92k, False: 11.5k]
  ------------------
 1170|  15.4k|    ZFREE(strm, strm->state);
  ------------------
  |  |  254|  15.4k|#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
  ------------------
 1171|  15.4k|    strm->state = Z_NULL;
  ------------------
  |  |  216|  15.4k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
 1172|  15.4k|    Tracev((stderr, "inflate: end\n"));
 1173|  15.4k|    return Z_OK;
  ------------------
  |  |  181|  15.4k|#define Z_OK            0
  ------------------
 1174|  15.4k|}
inflate.c:inflateStateCheck:
   88|   228k|local int inflateStateCheck(z_streamp strm) {
   89|   228k|    struct inflate_state FAR *state;
   90|   228k|    if (strm == Z_NULL ||
  ------------------
  |  |  216|   456k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (90:9): [True: 0, False: 228k]
  ------------------
   91|   228k|        strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
  ------------------
  |  Branch (91:9): [True: 0, False: 228k]
  |  Branch (91:42): [True: 0, False: 228k]
  ------------------
   92|      0|        return 1;
   93|   228k|    state = (struct inflate_state FAR *)strm->state;
   94|   228k|    if (state == Z_NULL || state->strm != strm ||
  ------------------
  |  |  216|   456k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (94:9): [True: 0, False: 228k]
  |  Branch (94:28): [True: 0, False: 228k]
  ------------------
   95|   228k|        state->mode < HEAD || state->mode > SYNC)
  ------------------
  |  Branch (95:9): [True: 0, False: 228k]
  |  Branch (95:31): [True: 0, False: 228k]
  ------------------
   96|      0|        return 1;
   97|   228k|    return 0;
   98|   228k|}
inflate.c:updatewindow:
  260|   136k|local int updatewindow(z_streamp strm, const Bytef *end, unsigned copy) {
  261|   136k|    struct inflate_state FAR *state;
  262|   136k|    unsigned dist;
  263|       |
  264|   136k|    state = (struct inflate_state FAR *)strm->state;
  265|       |
  266|       |    /* if it hasn't been done already, allocate space for the window */
  267|   136k|    if (state->window == Z_NULL) {
  ------------------
  |  |  216|   136k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (267:9): [True: 3.92k, False: 132k]
  ------------------
  268|  3.92k|        state->window = (unsigned char FAR *)
  269|  3.92k|                        ZALLOC(strm, 1U << state->wbits,
  ------------------
  |  |  253|  3.92k|           (*((strm)->zalloc))((strm)->opaque, (items), (size))
  ------------------
  270|  3.92k|                               sizeof(unsigned char));
  271|  3.92k|        if (state->window == Z_NULL) return 1;
  ------------------
  |  |  216|  3.92k|#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
  ------------------
  |  Branch (271:13): [True: 0, False: 3.92k]
  ------------------
  272|  3.92k|    }
  273|       |
  274|       |    /* if window not in use yet, initialize */
  275|   136k|    if (state->wsize == 0) {
  ------------------
  |  Branch (275:9): [True: 3.92k, False: 132k]
  ------------------
  276|  3.92k|        state->wsize = 1U << state->wbits;
  277|  3.92k|        state->wnext = 0;
  278|  3.92k|        state->whave = 0;
  279|  3.92k|    }
  280|       |
  281|       |    /* copy state->wsize or less output bytes into the circular window */
  282|   136k|    if (copy >= state->wsize) {
  ------------------
  |  Branch (282:9): [True: 979, False: 135k]
  ------------------
  283|    979|        zmemcpy(state->window, end - state->wsize, state->wsize);
  ------------------
  |  |  216|    979|#    define zmemcpy memcpy
  ------------------
  284|    979|        state->wnext = 0;
  285|    979|        state->whave = state->wsize;
  286|    979|    }
  287|   135k|    else {
  288|   135k|        dist = state->wsize - state->wnext;
  289|   135k|        if (dist > copy) dist = copy;
  ------------------
  |  Branch (289:13): [True: 135k, False: 235]
  ------------------
  290|   135k|        zmemcpy(state->window + state->wnext, end - copy, dist);
  ------------------
  |  |  216|   135k|#    define zmemcpy memcpy
  ------------------
  291|   135k|        copy -= dist;
  292|   135k|        if (copy) {
  ------------------
  |  Branch (292:13): [True: 221, False: 135k]
  ------------------
  293|    221|            zmemcpy(state->window, end - copy, copy);
  ------------------
  |  |  216|    221|#    define zmemcpy memcpy
  ------------------
  294|    221|            state->wnext = copy;
  295|    221|            state->whave = state->wsize;
  296|    221|        }
  297|   135k|        else {
  298|   135k|            state->wnext += dist;
  299|   135k|            if (state->wnext == state->wsize) state->wnext = 0;
  ------------------
  |  Branch (299:17): [True: 14, False: 135k]
  ------------------
  300|   135k|            if (state->whave < state->wsize) state->whave += dist;
  ------------------
  |  Branch (300:17): [True: 77.4k, False: 58.0k]
  ------------------
  301|   135k|        }
  302|   135k|    }
  303|   136k|    return 0;
  304|   136k|}

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

zcalloc:
  303|  19.3k|voidpf ZLIB_INTERNAL zcalloc(voidpf opaque, unsigned items, unsigned size) {
  304|  19.3k|    (void)opaque;
  305|  19.3k|    return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
  ------------------
  |  Branch (305:12): [True: 19.3k, Folded]
  ------------------
  306|  19.3k|                              (voidpf)calloc(items, size);
  307|  19.3k|}
zcfree:
  309|  19.3k|void ZLIB_INTERNAL zcfree(voidpf opaque, voidpf ptr) {
  310|  19.3k|    (void)opaque;
  311|  19.3k|    free(ptr);
  312|  19.3k|}

